/* --- Reset --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", sans-serif;
    background: #eef1f4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    /* Solid fallback first */
    background: #ffffff;
    color: #2c3e50;
    padding: 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e0e0e0;
}

/* Check if browser supports backdrop-filter */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    header {
        /* Apply glass effect */
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* If not supported, use semi-transparent background */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    header {
        background: rgba(255, 255, 255, 0.95);
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text .title {
    font-size: 1.2rem;
    font-weight: 700;
}

.brand-text .subtitle {
    font-size: 0.85rem;
    color: #6c757d;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- Search --- */
.search-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    text-decoration: none;
}

.search-link svg {
    width: 20px;
    height: 20px;
    stroke: #2c3e50;
}

.search-link:hover {
    background: #f0f0f0;
}

/* --- Hamburger --- */
#sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
}

.hamburger {
    width: 26px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    height: 3px;
    width: 100%;
    background: #2c3e50;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger animation */
#sidebar-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

#sidebar-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

#sidebar-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* --- Desktop Navigation --- */
.desktop-nav {
    display: none;
}

.desktop-nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
    align-items: center;
}

.desktop-nav a {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.2s;
}

.desktop-nav a:hover {
    color: #007bff;
}

.desktop-nav a:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #007bff;
    border-radius: 2px;
}

.desktop-search {
    display: flex;
    align-items: center;
}

.search-link.desktop {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Mobile Navigation --- */
.mobile-nav {
    display: none;
}

/* --- Layout --- */
.container {
    display: flex;
    gap: 16px;
    margin: 10px;      /* desktop spacing */
    flex: 1;
    
    max-width: 100%;
}

main {
    flex: 1;
    background: #ffffff;
    padding: 15px;     /* desktop padding */
    border-radius: 8px;
    min-width: 0;
}

aside {
    width: 320px;
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

/* Animation for mobile nav */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {
    /* Hamburger */
    #sidebar-toggle {
        display: block;
    }

    /* Mobile Navigation */
    .mobile-nav {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: #ffffff;
        border-top: 1px solid #ddd;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .mobile-nav.active {
        display: block;
        animation: slideDown 0.3s ease forwards;
    }

    .mobile-nav ul {
        list-style: none;
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    .mobile-nav li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .mobile-nav a {
        display: block;
        padding: 16px 20px;
        text-decoration: none;
        color: #2c3e50;
        font-weight: 500;
        transition: background-color 0.2s;
    }

    .mobile-nav a:hover {
        background-color: #f8f9fa;
    }

    .nav-search {
        display: flex;
        justify-content: center;
        padding: 12px 20px;
        border-bottom: 1px solid #f0f0f0;
    }

    .search-link.small {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-link.small svg {
        width: 18px;
        height: 18px;
    }

    /* Hide sidebar */
    aside {
        display: none;
    }

    /* Hide desktop navigation on mobile */
    .desktop-nav {
        display: none !important;
    }

    /* Full-width layout on mobile */
    .container {
        flex-direction: column;
        gap: 0;
        margin: 0;
    }

    main {
        padding: 0;
        border-radius: 0;
    }

    .header-actions .search-link {
        display: flex;
    }

    .brand-text .title {
        font-size: 1.1rem;
    }

    /* Ensure slider doesn't interfere */
    .slider {
        position: relative;
        z-index: 1;
    }
}

/* ================= DESKTOP ================= */
@media (min-width: 769px) {
    /* Header adjustments */
    header {
        padding: 12px 40px;
        justify-content: space-between;
    }

    .header-actions {
        order: 3; /* Move to right side */
    }

    /* Hide mobile search icon on desktop */
    .header-actions .search-link {
        display: none;
    }

    /* Show desktop navigation */
    .desktop-nav {
        display: flex;
        align-items: center;
        order: 2; /* Place in middle */
        flex: 1;
        justify-content: center;
        margin: 0 20px;
    }

    .desktop-nav ul {
        display: flex;
        gap: 30px;
        margin: 0;
        padding: 0;
    }

    /* Desktop search in nav */
    .desktop-search {
        margin-left: auto;
    }

    .search-link.desktop {
        display: flex;
    }

    /* Hide mobile nav on desktop */
    .mobile-nav {
        display: none !important;
    }
}

/* Large desktop */
@media (min-width: 1024px) {
    .desktop-nav ul {
        gap: 40px;
    }
}