/*
 * Aurora Background and Card Styles
 * Inspired by the provided screenshot.
 * Adapted for the worldtime project.
 */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    
    /* Light Theme Colors */
    --aurora-color-1: #ffaf7b;
    --aurora-color-2: #d980fa;
    --aurora-color-3: #ffa8a8;
    --aurora-color-4: #74b9ff;
    --aurora-color-5: #a29bfe;

    --glass-card-bg: rgba(255, 255, 255, 0.25);
    --glass-card-border: rgba(255, 255, 255, 0.4);
    --glass-card-border-hover: rgba(255, 255, 255, 0.7);
    --glass-card-blur: 10px;
    --glass-card-radius: 16px;

    --solid-card-bg: #f7f7fe;
    --solid-card-radius: 24px;
    --solid-card-shadow: 0 8px 32px 0 rgba(120, 120, 180, 0.15);
    --solid-card-shadow-hover: 0 12px 40px 0 rgba(100, 100, 150, 0.2);

    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-accent: #3498db;
}

.dark {
    /* Dark Theme Colors (GitHub Inspired) */
    --aurora-color-1: #4a84d5;
    --aurora-color-2: #c15387;
    --aurora-color-3: #291578;
    --aurora-color-4: #0d1ba1;
    --aurora-color-5: #4a84d5; /* Loop back to first color */

    --glass-card-bg: #161b22;
    --glass-card-border: #30363d;
    --glass-card-border-hover: #8b949e;

    --solid-card-bg: #0d1117;
    --solid-card-shadow: 0 0 0 1px #30363d;
    --solid-card-shadow-hover: 0 0 0 1px #8b949e;

    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-accent: #58a6ff;
}

.aurora-background {
    font-family: var(--font-sans);
    min-height: 100vh;
    background: linear-gradient(125deg, var(--aurora-color-1), var(--aurora-color-2) 25%, var(--aurora-color-3) 50%, var(--aurora-color-4) 75%, var(--aurora-color-5));
    background-size: 400% 400%;
    animation: aurora-animation 20s ease infinite;
    color: var(--text-primary);
    box-sizing: border-box;
    transition: background 0.5s ease;
}

@keyframes aurora-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Card Styles */
.aurora-card-container {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glass Card Style */
.aurora-glass-card {
    background: var(--glass-card-bg);
    backdrop-filter: blur(var(--glass-card-blur));
    -webkit-backdrop-filter: blur(var(--glass-card-blur));
    border-radius: var(--glass-card-radius);
    border: 1px solid var(--glass-card-border);
    padding: 1.5rem 2rem;
    transition: transform 0.3s ease, border 0.3s ease, background 0.3s ease;
}

.aurora-glass-card:hover {
    transform: scale(1.02);
    border: 1px solid var(--glass-card-border-hover);
}

.aurora-glass-card .card-user {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.aurora-glass-card .card-user-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.aurora-glass-card .card-content a {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
}

/* Solid Card Style */
.aurora-solid-container {
    background: var(--solid-card-bg);
    border-radius: var(--solid-card-radius);
    box-shadow: var(--solid-card-shadow);
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.aurora-solid-card {
    background: var(--solid-card-bg);
    border-radius: var(--solid-card-radius);
    box-shadow: var(--solid-card-shadow);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.aurora-solid-card:hover {
    transform: scale(1.02);
    box-shadow: var(--solid-card-shadow-hover);
}

.aurora-solid-card .card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.aurora-solid-card .card-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #374151; /* coolGray-700 */
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.aurora-solid-card .card-header-title {
    font-weight: 600;
}

.aurora-solid-card .card-header-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.aurora-solid-card .release-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.aurora-solid-card .release-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.aurora-solid-card .release-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.aurora-solid-card .release-item-icon {
    font-size: 1.1rem;
    margin-top: 2px;
}

/* Dark Mode Fixes for Timeline and Buttons */

/* Timeline text colors */
.dark .hour-label .num,
.dark .header-hour .num,
.dark .hour-label .ampm,
.dark .header-hour .ampm {
    color: var(--text-primary);
    opacity: 0.9;
}

.dark .row-left {
    color: var(--text-primary);
}

/* Button styles within cards */
.dark .aurora-solid-card .btn {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--glass-card-border);
}

.dark .aurora-solid-card .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--glass-card-border-hover);
}


/* 
==============================================
=== Comprehensive Dark Mode Override Patch ===
==============================================
*/

/* 1. Top Bar Buttons */
.dark .topbar-ctl {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--glass-card-border);
}

