/* ============================================
   CSS CUSTOM PROPERTIES - 4 THEMES
   ============================================ */

:root {
    /* Default: Ocean theme */
    --bg-primary: #0a1628;
    --bg-secondary: #1a2744;
    --accent-1: #4facfe;
    --accent-2: #00f2fe;
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --led-on: #4facfe;
    --led-off: rgba(255, 255, 255, 0.1);
    --ring-bg: rgba(255, 255, 255, 0.06);
    --card-radius: 24px;
}

[data-theme="ocean"] {
    --bg-primary: #0a1628;
    --bg-secondary: #1a2744;
    --accent-1: #4facfe;
    --accent-2: #00f2fe;
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --glass-bg: rgba(79, 172, 254, 0.08);
    --glass-border: rgba(79, 172, 254, 0.2);
    --glass-shadow: rgba(79, 172, 254, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --led-on: #4facfe;
    --led-off: rgba(79, 172, 254, 0.15);
    --ring-bg: rgba(79, 172, 254, 0.1);
}

[data-theme="aurora"] {
    --bg-primary: #0a1a15;
    --bg-secondary: #132e22;
    --accent-1: #43e97b;
    --accent-2: #38f9d7;
    --accent-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --glass-bg: rgba(67, 233, 123, 0.08);
    --glass-border: rgba(67, 233, 123, 0.2);
    --glass-shadow: rgba(67, 233, 123, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --led-on: #43e97b;
    --led-off: rgba(67, 233, 123, 0.15);
    --ring-bg: rgba(67, 233, 123, 0.1);
}

[data-theme="sunset"] {
    --bg-primary: #1a0a1e;
    --bg-secondary: #2d1438;
    --accent-1: #f093fb;
    --accent-2: #f5576c;
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --glass-bg: rgba(245, 87, 108, 0.08);
    --glass-border: rgba(245, 87, 108, 0.2);
    --glass-shadow: rgba(245, 87, 108, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --led-on: #f5576c;
    --led-off: rgba(245, 87, 108, 0.15);
    --ring-bg: rgba(245, 87, 108, 0.1);
}

[data-theme="midnight"] {
    --bg-primary: #0d0d1a;
    --bg-secondary: #1a1a3e;
    --accent-1: #fbbf24;
    --accent-2: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --glass-bg: rgba(251, 191, 36, 0.08);
    --glass-border: rgba(251, 191, 36, 0.2);
    --glass-shadow: rgba(251, 191, 36, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --led-on: #fbbf24;
    --led-off: rgba(251, 191, 36, 0.15);
    --ring-bg: rgba(251, 191, 36, 0.1);
}

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.6s ease;
}

/* ============================================
   BACKGROUND ANIMATION
   ============================================ */

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-animation::before,
.bg-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: floatBg 20s ease-in-out infinite;
}

.bg-animation::before {
    width: 300px;
    height: 300px;
    background: var(--accent-1);
    top: -100px;
    right: -50px;
    animation-delay: 0s;
}

.bg-animation::after {
    width: 250px;
    height: 250px;
    background: var(--accent-2);
    bottom: -80px;
    left: -60px;
    animation-delay: -10s;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, 40px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, -30px) scale(1.05); }
}

/* ============================================
   THEME SWITCHER
   ============================================ */

.theme-switcher {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 100;
    padding: 6px;
    border-radius: 50px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.theme-btn.active {
    border-color: var(--accent-1);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px var(--glass-shadow);
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 70px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   GLASS CARD BASE
   ============================================ */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow:
        0 8px 32px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* ============================================
   DATE CARD
   ============================================ */

.date-card {
    text-align: center;
    padding: 18px 24px;
}

.date-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.day-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-1);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dot-separator {
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
}

.full-date {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ============================================
   CLOCK CARD
   ============================================ */

.clock-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 32px 24px;
}

.clock-display {
    text-align: center;
}

.time-main {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.seconds-bar {
    width: 100%;
    max-width: 280px;
    height: 4px;
    margin: 12px auto 0;
    border-radius: 2px;
    background: var(--ring-bg);
    overflow: hidden;
}

.seconds-bar::after {
    content: '';
    display: block;
    width: var(--seconds-progress, 0%);
    height: 100%;
    border-radius: 2px;
    background: var(--accent-gradient);
    transition: width 0.3s linear;
}

/* Binary Clock */
.binary-clock-section {
    text-align: center;
    width: 100%;
}

.binary-label {
    font-size: 0.7rem;
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 600;
}

.binary-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: flex-end;
}

.binary-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.binary-column-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.led {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--led-off);
    transition: all 0.3s ease;
    position: relative;
}

.led.on {
    background: var(--led-on);
    box-shadow:
        0 0 12px var(--led-on),
        0 0 24px rgba(79, 172, 254, 0.3);
}

.binary-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
}

.binary-legend span {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.binary-legend .led {
    width: 12px;
    height: 12px;
}

/* Clock Rings */
.clock-ring-container {
    position: relative;
    width: 180px;
    height: 180px;
}

.clock-ring {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.ring-bg {
    stroke: var(--ring-bg);
}

.ring-progress {
    stroke: url(#accentGradient);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

/* ============================================
   WEATHER CARD
   ============================================ */

.weather-card {
    padding: 24px;
}

.weather-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.weather-icon-main {
    font-size: 3rem;
    line-height: 1;
}

.weather-temp-info {
    display: flex;
    flex-direction: column;
}

.weather-temp {
    font-size: 2.8rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.weather-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: capitalize;
}

.weather-details {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.detail-icon {
    font-size: 1.3rem;
}

.detail-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.forecast-section {
    margin-bottom: 16px;
}

.forecast-title {
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.forecast-day {
    text-align: center;
    padding: 12px 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
}

.forecast-day:hover {
    background: rgba(255, 255, 255, 0.08);
}

.forecast-day-name {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 500;
}

.forecast-day-icon {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.forecast-day-temp {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.forecast-high {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.forecast-low {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.location-badge {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 8px;
}

/* ============================================
   NAME DAY CARD
   ============================================ */

.name-day-card {
    text-align: center;
    padding: 24px;
}

.name-day-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.name-day-icon {
    font-size: 1.2rem;
}

.name-day-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.name-day-names {
    font-size: 1.4rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.5;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-1);
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

.glass-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.glass-card:nth-child(1) { animation-delay: 0.1s; }
.glass-card:nth-child(2) { animation-delay: 0.2s; }
.glass-card:nth-child(3) { animation-delay: 0.3s; }
.glass-card:nth-child(4) { animation-delay: 0.4s; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 360px) {
    .time-main {
        font-size: 2.6rem;
    }

    .container {
        padding: 65px 12px 24px;
        gap: 12px;
    }

    .glass-card {
        padding: 20px 16px;
        border-radius: 20px;
    }

    .forecast-grid {
        gap: 4px;
    }

    .led {
        width: 18px;
        height: 18px;
    }

    .binary-grid {
        gap: 14px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 520px;
        padding-top: 80px;
    }

    .time-main {
        font-size: 3.8rem;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}
