/* Aeternaline — Premium Flat World Time Chrono Stylesheet */

:root {
    /* --- LIGHT THEME (DEFAULT - PURE WHITE) --- */
    --bg-base: #ffffff;
    --card-bg: #ffffff;
    --card-border: rgba(30, 37, 48, 0.08);
    --text-primary: #181d26;
    --text-muted: #5e6d82;
    --text-dim: #94a3b8;
    
    --accent-blue: #0284c7;
    --accent-violet: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.08);
    
    --time-line-color: #ff3b30; /* Crimson current timeline */
    --time-line-glow: rgba(255, 59, 48, 0.2);

    --font-primary: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --left-panel-width: 260px;
    --tracker-height: 72px;
}

/* --- CELESTIAL DARK THEME OVERRIDES --- */
body.theme-dark {
    --bg-base: #0a0a10;
    --card-bg: #0a0a10;
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f1f6;
    --text-muted: #8a8a9c;
    --text-dim: #555566;
    
    --accent-blue: #38bdf8;
    --accent-violet: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.1);
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-primary);
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0;
}
body.theme-dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Background Nebula - made extremely subtle and translucent to keep pure white appearance */
.bg-nebula {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-base);
    transition: background 0.3s ease;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.06; /* Highly translucent for minimal look */
    animation: drift 28s infinite alternate ease-in-out;
}

body.theme-dark .orb {
    opacity: 0.04;
}

.orb-1 {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
    top: -220px;
    left: -120px;
}

.orb-2 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.12), transparent 70%);
    bottom: -160px;
    right: -110px;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.1); }
}

/* App Layout Grid */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0; /* Removed vertical padding so header flush */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 0px; /* Zero gaps for contiguous flat tiles */
}

/* App Header Section */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px 20px;
    background: var(--card-bg);
    border-bottom: none; /* Removed under-header line */
    border-radius: 0; /* Pure Flat */
    box-shadow: none !important; /* No Drop Shadows */
    animation: headerSlideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.logo-icon {
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    animation: logoSpin 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-area:hover .logo-icon {
    transform: rotate(180deg);
}

.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.logo-text .subtitle {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* Header Controls cluster */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

/* Segmented Control (Format selection) */
.segmented-control {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px;
    border-radius: 9999px; /* Pill Rounded */
    box-shadow: none !important;
}

body.theme-dark .segmented-control {
    background: rgba(255, 255, 255, 0.05);
}

.segment-slider {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc(50% - 2px);
    background: var(--text-primary);
    border-radius: 9999px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.segmented-control.format-12h .segment-slider {
    transform: translateX(100%);
}

.segment-btn {
    position: relative;
    z-index: 2;
    flex: 1;
    text-align: center;
    background: transparent !important;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px; /* Pill Rounded */
    cursor: pointer;
    transition: color 0.15s ease;
    box-shadow: none !important;
}

.segment-btn:hover {
    color: var(--text-primary);
}

.segment-btn.active {
    color: var(--bg-base);
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%; /* Circular Button */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
    box-shadow: none !important;
}

body.theme-dark .btn-theme-toggle {
    background: rgba(255, 255, 255, 0.05);
}

.btn-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.theme-dark .btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-theme-toggle svg {
    width: 14px;
    height: 14px;
}

/* System sync indicator badge (Same height, borderless interactive pill) */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px; /* Symmetrical padding perfectly framing the dot */
    border-radius: 9999px; /* Pill Rounded */
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
    border: none;
    cursor: default; /* Not clickable by default when LIVE */
    box-shadow: none !important;
    transition: background 0.15s, opacity 0.15s, padding 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

body.theme-dark .status-badge {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.status-badge.clickable {
    cursor: pointer;
}

.status-badge.clickable:hover {
    background: rgba(0, 0, 0, 0.08);
}

.status-badge.custom-time {
    padding: 6px 6px 6px 12px; /* Tighter right side when timer pill is expanded */
}

body.theme-dark .status-badge.clickable:hover {
    background: rgba(255, 255, 255, 0.08);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background-color: #10b981;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0;
    color: transparent;
    overflow: hidden;
}

.status-badge.custom-time .status-indicator {
    width: 38px;
    height: 18px;
    background-color: rgba(0, 0, 0, 0.08);
    font-size: 0.6rem;
    color: var(--text-primary);
    padding: 0;
}

body.theme-dark .status-badge.custom-time .status-indicator {
    background-color: rgba(255, 255, 255, 0.1);
}

.status-badge.revert-mode .status-indicator {
    width: 6px;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.08);
    font-size: 0;
    color: transparent;
}

body.theme-dark .status-badge.revert-mode .status-indicator {
    background-color: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none !important;
}

/* Primary CTA Add Timezone Button */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--text-primary);
    border: none;
    color: var(--bg-base);
    padding: 8px 16px;
    border-radius: 9999px; /* Pill Rounded */
    font-weight: 600;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none !important;
}

.btn-primary.max-reached {
    background-color: transparent !important;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        var(--card-border) 3px,
        var(--card-border) 4px
    ) !important;
    color: var(--text-primary) !important;
    pointer-events: none;
    border: 1px solid var(--card-border);
}

