/* Time Zone Meeting Planner — Frontend Styles
   Scoped entirely under .tzmp-app so it never leaks into the theme. */

.tzmp-app {
	--tzmp-radius: 18px;
	--tzmp-radius-sm: 12px;
	--tzmp-gap: 20px;
	--tzmp-primary-1: #6366f1;
	--tzmp-primary-2: #8b5cf6;
	--tzmp-accent: #06b6d4;
	--tzmp-success: #10b981;
	--tzmp-warning: #f59e0b;
	--tzmp-danger: #ef4444;
	--tzmp-bg: #f6f7fb;
	--tzmp-card-bg: rgba(255, 255, 255, 0.85);
	--tzmp-text: #1e2130;
	--tzmp-text-muted: #6b7280;
	--tzmp-border: rgba(15, 23, 42, 0.08);
	--tzmp-shadow: 0 10px 40px rgba(31, 41, 55, 0.08), 0 2px 8px rgba(31, 41, 55, 0.04);
	--tzmp-shadow-hover: 0 16px 48px rgba(31, 41, 55, 0.14), 0 4px 12px rgba(31, 41, 55, 0.08);
	--tzmp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	font-family: var(--tzmp-font);
	color: var(--tzmp-text);
	background: linear-gradient(180deg, var(--tzmp-bg) 0%, #eef0fb 100%);
	border-radius: 24px;
	padding: clamp(16px, 3vw, 36px);
	max-width: 1280px;
	margin: 0 auto;
	box-sizing: border-box;
	position: relative;
	isolation: isolate;
}

.tzmp-app.tzmp-theme-dark,
.tzmp-app.tzmp-theme-auto.tzmp-dark-active {
	--tzmp-bg: #0f1220;
	--tzmp-card-bg: rgba(30, 33, 51, 0.72);
	--tzmp-text: #f1f2f8;
	--tzmp-text-muted: #a1a5bd;
	--tzmp-border: rgba(255, 255, 255, 0.08);
	--tzmp-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
	--tzmp-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.45);
	background: linear-gradient(180deg, #0f1220 0%, #161a2e 100%);
}

.tzmp-app *,
.tzmp-app *::before,
.tzmp-app *::after {
	box-sizing: border-box;
}

/* ---------- Header ---------- */
.tzmp-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: var(--tzmp-gap);
}

.tzmp-title {
	font-size: clamp(22px, 2.4vw, 30px);
	font-weight: 800;
	margin: 0 0 4px;
	background: linear-gradient(90deg, var(--tzmp-primary-1), var(--tzmp-primary-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	letter-spacing: -0.02em;
}

.tzmp-subtitle {
	margin: 0;
	color: var(--tzmp-text-muted);
	font-size: 14.5px;
}

.tzmp-icon-btn {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid var(--tzmp-border);
	background: var(--tzmp-card-bg);
	backdrop-filter: blur(10px);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: var(--tzmp-shadow);
	position: relative;
	font-size: 16px;
}
.tzmp-icon-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--tzmp-shadow-hover); }
.tzmp-icon-moon { display: none; }
.tzmp-theme-dark .tzmp-icon-sun,
.tzmp-dark-active .tzmp-icon-sun { display: none; }
.tzmp-theme-dark .tzmp-icon-moon,
.tzmp-dark-active .tzmp-icon-moon { display: inline; }

/* ---------- Layout ---------- */
.tzmp-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: var(--tzmp-gap);
	align-items: start;
}

.tzmp-side-panel {
	display: flex;
	flex-direction: column;
	gap: var(--tzmp-gap);
	position: sticky;
	top: 16px;
}

@media (max-width: 960px) {
	.tzmp-grid { grid-template-columns: 1fr; }
	.tzmp-side-panel { position: static; }
}

/* ---------- Card ---------- */
.tzmp-card {
	background: var(--tzmp-card-bg);
	backdrop-filter: blur(16px) saturate(140%);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	border: 1px solid var(--tzmp-border);
	border-radius: var(--tzmp-radius);
	padding: clamp(18px, 2.4vw, 28px);
	box-shadow: var(--tzmp-shadow);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.tzmp-card:hover { box-shadow: var(--tzmp-shadow-hover); }

.tzmp-card-title {
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 16px;
	letter-spacing: -0.01em;
}

/* ---------- Form fields ---------- */
.tzmp-field { margin-bottom: 16px; }
.tzmp-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 520px) { .tzmp-field-row { grid-template-columns: 1fr; } }

