/* Base styles */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: white;
    transition: background-color 0.3s, color 0.3s;
}

/* Navbar container */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #1f1f1f;
    border-radius: 8px;
    margin: 15px;
    height: auto;
    flex-wrap: wrap;
    position: relative;
}

/* Left and right groups */
.navbar-left,
.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Links & icons */
.navbar span,
.navbar i,
.navbar a {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    font-weight: bold;
}

.navbar a {
    text-decoration: none;
    color: inherit;
    font-size: 16px;
    transition: opacity 0.3s ease;
}

.navbar a:hover {
    opacity: 0.8;
}

.navbar-right a {
    color: white;
}

/* Button styles for Run Audit */
.navbar .btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar .btn-primary {
    background-color: #007bff;
    color: white;
}

.navbar .btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* Theme toggle */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    background: #444;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: left 0.3s ease;
}

.light-theme {
    background-color: white;
    color: black;
}

.light-theme .navbar {
    background-color: #f0f0f0;
}

.light-theme .navbar-right a {
    color: black;
}

.light-theme .toggle-switch {
    background: #ccc;
}

.light-theme .toggle-knob {
    background: black;
}

.toggle-active .toggle-knob {
    left: 22px;
}

/* Small circle icons */
.icons {
    background: black;
    color: white;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.light-theme .icons {
    background: #333;
    color: white;
}

/* Emoji theme switch container */
.emoji {
    display: flex;
    align-items: center;
    border: 2px solid rgb(17, 48, 223);
    margin: 2px;
    padding: 2px 6px;
    border-radius: 5px;
    gap: 6px;
    transition: border-color 0.3s ease;
}

/* Date span styling */
#current-date {
    font-size: inherit;
    white-space: nowrap;
}

/* Dropdown */
.files-container {
    position: relative;
    cursor: pointer;
}

.dropdown {
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    background: #2a2a2a;
    border-radius: 5px;
    min-width: 150px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.dropdown a {
    display: block;
    padding: 8px 12px;
    color: white;
    text-decoration: none;
}

.dropdown a:hover {
    background: #444;
}

.light-theme .dropdown {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.light-theme .dropdown a {
    color: black;
}

.light-theme .dropdown a:hover {
    background: #e9ecef;
}

/* ---------------- 7 DEVICE RESPONSIVE BREAKPOINTS ---------------- */

/* 1. Extra Small Devices - Mobile Portrait (320px - 575px) */
@media (max-width: 575.98px) {
    .navbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 12px;
        margin: 8px;
        gap: 12px;
    }

    .navbar-left {
        justify-content: center;
        margin-bottom: 5px;
    }

    .navbar-left span {
        font-size: 18px;
    }

    .navbar-left i {
        font-size: 20px;
    }

    .navbar-right {
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Make buttons and links more mobile-friendly */
    .navbar a,
    .navbar .btn {
        font-size: 0 !important; /* Hide text */
        padding: 8px 10px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.1);
        min-width: 36px;
        min-height: 36px;
        justify-content: center;
        align-items: center;
        display: flex !important;
    }

    /* Show only icons in navigation */
    .navbar-right a i,
    .navbar-right .btn i {
        font-size: 16px !important;
        margin: 0;
        display: block;
    }

    /* Special handling for Run Audit button */
    .navbar .btn-primary {
        background-color: #007bff;
        position: relative;
    }

    .navbar .btn-primary::before {
        content: "🔍";
        font-size: 16px;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    /* Hide complex elements on mobile */
    .icons,
    #current-date {
        display: none !important;
    }

    .emoji {
        padding: 4px 6px;
        gap: 4px;
        border-width: 1px;
    }

    .toggle-switch {
        width: 32px;
        height: 16px;
    }

    .toggle-knob {
        width: 12px;
        height: 12px;
        top: 2px;
    }

    .toggle-active .toggle-knob {
        left: 18px;
    }
}

/* 2. Small Devices - Mobile Landscape & Small Tablets (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .navbar {
        padding: 8px 15px;
        margin: 12px;
        flex-wrap: nowrap;
    }

    .navbar-left span {
        font-size: 17px;
    }

    .navbar-right {
        gap: 10px;
    }

    /* Icon-only navigation for small screens */
    .navbar a,
    .navbar .btn {
        font-size: 0 !important;
        padding: 6px 8px;
        border-radius: 5px;
        background: rgba(255, 255, 255, 0.05);
        min-width: 32px;
        justify-content: center;
        display: flex !important;
    }

    .navbar-right a i,
    .navbar-right .btn i {
        font-size: 14px !important;
        margin: 0;
        display: block;
    }

    /* Run Audit button icon */
    .navbar .btn-primary::before {
        content: "🔍";
        font-size: 14px;
    }

    /* Show date but keep it compact */
    #current-date {
        display: inline;
        font-size: 12px;
    }

    .icons {
        width: 22px;
        height: 22px;
        font-size: 12px;
    }

    .emoji {
        padding: 2px 5px;
    }

    .toggle-switch {
        width: 36px;
        height: 18px;
    }

    .toggle-knob {
        width: 14px;
        height: 14px;
    }

    .toggle-active .toggle-knob {
        left: 20px;
    }
}