.btn-primary.max-reached svg {
    display: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(1.02); /* Scale up on click */
}

.btn-primary svg {
    width: 14px;
    height: 14px;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); /* Transition for rotation */
}

.btn-primary:hover svg {
    transform: rotate(90deg); /* 90 degrees rotation on hover */
}

/* Core Time Tracker Panel Widget Card */
.tracker-card {
    position: relative;
    background: var(--card-bg);
    border: none; /* Removed outline borders */
    border-radius: 0; /* Pure Flat */
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: none !important; /* No Drop Shadows */
}

/* Vertical Shared Indicator Now Line (NOW RED WITH NO GLOW / MINIMAL) */
.shared-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--left-panel-width) + 45%);
    width: 2px;
    background-color: var(--time-line-color);
    z-index: 100;
    pointer-events: none;
    box-shadow: none !important; /* No Drop Shadows */
}

.shared-now-line .glow-point {
    display: none !important; /* Removed the red dot on top of the time track */
}

/* Centered floating digital clock above shared now line (NO BACKGROUND, NO SHADOW, NO BORDER, CENTERED ON THE LINE) */
.glowing-time-readout {
    position: absolute;
    top: calc(var(--tracker-height) / 2); /* Centered vertically in the 80px bar */
    left: 50%;
    transform: translate(-50%, -50%); /* Centered horizontally and vertically where the red dot is */
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: transparent !important; /* No black background */
    padding: 4px 10px;
    border-radius: 0; /* Pure Flat */
    box-shadow: none !important; /* No Drop Shadows */
    z-index: 110;
    white-space: nowrap;
}

.glowing-time-readout .time-text {
    font-family: var(--font-mono);
    font-size: 1.45rem; /* Increased font size for highly prominent layout! */
    font-weight: 700;
    color: var(--text-primary) !important; /* Same color as track digits */
    letter-spacing: 0.5px;
}

.glowing-time-readout .ampm-text {
    display: none !important; /* Removed AM/PM marker from main floating time */
}

/* Static Header Clock Space Container */
.static-clock-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--tracker-height);
    pointer-events: none; /* Ignore mouse interactions but let children capture them */
    z-index: 105;
}

.static-clock-header .floating-format-selector,
.static-clock-header .floating-status-badge {
    pointer-events: auto; /* Active search and selector pointer captures */
}

/* Floating 24/12 selector (Moved all the way to the Left) */
.floating-format-selector {
    position: absolute;
    top: 50%;
    left: 20px; /* Positioned to match lateral padding from the header */
    transform: translate(0, -50%);
    z-index: 110;
    display: flex;
    align-items: center;
}

/* Live status indicator (Moved all the way to the Right) */
.floating-status-badge {
    position: absolute;
    top: 50%;
    right: 20px; /* Positioned to match lateral padding from the header/footer */
    transform: translate(0, -50%);
    z-index: 110;
    display: flex;
    align-items: center;
}

/* Active Tracks List */
.tracks-list {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    position: relative;
    padding-top: var(--tracker-height); /* Same height as track row! */
}

/* Single Track Row - Has dynamic progressive gray background spanning end-to-edge */
.track-row {
    display: flex;
    height: var(--tracker-height);
    border-bottom: 1px solid var(--card-border);
    position: relative;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s, opacity 0.2s;
    user-select: none;
    box-shadow: none !important;
    gap: 8px;
    animation: trackReveal 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    opacity: 0;
}

.track-row.dragging {
    opacity: 0.85;
    background: #e2e8f0 !important;
    z-index: 1000;
    box-shadow: none !important;
}

body.theme-dark .track-row.dragging {
    background: #1e1e2f !important;
}

/* Left panel: Info zone (Fully transparent background to inherit row's progressive color) */
.track-info {
    width: var(--left-panel-width);
    min-width: var(--left-panel-width);
    padding: 0 0 0 14px; /* Removed right padding so the delete icon hits the absolute rightmost edge */
    display: flex;
    align-items: center;
    border-right: none; /* Removed border to space out with pure whitespace gap */
    z-index: 10;
    gap: 4px; /* Reduced to 4px to establish exact gap between city hover bg and delete bg */
    background-color: transparent !important; /* Inherit parent row's shading */
    position: relative;
}

