* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== THEME VARIABLES ===== */
:root {
    /* Light Theme (default) - Crusader Stone & Steel */
    --bg-primary: #e8e0d5;
    --bg-secondary: #f5f0e8;
    --bg-tertiary: #d4c8b8;
    --text-primary: #1a1410;
    --text-secondary: #3d3428;
    --text-muted: #6d6050;
    --border-color: #8b7355;
    --shadow-color: rgba(61, 52, 40, 0.3);
    --card-bg: #f5f0e8;
    --input-bg: #ffffff;
    --input-border: #8b7355;
    --success-color: #2d5016;
    --danger-color: #8b1a1a;
    --warning-color: #b8860b;
    --info-color: #4a5568;
    --gradient-start: #2d3748;
    --gradient-end: #8b7355;
}

[data-theme="dark"] {
    /* Dark Theme - Crusader Knight: Midnight Steel & Blood Red */
    --bg-primary: #0a0a0f;
    --bg-secondary: #14141f;
    --bg-tertiary: #1f1f2e;
    --text-primary: #d4c8b8;
    --text-secondary: #a39888;
    --text-muted: #736858;
    --border-color: #3d3428;
    --shadow-color: rgba(139, 0, 0, 0.4);
    --card-bg: #14141f;
    --input-bg: #1f1f2e;
    --input-border: #3d3428;
    --success-color: #4a5c2d;
    --danger-color: #8b0000;
    --warning-color: #d4a005;
    --info-color: #6d7a8e;
    --gradient-start: #1f1f2e;
    --gradient-end: #4a1616;
}

