/* Header/Navigation Styles */

:root {
    --primary-color: #1e40af;
    --secondary-color: #f59e0b;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    padding-top: 70px; /* Add padding to prevent content from being hidden behind fixed navbar */
}

/* Ensure main content is always below navbar */
.main-content {
    margin-top: 0;
    padding-top: 0;
    min-height: calc(100vh - 70px); /* Ensure content area is tall enough */
}

/* First section after navbar should have proper spacing */
.main-content > section:first-child,
.main-content > div:first-child {
    margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 60px; /* Slightly less padding on mobile */
    }
    
    .navbar-floating {
        padding: 0.5rem 1rem;
    }
}

/* Floating Navigation Bar */
.navbar-floating {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 2rem;
    transition: all 0.3s ease;
}

.navbar-floating.scrolled {
    top: 0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.navbar-floating .navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
}

.navbar-floating .navbar-brand img {
    height: 45px;
    border-radius: 8px;
}

.navbar-floating .navbar-collapse {
    justify-content: center !important;
}

.navbar-floating .navbar-nav {
    justify-content: center !important;
    flex-grow: 1;
    gap: 0.5rem;
}

.navbar-floating .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-floating .nav-link:hover {
    background: var(--primary-color);
    color: white !important;
}

/* Active state for all nav links */
.navbar-floating .nav-link.active {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.navbar-floating .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary-color);
}

.navbar-floating .btn-admin {
    background: var(--secondary-color);
    color: white !important;
    border-radius: 25px;
    padding: 0.5rem 1.5rem !important;
}

.navbar-floating .btn-admin:hover {
    background: #d97706;
}

.navbar-floating .lang-switcher a {
    color: #666;
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.navbar-floating .lang-switcher a:hover,
.navbar-floating .lang-switcher a.active {
    background: var(--primary-color);
    color: white;
}

/* Language Dropdown Styling */
.lang-dropdown-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    font-weight: 500;
    border-radius: 25px;
    padding: 0.4rem 1rem;
    transition: all 0.3s ease;
}

.lang-dropdown-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.lang-dropdown-btn:focus {
    box-shadow: none;
}

.dropdown-menu .dropdown-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Main nav dropdown active state */
.nav-item.dropdown .nav-link.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.dropdown-menu .dropdown-item:hover {
    background: var(--primary-color);
    color: white;
}

/* Language Dropdown - Shorter Width */
.dropdown-menu {
    min-width: 100px !important;
    width: 100px !important;
}

.dropdown-menu .dropdown-item {
    padding: 0.4rem 0.8rem;
    text-align: center;
}

/* Navigation Dropdown Menu - Centered and Proper Width */
.navbar-floating .nav-item.dropdown {
    position: relative;
    text-align: center;
}

.navbar-floating .nav-item.dropdown .dropdown-menu {
    min-width: 50px !important;
    width: auto !important;
    max-width: none !important;
    position: absolute;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-top: 8px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 0.5rem 0 !important;
}

.navbar-floating .nav-item.dropdown .dropdown-menu .dropdown-item {
    padding: 0.7rem 1.5rem !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    text-align: center !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    min-width: 180px !important;
    border-bottom: 2px solid #cccccc !important;
    display: block !important;
}

/* Ensure dropdown is centered under parent */
.navbar-floating .nav-item.dropdown {
    position: relative;
}

.navbar-floating .nav-item.dropdown .dropdown-menu {
    position: absolute;
}

/* Standard Dropdown Styling */
.navbar-floating .dropdown-menu {
    min-width: 220px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 0.5rem !important;
    margin-top: 8px !important;
}

.navbar-floating .dropdown-menu .dropdown-item {
    padding: 0.6rem 1rem !important;
    border-radius: 8px !important;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.navbar-floating .dropdown-menu .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
    color: var(--primary-color) !important;
    transform: translateX(3px);
}

.navbar-floating .dropdown-menu .dropdown-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%) !important;
    color: var(--primary-color) !important;
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

.navbar-floating .dropdown-menu .dropdown-item i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    margin-right: 0.5rem;
    opacity: 0.8;
}