/* Rearrange Drag Handles */
.drag-handle {
    color: var(--text-dim);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    margin-right: 6px; /* Retain original distance from the label despite reduced flex gap */
    transition: color 0.15s;
}

.drag-handle:hover {
    color: var(--text-primary);
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 14px;
    height: 14px;
}

/* Country names and editable click vectors */
.name-click-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    position: relative;
    padding: 4px 10px; /* Restored symmetric padding since delete icon is no longer absolute */
    border-radius: 8px; /* Beautiful 8px border radius hover effect */
    transition: background-color 0.15s;
    overflow: hidden;
}

.name-click-zone:hover {
    background-color: rgba(0, 0, 0, 0.035);
}

body.theme-dark .name-click-zone:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.country-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.time-zone-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}



/* Dynamic offset badges */
.offset-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: transparent;
    padding: 0 4px 0 0; /* slight right padding */
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.offset-badge.local {
    background: transparent;
    color: var(--text-muted);
}

/* Delete active row button (Shown on hover, matching height and 8px border-radius) */
.btn-delete-track {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    width: 28px;
    height: 36px; /* Matches the exact height of .name-click-zone */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
}

.btn-delete-track:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.theme-dark .btn-delete-track:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-delete-track svg {
    width: 14px;
    height: 14px;
}

.track-row:hover .btn-delete-track {
    opacity: 1;
    pointer-events: auto;
}

.btn-delete-track:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08); /* Transparent red hover matching the 8px border-radius shape */
}

.btn-delete-track svg {
    width: 14px; /* Set to standard size (matching handles) to make the scaling effect prominent and beautiful */
    height: 14px;
    stroke-width: 2;
    transform: scale(0.5); /* 50% smaller when hovering over the track line next to the city */
    transform-origin: center; /* Enforce centered scaling pivot point */
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s;
}

/* Spring back to full 100% scale (14px) when hovering directly over the delete button container */
.btn-delete-track:hover svg {
    transform: scale(1.0) !important;
}

/* Right panel: Timescales slider container (Fully transparent to inherit row gray shades) */
.track-timeline {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
    background: transparent !important; /* Inherit parent row's shading */
}

.track-timeline:active {
    cursor: grabbing;
}

/* Removed colorful Day/Night bands layers to propagate pure gray timescale backgrounds */
.bands-layer {
    display: none !important;
}

/* Ticks rendering layer */
.ticks-layer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 2;
}

/* Center Hour digits vertically, align lines to the bottom of the track */
.tick-element {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 48px;
    transform: translateX(-50%);
    pointer-events: none;
}

.tick-digit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Perfectly centered vertically and horizontally */
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0.85;
    letter-spacing: -0.4px;
    white-space: nowrap;
}

/* Digits color-matched timeline ticks */
.tick-line {
    position: absolute;
    bottom: 0; /* Aligned precisely to the bottom of the track row */
    left: 50%;
    transform: translateX(-50%);
}

.tick-line.hour-line {
    height: 18px; /* Reduced from 22px */
    background-color: var(--text-primary);
    opacity: 0.85;
    width: 1px;
}

.tick-line.half-hour-line {
    height: 12px; /* Standard height */
    background-color: var(--text-primary);
    opacity: 0.85;
    width: 1px; /* Thinner than hour markers */
}

.tick-line.ten-min-line {
    height: 8px; /* Increased from 4px */
    background-color: var(--text-primary);
    opacity: 0.25;
    width: 1px;
}

/* Outside standard working hours opacity scales apply ONLY to digits! */
.tick-element.working-hours .tick-digit {
    opacity: 0.85;
}

.tick-element.shoulder-hours .tick-digit {
    opacity: 0.75; /* Saturated first hour before and after standard working hours */
}

.tick-element.night-hours .tick-digit {
    opacity: 0.50; /* Saturated outside standard hours */
}

/* Pointer Hover scanning indicators */
.hover-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(30, 41, 59, 0.25); /* Elegant, dark translucent slate tracker line */
    pointer-events: none;
    z-index: 50;
    display: none;
    box-shadow: none !important;
}

.hover-tooltip {
    position: absolute;
    top: 4px; /* Repositioned to the top part of the track row */
    transform: translateX(-50%);
    background: #1e293b; /* Premium dark slate background */
    color: #ffffff; /* White text for contrast on dark badge */
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px; /* Beautifully rounded corners shape */
    pointer-events: none;
    z-index: 60;
    white-space: nowrap;
    display: none;
    box-shadow: none !important;
}