.tzmp-field label,
.tzmp-field-label-row label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--tzmp-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tzmp-field-label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.tzmp-input,
select.tzmp-input,
textarea.tzmp-input {
	width: 100%;
	padding: 11px 14px;
	border-radius: var(--tzmp-radius-sm);
	border: 1.5px solid var(--tzmp-border);
	background: color-mix(in srgb, var(--tzmp-card-bg) 60%, transparent);
	color: var(--tzmp-text);
	font-size: 14.5px;
	font-family: inherit;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tzmp-input:focus,
select.tzmp-input:focus,
textarea.tzmp-input:focus {
	outline: none;
	border-color: var(--tzmp-primary-1);
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
textarea.tzmp-input { resize: vertical; }

.tzmp-btn-add-participant {
	border: none;
	background: none;
	color: var(--tzmp-primary-1);
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
	transition: background 0.2s ease;
}
.tzmp-btn-add-participant:hover { background: rgba(99, 102, 241, 0.1); }

/* ---------- Timezone searchable dropdown ---------- */
.tzmp-tz-select { position: relative; }
.tzmp-tz-dropdown {
	position: absolute;
	z-index: 40;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	max-height: 260px;
	overflow-y: auto;
	background: var(--tzmp-card-bg);
	backdrop-filter: blur(20px);
	border: 1px solid var(--tzmp-border);
	border-radius: var(--tzmp-radius-sm);
	box-shadow: var(--tzmp-shadow-hover);
	list-style: none;
	margin: 0;
	padding: 6px;
}
.tzmp-tz-dropdown li {
	padding: 9px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13.5px;
	display: flex;
	justify-content: space-between;
	gap: 10px;
}
.tzmp-tz-dropdown li:hover,
.tzmp-tz-dropdown li.is-active {
	background: linear-gradient(90deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.14));
}
.tzmp-tz-dropdown .tzmp-tz-offset { color: var(--tzmp-text-muted); font-variant-numeric: tabular-nums; }

/* ---------- Participants ---------- */
.tzmp-participant-row {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 8px;
	align-items: start;
	margin-bottom: 10px;
	padding: 10px;
	border: 1px solid var(--tzmp-border);
	border-radius: var(--tzmp-radius-sm);
	background: rgba(99, 102, 241, 0.03);
}
@media (max-width: 520px) { .tzmp-participant-row { grid-template-columns: 1fr; } }

.tzmp-remove-participant {
	border: none;
	background: rgba(239, 68, 68, 0.1);
	color: var(--tzmp-danger);
	width: 34px;
	height: 34px;
	border-radius: 10px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	align-self: center;
	transition: background 0.2s ease;
}
.tzmp-remove-participant:hover { background: rgba(239, 68, 68, 0.2); }

/* ---------- Pills ---------- */
.tzmp-pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.tzmp-pill {
	border: 1.5px solid var(--tzmp-border);
	background: transparent;
	color: var(--tzmp-text);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}
.tzmp-pill:hover { border-color: var(--tzmp-primary-1); }
.tzmp-pill.is-active {
	background: linear-gradient(90deg, var(--tzmp-primary-1), var(--tzmp-primary-2));
	border-color: transparent;
	color: #fff;
	box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* ---------- Buttons ---------- */
.tzmp-btn {
	border: none;
	border-radius: var(--tzmp-radius-sm);
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.tzmp-btn:active { transform: scale(0.97); }
.tzmp-btn-primary {
	background: linear-gradient(90deg, var(--tzmp-primary-1), var(--tzmp-primary-2));
	color: #fff;
	box-shadow: 0 8px 22px rgba(99, 102, 241, 0.35);
}
.tzmp-btn-primary:hover { box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45); transform: translateY(-1px); }
.tzmp-btn-ghost {
	background: transparent;
	color: var(--tzmp-text);
	border: 1.5px solid var(--tzmp-border);
}
.tzmp-btn-ghost:hover { border-color: var(--tzmp-primary-1); }
.tzmp-btn-sm { padding: 8px 14px; font-size: 12.5px; background: rgba(99, 102, 241, 0.1); color: var(--tzmp-primary-1); }
.tzmp-btn-sm:hover { background: rgba(99, 102, 241, 0.18); }
.tzmp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Ripple */
.tzmp-btn .tzmp-ripple {
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	transform: scale(0);
	animation: tzmp-ripple 0.6s ease-out;
	pointer-events: none;
}
@keyframes tzmp-ripple { to { transform: scale(3); opacity: 0; } }

.tzmp-form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tzmp-form-messages { min-height: 0; }
.tzmp-form-messages:not(:empty) {
	background: rgba(239, 68, 68, 0.1);
	color: var(--tzmp-danger);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13px;
	margin-bottom: 12px;
	font-weight: 600;
}

/* ---------- Live clocks ---------- */
.tzmp-clocks-list { display: flex; flex-direction: column; gap: 10px; }
.tzmp-clock-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-radius: var(--tzmp-radius-sm);
	background: rgba(99, 102, 241, 0.05);
	border: 1px solid var(--tzmp-border);
}
.tzmp-clock-name { font-weight: 700; font-size: 13.5px; }
.tzmp-clock-tz { font-size: 11.5px; color: var(--tzmp-text-muted); }
.tzmp-clock-time { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 800; color: var(--tzmp-primary-1); }

/* ---------- Results ---------- */
.tzmp-results-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tzmp-result-item {
	border: 1.5px solid var(--tzmp-border);
	border-radius: var(--tzmp-radius-sm);
	padding: 12px 14px;
	animation: tzmp-fade-in 0.35s ease both;
}
.tzmp-result-item.is-best { border-color: var(--tzmp-success); background: rgba(16, 185, 129, 0.06); }
.tzmp-result-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tzmp-result-time { font-size: 17px; font-weight: 800; }
.tzmp-badge {
	font-size: 11px;
	font-weight: 800;
	padding: 3px 10px;
	border-radius: 999px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.tzmp-badge-recommended { background: rgba(16, 185, 129, 0.15); color: var(--tzmp-success); }
.tzmp-badge-score { background: rgba(99, 102, 241, 0.12); color: var(--tzmp-primary-1); }
.tzmp-badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--tzmp-warning); }
.tzmp-result-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--tzmp-text-muted); }
.tzmp-result-meta strong { color: var(--tzmp-text); }

