/* Header Styles */
header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    height: 50px;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}

.logo img {
    height: 30px;
    margin-right: 0.5rem;
}

.logo span {
    font-size: 1.2rem;
    font-weight: 700;
}

/* W3Schools style navbar */
.topnav {
    overflow: hidden;
    background-color: var(--card-bg);
    flex: 1;
    margin: 0 20px;
}

.topnav a {
    float: left;
    display: block;
    color: var(--text-color);
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 0.95rem;
}

.topnav a:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.topnav a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Dropdown container */
.dropdown {
    float: left;
    overflow: hidden;
}

/* Dropdown button */
.dropdown .dropbtn {
    font-size: 0.95rem;
    border: none;
    outline: none;
    color: var(--text-color);
    padding: 14px 16px;
    background-color: inherit;
    font-family: inherit;
    margin: 0;
    cursor: pointer;
}

/* Add a background color to navbar links on hover */
.topnav a:hover, .dropdown:hover .dropbtn {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* Dropdown content (hidden by default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 1;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Links inside the dropdown */
.dropdown-content a {
    float: none;
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

/* Add a background color to dropdown links on hover */
.dropdown-content a:hover {
    background-color: var(--bg-color);
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
}

.search-toggle {
    margin-right: 1rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    padding: 10px;
}

.search-toggle:hover {
    color: var(--primary-color);
}

/* Theme Switch */
.theme-switch {
    position: relative;
    margin-right: 10px;
}

.theme-switch {
    opacity: 0;
    position: absolute;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 44px;
    height: 22px;
    background-color: var(--bg-color);
    border-radius: 50px;
    position: relative;
    padding: 0 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.theme-toggle-label::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    top: 3px;
    left: 3px;
    transition: transform 0.2s, background-color 0.2s;
}

.theme-toggle:checked + .theme-toggle-label::after {
    transform: translateX(22px);
}

.theme-toggle-label .fa-sun {
    color: #f1c40f;
    font-size: 0.7rem;
}

.theme-toggle-label .fa-moon {
    color: #34495e;
    font-size: 0.7rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Responsive Navigation */
@media screen and (max-width: 992px) {
    .topnav a:not(:first-child), .dropdown .dropbtn {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
        position: absolute;
        right: 20px;
    }
    
    .header-actions {
        margin-right: 50px;
    }
    
    .topnav.responsive {
        position: absolute;
        top: 50px;
        left: 0;
        right: 0;
        background-color: var(--card-bg);
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }
    
    .topnav.responsive a {
        float: none;
        display: block;
        text-align: left;
    }
    
    .topnav.responsive .dropdown {
        float: none;
    }
    
    .topnav.responsive .dropdown-content {
        position: relative;
        box-shadow: none;
        border: none;
        padding-left: 20px;
        background-color: var(--bg-color);
    }
    
    .topnav.responsive .dropdown .dropbtn {
        display: block;
        width: 100%;
        text-align: left;
    }
}

@media screen and (max-width: 576px) {
    .logo span {
        font-size: 1rem;
    }
    
    .logo img {
        height: 25px;
    }
    
    .search-toggle {
        margin-right: 0.5rem;
    }
    
    .theme-switch {
        margin-right: 5px;
    }
}