/* Loading animations */
.loading-state {
    padding: 50px 0;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0,0,0,0.05);
    border-top: 2px solid var(--accent-violet);
    border-radius: 0; /* Pure Flat */
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Entry animations --- */
@keyframes headerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(180deg); }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes trackReveal {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dashboard Legend (Tooltips) */
.app-legend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 20px;
    padding: 24px 20px;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        var(--card-border) 3px,
        var(--card-border) 4px
    );
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.85s both;
    opacity: 0;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.app-legend .info-item:first-child {
    justify-content: flex-start;
}

.app-legend .info-item:last-child {
    justify-content: flex-end;
}

.info-item svg {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
}

/* Dashboard Footer notes - Arranged in a space-between layout */
.app-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px 24px 20px;
    border-top: none;
    margin-top: 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
    opacity: 0;
}

.footer-left, .footer-right {
    display: flex;
    align-items: center;
}

/* --- Modal Keyframe Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Overlay Dialog Add modals (Flat styles matching) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.15s forwards ease-out;
}

body.theme-dark .modal-overlay {
    background: rgba(3, 3, 7, 0.6);
}

.modal-card {
    background: var(--bg-base);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 460px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
    overflow: hidden;
    transform: scale(0.98);
    animation: scaleIn 0.18s forwards ease-out;
    box-shadow: none !important; /* No Drop Shadows */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%; /* Circular Button */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-close:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}

.btn-close svg {
    width: 16px;
    height: 16px;
}

/* Modal Search Filters */
.modal-search {
    position: relative;
    padding: 12px 20px 6px 20px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-icon {
    position: absolute;
    left: 30px;
    color: var(--text-dim);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.modal-search input {
    width: 100%;
    background: #f1f5f9;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    padding: 10px 14px 10px 36px;
    border-radius: 9999px; /* Pill Rounded */
    outline: none;
    transition: all 0.15s;
}

.modal-search input:focus {
    border-color: var(--accent-violet);
    background: var(--bg-base);
}

.btn-clear {
    position: absolute;
    right: 30px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.btn-clear svg {
    width: 14px;
    height: 14px;
}

/* Modal categories bar */
.modal-categories {
    display: flex;
    gap: 6px;
    padding: 6px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.category-btn {
    background: rgba(0,0,0,0.04);
    border: none;
    color: var(--text-muted);
    font-family: var(--font-primary);
    padding: 5px 12px;
    border-radius: 9999px; /* Pill Rounded */
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.category-btn:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.06);
}

.category-btn.active {
    background: var(--text-primary);
    color: var(--bg-base);
}

/* Modal Suggestion results */
.results-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sticky-continent-header {
    position: sticky;
    top: -10px;
    background: var(--bg-base);
    padding: 12px 0 4px 14px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0,0,0,0.02);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: none !important;
}

.result-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.15);
}

.result-item.already-added {
    background-color: transparent !important;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        var(--card-border) 3px,
        var(--card-border) 4px
    );
    cursor: default !important;
    opacity: 0.6;
}

.result-item.already-added:hover {
    background-color: transparent !important;
}

.result-item.already-added .result-region {
    font-weight: 700;
}

.result-item.already-added .result-city,
.result-item.already-added .result-time {
    color: var(--text-muted);
}

.result-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.result-city {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-region {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.result-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-offset {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: rgba(0,0,0,0.04);
    padding: 1px 4px;
    border-radius: 0; /* Pure Flat */
    color: var(--text-muted);
}

.result-time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-results {
    text-align: center;
    padding: 30px 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.empty-results svg {
    width: 24px;
    height: 24px;
    margin-bottom: 6px;
    opacity: 0.5;
}

/* Responsiveness adjustments */
@media (max-width: 900px) {
    :root {
        --left-panel-width: 190px;
        --tracker-height: 64px;
    }
    
    .country-name {
        font-size: 0.78rem;
    }
    .glowing-time-readout .time-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 650px) {
    .app-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 12px;
    }
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    .btn-primary {
        flex: 1;
        justify-content: center;
    }
}

.name-click-zone .abbr-text {
    display: none;
}

/* Ultra-narrow mobile optimization */
@media (max-width: 550px) {
    .name-click-zone .full-text {
        display: none !important;
    }
    .name-click-zone .abbr-text {
        display: inline !important;
    }
    .name-click-zone {
        max-width: max-content !important;
        flex: 0 0 auto !important;
        padding: 4px 6px !important;
    }
    .track-info {
        width: max-content !important;
        min-width: 0 !important;
        padding-left: 8px !important;
        padding-right: 4px !important;
    }
    #btn-add-timezone span {
        display: none !important;
    }
    #btn-add-timezone {
        flex: 0 0 auto !important;
        padding: 8px 12px !important;
    }
    .app-legend {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 16px 20px;
    }
    .info-item {
        flex-direction: column !important;
        align-items: flex-start;
        text-align: left;
        gap: 4px;
        font-size: 0.6rem !important;
    }
}