.dark .topbar-ctl:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
}

/* Special case for the segmented control (12h/24h) */
.dark .segmented {
    border-color: var(--glass-card-border);
}
.dark .segmented > button {
    background-color: transparent !important; /* Let the container handle the bg */
    border: none !important;
}
.dark .segmented > button.active, 
.dark .segmented > button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
}

/* 2. Timeline Toolbar */
.dark #topControls {
    background-color: transparent !important; /* Inherit from container */
    border-color: var(--glass-card-border) !important;
}

.dark #searchWrap {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--glass-card-border) !important;
}

.dark #citySearch {
    color: var(--text-primary);
}

.dark #weekBar .btn {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--glass-card-border);
}
.dark #weekBar .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
.dark #weekBar #btnNow {
    background-color: #4f46e5; /* Keep brand color for 'Now' */
    color: white;
    border: none;
}

/* 3. Hour Header */
.dark #hourHeader {
    background-color: transparent !important; /* Inherit from container */
    border-color: var(--glass-card-border) !important;
}

.dark #hourHeader .row-left {
    background-color: transparent !important; /* Inherit from container */
}

/* 4. Timeline Grid Cell Backgrounds (Vibrant Dark Mode v3) */
.dark .bg-day {
    background: #005f73 !important; /* Bright Dark Cyan */
}
.dark .bg-night {
    background: #0a2a66 !important; /* Brighter Dark Blue */
}
.dark .bg-twilight {
    background: #6a006a !important; /* Dark Purple */
}
.dark .cell.workhour {
    background: #007f7f !important; /* Dark Teal for highlight */
}

.dark .row > div.cell.day-start::before {
    background: rgba(255, 255, 255, 0.04);
}
/* 
==============================================
=== Final Dark Mode Override Patch       ===
==============================================
*/

/* 1. Timeline Toolbar Buttons (e.g. Date Buttons) */
.dark #weekBar .btn {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-secondary) !important;
    border: none !important;
}
.dark #weekBar .btn:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--text-primary) !important;
}
.dark #weekBar .btn.active {
    background-color: #4f46e5 !important; /* Keep brand color for active date */
    color: white !important;
}

/* 2. Timeline Header (Hour numbers) */
.dark #hourHeader,
.dark #hourHeader .row-left {
    background: transparent !important;
    color: var(--text-primary) !important;
}

/* 3. City Row - Left Panel */
.dark .row .row-left {
    background-color: rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid var(--glass-card-border);
    color: var(--text-primary) !important;
}

/* 4. Local City Row - Left Panel (Higher Specificity) */
.dark .row-local .row-left {
    background-color: rgba(99, 102, 241, 0.15) !important; /* Highlight color for local row */
    border-left-color: rgba(99, 102, 241, 0.8) !important;
}

/* 5. Icons and Text inside Left Panel */
.dark .row .row-left .fas,
.dark .row .row-left .far,
.dark .row .row-left .fab {
    color: var(--text-secondary) !important;
}

.dark .row .row-left .title,
.dark .row .row-left .time,
.dark .row .row-left .date {
    color: var(--text-primary) !important;
}

.dark .row .row-left .utc-offset {
    color: var(--text-secondary) !important;
}

/* 6. Ensure timeline grid text is legible */
.dark .cell .hour-label .num {
    color: var(--text-primary) !important;
}