/* 3. Medium Devices - Tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar {
        padding: 10px 18px;
        margin: 15px;
    }

    .navbar-left span {
        font-size: 18px;
    }

    .navbar-right {
        gap: 12px;
    }

    .navbar a {
        font-size: 15px;
    }

    .navbar .btn {
        font-size: 14px;
        padding: 6px 12px;
    }

    #current-date {
        font-size: 14px;
    }

    .icons {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
}

/* 4. Large Devices - Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar {
        padding: 10px 20px;
        margin: 15px;
    }

    .navbar-left span {
        font-size: 19px;
    }

    .navbar-right {
        gap: 15px;
    }

    .navbar a {
        font-size: 16px;
    }

    .navbar .btn {
        font-size: 15px;
        padding: 7px 14px;
    }

    #current-date {
        font-size: 15px;
    }

    .icons {
        width: 25px;
        height: 25px;
        font-size: 14px;
    }
}

/* 5. Extra Large Devices - Large Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .navbar {
        padding: 12px 25px;
        margin: 18px;
    }

    .navbar-left span {
        font-size: 20px;
    }

    .navbar-right {
        gap: 18px;
    }

    .navbar a {
        font-size: 17px;
    }

    .navbar .btn {
        font-size: 16px;
        padding: 8px 16px;
    }

    #current-date {
        font-size: 16px;
    }

    .icons {
        width: 26px;
        height: 26px;
        font-size: 15px;
    }

    .emoji {
        padding: 3px 7px;
    }
}

/* 6. Extra Extra Large Devices - Very Large Desktop (1400px - 1919px) */
@media (min-width: 1400px) and (max-width: 1919.98px) {
    .navbar {
        padding: 14px 30px;
        margin: 20px;
    }

    .navbar-left span {
        font-size: 21px;
    }

    .navbar-right {
        gap: 20px;
    }

    .navbar a {
        font-size: 18px;
    }

    .navbar .btn {
        font-size: 17px;
        padding: 9px 18px;
    }

    #current-date {
        font-size: 17px;
    }

    .icons {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .emoji {
        padding: 4px 8px;
        gap: 7px;
    }

    .toggle-switch {
        width: 44px;
        height: 22px;
    }

    .toggle-knob {
        width: 18px;
        height: 18px;
    }

    .toggle-active .toggle-knob {
        left: 24px;
    }
}

/* 7. Ultra Wide Devices - 4K and Beyond (≥1920px) */
@media (min-width: 1920px) {
    .navbar {
        padding: 16px 40px;
        margin: 25px auto;
        max-width: 1800px;
    }

    .navbar-left span {
        font-size: 24px;
    }

    .navbar-right {
        gap: 25px;
    }

    .navbar a {
        font-size: 20px;
    }

    .navbar .btn {
        font-size: 18px;
        padding: 10px 20px;
    }

    #current-date {
        font-size: 18px;
    }

    .icons {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .emoji {
        padding: 5px 10px;
        gap: 8px;
    }

    .toggle-switch {
        width: 50px;
        height: 25px;
    }

    .toggle-knob {
        width: 21px;
        height: 21px;
        top: 2px;
    }

    .toggle-active .toggle-knob {
        left: 27px;
    }
}

/* Additional responsive utilities for small screens */
@media (max-width: 767.98px) {
    .navbar-right > * {
        flex-shrink: 0;
    }
    
    /* Ensure elements don't break */
    .navbar a,
    .navbar .btn {
        white-space: nowrap;
        overflow: hidden;
    }
}

/* Hover effects for larger screens */
@media (min-width: 768px) {
    .navbar a:hover {
        transform: translateY(-1px);
        transition: all 0.2s ease;
    }
    
    .icons:hover {
        transform: scale(1.1);
        transition: transform 0.2s ease;
    }
    
    .toggle-switch:hover {
        background: #555;
    }

    .light-theme .toggle-switch:hover {
        background: #bbb;
    }
}

/* Focus states for accessibility */
.navbar a:focus,
.navbar .btn:focus,
.toggle-switch:focus {
    outline: 2px solid rgb(17, 48, 223);
    outline-offset: 2px;
}

/* Hidden attribute support */
[hidden] {
    display: none !important;
}

/* Bootstrap utility classes support */
.me-1 {
    margin-right: 0.25rem;
}

/* Print styles */
@media print {
    .navbar {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc;
    }
    
    .emoji,
    .icons,
    .toggle-switch,
    .btn {
        display: none !important;
    }
    
    .navbar a {
        color: black !important;
    }
}