.tzmp-holiday-banner {
	background: rgba(245, 158, 11, 0.12);
	color: #92610c;
	border-radius: var(--tzmp-radius-sm);
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 12px;
}
.tzmp-theme-dark .tzmp-holiday-banner,
.tzmp-dark-active .tzmp-holiday-banner { color: #fbbf24; }

.tzmp-dst-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.tzmp-dst-item { display: flex; justify-content: space-between; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: rgba(6, 182, 212, 0.06); }
.tzmp-dst-active { color: var(--tzmp-accent); font-weight: 700; }

/* ---------- Timeline ---------- */
.tzmp-timeline-wrap h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--tzmp-text-muted); margin: 0 0 10px; }
.tzmp-timeline { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tzmp-timeline-row { display: flex; flex-direction: column; gap: 4px; }
.tzmp-timeline-label { font-size: 12px; font-weight: 700; }
.tzmp-timeline-bar { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 18px; border-radius: 6px; overflow: hidden; }
.tzmp-timeline-hour { background: rgba(99, 102, 241, 0.08); }
.tzmp-timeline-hour.is-working { background: linear-gradient(180deg, var(--tzmp-success), #059669); }
.tzmp-timeline-hour.is-sleeping { background: rgba(99, 102, 241, 0.18); }
.tzmp-timeline-hour.is-best { outline: 2px solid var(--tzmp-primary-1); outline-offset: -2px; }

/* ---------- Export row ---------- */
.tzmp-export-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Modal ---------- */
.tzmp-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; }
.tzmp-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 18, 32, 0.55); backdrop-filter: blur(3px); }
.tzmp-modal-panel {
	position: relative;
	background: var(--tzmp-card-bg);
	backdrop-filter: blur(20px);
	border-radius: var(--tzmp-radius);
	padding: 24px;
	width: min(420px, 90vw);
	box-shadow: var(--tzmp-shadow-hover);
	border: 1px solid var(--tzmp-border);
}
.tzmp-modal-panel h3 { margin: 0 0 14px; }
.tzmp-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.tzmp-modal-message { font-size: 13px; margin-top: 10px; font-weight: 600; min-height: 18px; }

/* ---------- Loading overlay ---------- */
.tzmp-loading-overlay {
	position: absolute;
	inset: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: blur(4px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	border-radius: 24px;
	font-weight: 700;
	color: var(--tzmp-primary-1);
}
.tzmp-theme-dark .tzmp-loading-overlay,
.tzmp-dark-active .tzmp-loading-overlay { background: rgba(15, 18, 32, 0.65); }
.tzmp-skeleton-spinner {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 4px solid rgba(99, 102, 241, 0.15);
	border-top-color: var(--tzmp-primary-1);
	animation: tzmp-spin 0.8s linear infinite;
}
@keyframes tzmp-spin { to { transform: rotate(360deg); } }

/* ---------- Tooltips ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: #1e2130;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 6px 10px;
	border-radius: 6px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 60;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Animations ---------- */
@keyframes tzmp-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.tzmp-app.tzmp-no-animations * { animation: none !important; transition: none !important; }

/* ---------- Footer ---------- */
.tzmp-footer { text-align: center; margin-top: 22px; font-size: 12px; color: var(--tzmp-text-muted); }

/* ---------- Responsive fine-tuning ---------- */
@media (max-width: 425px) {
	.tzmp-app { padding: 14px; border-radius: 16px; }
	.tzmp-export-row .tzmp-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
}

/* ---------- Print ---------- */
@media print {
	.tzmp-form, .tzmp-header-actions, .tzmp-export-row, .tzmp-loading-overlay, .tzmp-footer { display: none !important; }
	.tzmp-app { background: #fff !important; box-shadow: none !important; }
	.tzmp-card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