/*
==============================================
=== SCORCHED EARTH DARK MODE FINAL PATCH   ===
==============================================
*/

/* 1. Date Buttons in Toolbar */
.dark #weekBar button {
    background-color: #1f2937 !important; /* gray-800 */
    color: #d1d5db !important; /* gray-300 */
    border-color: #4b5563 !important; /* gray-600 */
}
.dark #weekBar button:hover {
    background-color: #374151 !important; /* gray-700 */
    color: #f9fafb !important; /* gray-50 */
}
.dark #weekBar button.bg-indigo-600, /* The selected button */
.dark #weekBar button.bg-pink-600 { /* The selected weekend button */
    background-color: #4f46e5 !important;
    color: #ffffff !important;
    border-color: #4f46e5 !important;
}
.dark #weekBar button.bg-pink-600 {
    background-color: #db2777 !important;
    border-color: #db2777 !important;
}


/* 2. Hour Header (the 01, 02, 03 row) */
.dark #hourHeader {
    background-color: #111827 !important; /* gray-900 */
    border-color: #374151 !important; /* gray-700 */
}
.dark #hourHeader .header-hour {
    color: #d1d5db !important; /* gray-300 */
}
/* Individual hour cells in header */
.dark #hourHeader > div {
     border-color: #374151 !important; /* gray-700 */
}


/* 3. All City Rows - Left Panel */
.dark .row .row-left {
    background-color: #111827 !important; /* gray-900 */
    border-color: #374151 !important; /* gray-700 */
}
.dark .row-local .row-left {
    background-color: #1e293b !important; /* slate-800, a subtle highlight */
    border-left-color: #6366f1 !important; /* indigo-500 */
}

/* 4. All City Rows - Icons and Text in Left Panel */
.dark .row .row-left .title,
.dark .row .row-left .row-date-compact {
    color: #f9fafb !important; /* gray-50 */
}
.dark .row .row-left .row-clock {
    color: #7dd3fc !important; /* sky-300 */
}
.dark .row .row-left div[class*="text-gray-500"] {
    color: #9ca3af !important; /* gray-400 */
}
.dark .row .row-left .fa-house {
    color: #a5b4fc !important; /* indigo-300 */
}
.dark .row .row-left .row-controls button {
    background-color: #374151 !important; /* gray-700 */
    color: #d1d5db !important; /* gray-300 */
}
.dark .row .row-left .row-controls button:hover {
    background-color: #4b5563 !important; /* gray-600 */
}

/*
==============================================
=== Final Polish Patch                     ===
==============================================
*/

/* 1. Fix Topbar Button Layout Shift */
/* Add a transparent border in light-mode to match dark-mode's width */
.topbar-ctl {
    border: 1px solid transparent;
}

/* 2. Fix Segmented Control Active State in Dark Mode */
/* Style for the INACTIVE button */
.dark .segmented > button:not(.bg-indigo-600) {
    background-color: transparent !important;
    color: var(--text-secondary) !important;
}
/* Style for the ACTIVE button (which has the bg-indigo-600 class from JS) */
.dark .segmented > button.bg-indigo-600 {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: var(--text-primary) !important;
}

/*
==============================================
=== Selection Toolbar Dark Mode Patch      ===
==============================================
*/

/* 1. Main selection toolbar background */
.dark #selectControls {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: var(--glass-card-border) !important;
}

/* 2. Text label on the left */
.dark #selectControls .text-gray-700 {
    color: var(--text-secondary) !important;
}

/* 3. Buttons on the right */
.dark #selectControls .btn {
    background-color: #4f46e5 !important; /* Keep brand color */
    color: white !important;
    opacity: 0.9;
    border: none !important;
}

.dark #selectControls .btn:hover {
    opacity: 1.0;
}

/* Special case for the 'Cancel' button */
.dark #selectControls #btnSelCancel {
    background-color: #be123c !important; /* A darker pink/red */
}