body {
    font-family: 'Cinzel', 'EB Garamond', 'Crimson Text', 'Libre Baskerville', Georgia, serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ===== BACKGROUND VIDEO ===== */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.video-background video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

[data-theme="dark"] .video-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Ensure content appears above video */
.navbar,
main,
.footer {
    position: relative;
    z-index: 2;
}

main {
    flex: 1;
    padding: 3rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

.theme-toggle .icon-sun {
    display: inline;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: inline;
}

/* ===== BACKGROUND VIDEO TOGGLE (Admin Only) ===== */
.background-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.background-toggle .icon-video-on,
.background-toggle .icon-video-off {
    display: inline;
}

/* ===== COUNTER THEME TOGGLE ===== */
.counter-theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.counter-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* ===== COUNTER THEMES ===== */

/* Ancient Theme (Default) - Religious/Mystical */
.counter-theme-ancient .rewiring-clock {
    background: linear-gradient(135deg, #3d2817 0%, #2a1810 100%);
    border: 3px solid #6d5310;
    box-shadow:
        inset 0 2px 8px rgba(255, 215, 0, 0.1),
        0 8px 30px rgba(0, 0, 0, 0.5),
        0 0 0 2px #8b6914,
        0 0 20px rgba(255, 215, 0, 0.2);
}

.counter-theme-ancient .watch-face {
    background: linear-gradient(145deg, #2a1810, #3d2817);
    border-color: #8b6914 #5a3d0a #5a3d0a #8b6914;
}

.counter-theme-ancient .days-display {
    color: #d4af37;
    text-shadow:
        0 0 25px rgba(212, 175, 55, 0.6),
        0 0 50px rgba(212, 175, 55, 0.3),
        0 3px 8px rgba(0, 0, 0, 0.7);
}

.counter-theme-ancient .time-display {
    color: #8b6914;
}

.counter-theme-ancient .watch-ring {
    border-color: #8b6914;
}

.counter-theme-ancient .watch-marker {
    background: linear-gradient(to bottom, #d4af37, #8b6914);
}

/* Modern Theme - Tech/Professional */
.counter-theme-modern .rewiring-clock {
    background: linear-gradient(135deg, #0f1419 0%, #1a1f3a 100%);
    border: 2px solid #00d4ff;
    box-shadow:
        0 0 40px rgba(0, 212, 255, 0.3),
        inset 0 2px 8px rgba(0, 212, 255, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.6);
}

.counter-theme-modern .watch-face {
    background: linear-gradient(145deg, #0a0d1a, #1a1f3a);
    border: 6px solid #00d4ff;
    box-shadow:
        inset 0 0 30px rgba(0, 212, 255, 0.15),
        0 0 50px rgba(0, 212, 255, 0.3);
}

.counter-theme-modern .days-display {
    color: #00d4ff;
    font-weight: 900;
    text-shadow:
        0 0 30px rgba(0, 212, 255, 0.8),
        0 0 60px rgba(0, 212, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

.counter-theme-modern .time-display {
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.counter-theme-modern .watch-ring {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.counter-theme-modern .watch-marker {
    background: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}

.counter-theme-modern .rewiring-clock-title {
    color: #00d4ff;
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

.counter-theme-modern .rewiring-clock-subtitle {
    color: #00d4ff;
    opacity: 0.8;
}

/* Neon Theme - Cyberpunk */
.counter-theme-neon .rewiring-clock {
    background: linear-gradient(135deg, #0a0e27 0%, #1a0a2e 100%);
    border: 3px solid #ff006e;
    box-shadow:
        0 0 40px rgba(255, 0, 110, 0.6),
        inset 0 2px 8px rgba(255, 0, 110, 0.1),
        0 8px 32px rgba(255, 0, 110, 0.3);
}

.counter-theme-neon .watch-face {
    background: linear-gradient(145deg, #0a0e27, #1a0a2e);
    border: 4px solid #ff006e;
    box-shadow:
        inset 0 0 30px rgba(255, 0, 110, 0.2),
        0 0 50px rgba(255, 0, 110, 0.5);
}

.counter-theme-neon .days-display {
    color: #ff006e;
    text-shadow:
        0 0 40px rgba(255, 0, 110, 1),
        0 0 80px rgba(255, 0, 110, 0.6),
        0 0 120px rgba(255, 0, 110, 0.3);
}

.counter-theme-neon .time-display {
    color: #00ff00;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

.counter-theme-neon .watch-ring {
    border-color: #ff006e;
    box-shadow: 0 0 30px rgba(255, 0, 110, 0.8);
}

.counter-theme-neon .watch-marker {
    background: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 1);
}

.counter-theme-neon .rewiring-clock-title {
    color: #ff006e;
    text-shadow: 0 0 20px rgba(255, 0, 110, 0.8);
}

.counter-theme-neon .rewiring-clock-subtitle {
    color: #00ff00;
}

/* Minimal Theme - Clean/Professional */
.counter-theme-minimal .rewiring-clock {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: 2px solid #000000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.counter-theme-minimal .watch-face {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border: 3px solid #000000;
    box-shadow:
        inset 0 0 15px rgba(0, 0, 0, 0.08),
        0 6px 20px rgba(0, 0, 0, 0.15);
}

.counter-theme-minimal .days-display {
    color: #000000;
    text-shadow: none;
    font-weight: 900;
}

.counter-theme-minimal .time-display {
    color: #000000;
    text-shadow: none;
}

.counter-theme-minimal .watch-ring {
    border-color: #000000;
    opacity: 0.6;
}

.counter-theme-minimal .watch-marker {
    background: #000000;
}

.counter-theme-minimal .rewiring-clock-title {
    color: #000000;
    text-shadow: none;
}

.counter-theme-minimal .rewiring-clock-subtitle {
    color: #333333;
}

/* Ocean Theme - Calm/Serene */
.counter-theme-ocean .rewiring-clock {
    background: linear-gradient(135deg, #0a1e2e 0%, #16213e 100%);
    border: 3px solid #0ab0d8;
    box-shadow:
        0 0 50px rgba(10, 176, 216, 0.4),
        inset 0 2px 8px rgba(10, 176, 216, 0.1),
        0 8px 32px rgba(10, 176, 216, 0.2);
}

.counter-theme-ocean .watch-face {
    background: linear-gradient(145deg, #0a1e2e, #16213e);
    border: 6px solid #0ab0d8;
    box-shadow:
        inset 0 0 30px rgba(10, 176, 216, 0.15),
        0 0 60px rgba(10, 176, 216, 0.3);
}

.counter-theme-ocean .days-display {
    color: #00d4ff;
    text-shadow:
        0 0 30px rgba(0, 212, 255, 0.7),
        0 0 60px rgba(10, 176, 216, 0.4);
}

.counter-theme-ocean .time-display {
    color: #0ab0d8;
    text-shadow: 0 0 20px rgba(10, 176, 216, 0.6);
}

.counter-theme-ocean .watch-ring {
    border-color: #0ab0d8;
    box-shadow: 0 0 25px rgba(10, 176, 216, 0.6);
}

.counter-theme-ocean .watch-marker {
    background: #00d4ff;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.8);
}

.counter-theme-ocean .rewiring-clock-title {
    color: #00d4ff;
    text-shadow: 0 0 15px rgba(10, 176, 216, 0.7);
}

.counter-theme-ocean .rewiring-clock-subtitle {
    color: #0ab0d8;
}

/* Forest Theme - Natural/Growth */
.counter-theme-forest .rewiring-clock {
    background: linear-gradient(135deg, #1b3a1b 0%, #2d5016 100%);
    border: 3px solid #4ade80;
    box-shadow:
        0 0 40px rgba(74, 222, 128, 0.3),
        inset 0 2px 8px rgba(74, 222, 128, 0.08),
        0 8px 32px rgba(74, 222, 128, 0.15);
}

.counter-theme-forest .watch-face {
    background: linear-gradient(145deg, #1b3a1b, #2d5016);
    border: 6px solid #4ade80;
    box-shadow:
        inset 0 0 30px rgba(74, 222, 128, 0.12),
        0 0 50px rgba(74, 222, 128, 0.25);
}

.counter-theme-forest .days-display {
    color: #4ade80;
    text-shadow:
        0 0 25px rgba(74, 222, 128, 0.6),
        0 0 50px rgba(74, 222, 128, 0.3);
}

.counter-theme-forest .time-display {
    color: #86efac;
    text-shadow: 0 0 15px rgba(134, 239, 172, 0.5);
}

.counter-theme-forest .watch-ring {
    border-color: #4ade80;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.counter-theme-forest .watch-marker {
    background: #86efac;
    box-shadow: 0 0 10px rgba(134, 239, 172, 0.8);
}

.counter-theme-forest .rewiring-clock-title {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
}

.counter-theme-forest .rewiring-clock-subtitle {
    color: #86efac;
}

/* Fire Theme - Intense/Powerful */
.counter-theme-fire .rewiring-clock {
    background: linear-gradient(135deg, #2d1810 0%, #3d1f0a 100%);
    border: 3px solid #ff6b35;
    box-shadow:
        0 0 50px rgba(255, 107, 53, 0.5),
        inset 0 2px 8px rgba(255, 107, 53, 0.1),
        0 8px 32px rgba(255, 107, 53, 0.25);
}

.counter-theme-fire .watch-face {
    background: linear-gradient(145deg, #2d1810, #3d1f0a);
    border: 6px solid #ff6b35;
    box-shadow:
        inset 0 0 30px rgba(255, 107, 53, 0.15),
        0 0 60px rgba(255, 107, 53, 0.4);
}

.counter-theme-fire .days-display {
    color: #ffa500;
    text-shadow:
        0 0 30px rgba(255, 165, 0, 0.8),
        0 0 60px rgba(255, 107, 53, 0.5);
}

.counter-theme-fire .time-display {
    color: #ff6b35;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.7);
}

.counter-theme-fire .watch-ring {
    border-color: #ff6b35;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.7);
}

.counter-theme-fire .watch-marker {
    background: #ffa500;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.9);
}

.counter-theme-fire .rewiring-clock-title {
    color: #ff6b35;
    text-shadow: 0 0 15px rgba(255, 107, 53, 0.8);
}

.counter-theme-fire .rewiring-clock-subtitle {
    color: #ffa500;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, rgba(31, 31, 46, 0.75) 0%, rgba(74, 22, 22, 0.75) 100%);
    color: #d4c8b8;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(139, 0, 0, 0.4);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(61, 52, 40, 0.6);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: #d4c8b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(139, 0, 0, 0.2));
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.4), inset 0 0 10px rgba(212, 200, 184, 0.1);
    letter-spacing: 0.5px;
}

.logo a:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(139, 0, 0, 0.6), inset 0 0 15px rgba(212, 200, 184, 0.15);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(139, 0, 0, 0.3));
}

.nav-menu {
    display: flex;
}

.nav-menu ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
}

.nav-menu li {
    position: relative;
}

.nav-menu a,
.logout-link {
    color: #d4c8b8;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s, opacity 0.3s;
    display: block;
}

.nav-menu a:hover,
.logout-link:hover {
    background-color: rgba(212, 175, 55, 0.2);
    opacity: 0.95;
}

.logout-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    padding: 0.5rem 1rem;
    color: #d4c8b8;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 0.4rem;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* ===== HERO SECTION ===== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(31, 31, 46, 0.75) 0%, rgba(74, 22, 22, 0.75) 100%);
    color: #d4c8b8;
    border-radius: 10px;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(139, 0, 0, 0.4);
    border: 2px solid rgba(61, 52, 40, 0.6);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(139, 0, 0, 0.6);
    color: #d4c8b8;
    letter-spacing: 0.05em;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    color: #a39888;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s, border 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    outline: none;
}

.btn:focus {
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(31, 31, 46, 0.75) 0%, rgba(74, 22, 22, 0.75) 100%);
    color: #d4c8b8;
    border: 2px solid rgba(61, 52, 40, 0.6);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #fff !important;
    background-image: none !important;
    color: #667eea;
    border: 2px solid #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(31, 31, 46, 0.75) 0%, rgba(74, 22, 22, 0.75) 100%);
    color: #d4c8b8;
    border: 2px solid rgba(61, 52, 40, 0.6);
}

.btn-secondary:hover {
    background: white !important;
    background-image: none !important;
    color: #667eea;
    transform: translateY(-2px);
    border: 2px solid white;
}

/* ===== FEATURES SECTION ===== */
.features {
    margin: 4rem 0;
}

.features h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(139, 0, 0, 0.4);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
    backdrop-filter: blur(10px);
    background: rgba(31, 31, 46, 0.75);
    border: 2px solid rgba(61, 52, 40, 0.6);
}

[data-theme="dark"] .feature-card {
    background: rgba(31, 31, 46, 0.75);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(139, 0, 0, 0.6);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #d4c8b8;
}

.feature-card p {
    color: #a39888;
    line-height: 1.6;
}

/* ===== FOOTER ===== */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

[data-theme="dark"] .footer {
    background-color: #0a0a1a;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {

    /* Navbar Mobile */
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
    }

    .nav-menu.active {
        max-height: 500px;
    }

    .nav-menu ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a,
    .logout-link {
        display: block;
        width: 100%;
        padding: 1rem;
        border-radius: 0;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-container {
        padding: 0 15px;
    }

    /* Hero Mobile */
    .hero {
        padding: 2rem 1rem;
        border-radius: 5px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    /* Features Mobile */
    .features h2 {
        font-size: 2rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Footer Mobile */
    .footer-links {
        gap: 1rem;
    }

    main {
        padding: 1.5rem 0;
    }

    /* Dashboard Mobile */
    .dashboard-container {
        padding: 0 15px;
        margin: 1rem auto;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .stats-card {
        padding: 1.25rem 1rem;
    }

    .stats-card h2 {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .stats-value {
        font-size: 2rem;
    }

    .action-buttons {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .action-btn {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    /* Quick Check-in Mobile */
    .quick-checkin {
        padding: 1.25rem !important;
        margin-bottom: 1.5rem !important;
    }

    .quick-checkin h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .quick-checkin-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .quick-checkin-buttons button,
    .quick-checkin-buttons a {
        width: 100%;
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem !important;
        text-align: center;
    }

    /* Progress Table Mobile */
    .progress-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .progress-table th,
    .progress-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }

    /* Entry Form Mobile */
    .entry-form,
    .entries-container {
        padding: 0 15px;
    }

    .entry-form .form-group {
        margin-bottom: 1.25rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .radio-option {
        padding: 1rem;
    }

    .form-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-buttons button,
    .form-buttons .btn {
        width: 100%;
    }

    .date-navigation {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .date-nav-btn {
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Calendar Mobile */
    .calendar-grid {
        gap: 2px;
    }

    .calendar-day {
        padding: 0.4rem;
        font-size: 0.8rem;
        min-height: 45px;
    }

    .calendar-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .calendar-nav {
        width: 100%;
        justify-content: space-between;
    }

    /* Admin/Users Table Mobile */
    .admin-table,
    .users-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td,
    .users-table th,
    .users-table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .logo a {
        font-size: 1.2rem;
    }

    .nav-menu a,
    .logout-link {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    .features h2 {
        font-size: 1.5rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .feature-card h3 {
        font-size: 1.2rem;
    }

    /* Extra small screen adjustments */
    .dashboard-header h1 {
        font-size: 1.25rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stats-card {
        padding: 1rem 0.75rem;
    }

    .stats-card h2 {
        font-size: 0.65rem;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-card p {
        font-size: 0.75rem;
    }

    .quick-checkin h2 {
        font-size: 1rem !important;
    }

    .quick-checkin-buttons button,
    .quick-checkin-buttons a {
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .calendar-day {
        padding: 0.25rem;
        font-size: 0.7rem;
        min-height: 35px;
    }

    .calendar-day .day-number {
        font-size: 0.75rem;
    }

    /* Hide some table columns on very small screens */
    .hide-mobile {
        display: none;
    }
}

/* ===== TOUCH-FRIENDLY IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn,
    .action-btn,
    button,
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-menu a,
    .logout-link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .feature-card:hover,
    .action-btn:hover,
    .btn:hover {
        transform: none;
    }

    /* Active state for touch feedback */
    .btn:active,
    .action-btn:active,
    button:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* ===== SAFE AREA FOR NOTCHED DEVICES ===== */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .dashboard-container,
    .entries-container,
    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* ===== REWIRING DAY COUNTER - CIRCULAR WATCH ===== */
.rewiring-clock {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px var(--shadow-color);
    margin-bottom: 2rem;
    text-align: center;
    transition: background 0.3s ease;
}

.rewiring-clock-title {
    color: var(--danger-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.rewiring-clock-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Watch Container */
.watch-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.watch-inactive {
    opacity: 0.5;
}

/* Circular Watch Face */
.watch-face {
    position: relative;
    width: 350px;
    height: 350px;
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-secondary));
    border-radius: 50%;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.3),
        0 10px 40px var(--shadow-color),
        0 0 0 8px var(--border-color),
        0 0 0 12px var(--bg-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

[data-theme="dark"] .watch-face {
    box-shadow:
        inset 0 0 40px rgba(0, 0, 0, 0.6),
        0 10px 50px rgba(0, 0, 0, 0.5),
        0 0 0 8px var(--border-color),
        0 0 0 12px var(--bg-secondary);
}

/* Watch Ring (Outer decorative ring) */
.watch-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--danger-color);
    opacity: 0.3;
    animation: pulse-ring 3s infinite;
}

@keyframes pulse-ring {

    0%,
    100% {
        transform: scale(0.95);
        opacity: 0.3;
    }

    50% {
        transform: scale(0.98);
        opacity: 0.5;
    }
}

/* Center Display - Days and Time */
.watch-center {
    text-align: center;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    width: 100%;
    min-height: 200px;
}

/* Days Section */
.days-section {
    margin-bottom: 0.25rem;
}

.days-display {
    font-family: 'Cinzel', 'Crimson Text', 'EB Garamond', Georgia, serif;
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--danger-color);
    line-height: 1;
    text-shadow:
        0 0 20px rgba(139, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.05em;
    filter: drop-shadow(0 0 10px rgba(139, 0, 0, 0.3));
    min-width: 3ch;
    text-align: center;
}

[data-theme="dark"] .days-display {
    text-shadow:
        0 0 30px rgba(139, 0, 0, 0.8),
        0 0 15px rgba(139, 0, 0, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.days-label {
    font-family: 'Cinzel', 'Crimson Text', serif;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-top: 0.15rem;
    text-transform: uppercase;
}

/* Time Display (HH:MM:SS format) */
.time-display {
    font-family: 'Cinzel', 'Crimson Text', serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--danger-color);
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px rgba(233, 69, 96, 0.4);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.2em;
    flex-wrap: wrap;
}

[data-theme="dark"] .time-display {
    text-shadow:
        0 0 20px rgba(233, 69, 96, 0.7),
        0 0 10px rgba(233, 69, 96, 0.5);
}

.time-group {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2em;
}

.time-value {
    display: inline-block;
    min-width: 2ch;
    width: 2ch;
    text-align: center;
    font-size: 1em;
}

.time-unit {
    font-size: 0.5em;
    font-weight: 600;
    color: var(--text-secondary);
    text-shadow: none;
    letter-spacing: 0.05em;
}

.time-separator {
    display: inline-block;
    margin: 0 0.1em;
    opacity: 0.6;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    49% {
        opacity: 0.6;
    }

    50%,
    100% {
        opacity: 0.2;
    }
}

/* Watch Markers (12, 3, 6, 9 positions) */
.watch-marker {
    position: absolute;
    width: 3px;
    height: 12px;
    background: var(--info-color);
    opacity: 0.6;
}

.watch-marker-12 {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.watch-marker-3 {
    right: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

.watch-marker-6 {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.watch-marker-9 {
    left: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

/* Responsive Design for Watch */
@media (max-width: 768px) {
    .watch-face {
        width: 300px;
        height: 300px;
    }

    .days-display {
        font-size: 3.8rem;
    }

    .days-label {
        font-size: 0.75rem;
    }

    .time-display {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .watch-face {
        width: 260px;
        height: 260px;
    }

    .days-display {
        font-size: 3.2rem;
    }

    .days-label {
        font-size: 0.7rem;
    }

    .time-display {
        font-size: 1.1rem;
    }

    .rewiring-clock {
        padding: 1.5rem 1rem;
    }

    .rewiring-clock-title {
        font-size: 1.2rem;
    }

    .rewiring-clock-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .watch-center {
        gap: 0.5rem;
        padding: 0.75rem;
    }
}

@media (max-width: 380px) {
    .watch-face {
        width: 230px;
        height: 230px;
    }

    .days-display {
        font-size: 2.8rem;
    }

    .days-label {
        font-size: 0.65rem;
    }

    .time-display {
        font-size: 1rem;
        gap: 0.15em;
    }

    .time-unit {
        font-size: 0.45em;
    }

    .watch-center {
        padding: 0.5rem;
    }
}

/* Animation for active watch */
@keyframes digital-flicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.95;
    }
}

.watch-container:not(.watch-inactive) .time-value,
.watch-container:not(.watch-inactive) .days-display {
    animation: digital-flicker 2s infinite;
}