/* ========================================
   NAVBAR COMPONENT STYLES
   Consolidated from all navbar components
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

/* Base Navbar Styles - Ruler Image Background */
.navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    color: #000;
    border: none;
    padding: 0.5rem .5rem;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    min-height: 80px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: visible;
}

/* Ensure navbar content is above the ruler image */
.navbar > * {
    position: relative;
    z-index: 10;
}

/* Remove the ::after pseudo-element that was showing numbers */
.navbar::after {
    display: none;
}

.navbar-brand, .navbar-nav .nav-link {
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.navbar-nav .nav-link {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 0.6rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    white-space: nowrap;
    min-height: auto;
    justify-content: flex-start;
    margin-bottom: 0;
    line-height: 1.2;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.navbar-nav .nav-link:hover {
    color: #1976d2;
    transform: translateY(-2px);
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-nav .nav-link.active {
    color: #1976d2;
    font-weight: bold;
}

.navbar-nav .nav-link i {
    margin-bottom: 0.25rem;
    margin-right: 0 !important; /* Override any left margin */
    margin-top: 0;
    display: block;
    font-size: 1rem;
    text-align: center; /* Center the icon */
    width: 100%; /* Full width to center properly */
    line-height: 1;
}

/* Navbar Brand */
.navbar-brand {
    margin-left: 0;
    transition: transform 0.3s ease;
    font-weight: bold;
    color: #333;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    padding-left: 12px;
    position: relative;
}

/* Ruler hole on the left */
.navbar-brand::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #000;
    z-index: 10;
}

.navbar-brand:hover {
    transform: scale(1.1);
}

/* Navbar Toggler */
.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
    display: none !important;
}

/* .navbar-toggler:focus - styles can be added here if needed */

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Dropdown Styles */
.dropdown-menu {
    border: none;

    border-radius: 10px;
    margin-top: 0.5rem;
    background-color: white;
    z-index: 1050;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    color: #495057;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: translateX(5px);
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e9ecef;
}

/* Profile Dropdown */
.profile-dropdown {
    background: transparent !important;
    border: none !important;
    color: #fff;
    font-weight: normal;
    transition: all 0.3s ease;
    border-radius: 0;
    padding: 0 !important;
    display: flex;
    align-items: center;
    min-width: auto;
    font-size: 1rem;
    line-height: 1.2;
    margin-left: auto;
}

.profile-dropdown:hover {
    background: transparent !important;
    transform: none;
    color: #fff;
    text-decoration: none;
    border: none !important;
}

.profile-dropdown::after {
    margin-left: 0.5rem !important;
    border-top-color: #fff !important;
    border-width: 0.4em 0.4em 0 !important;
}

.profile-name {
    font-family: 'Patrick Hand', cursive;
    font-weight: bold;
    font-size: 2.5rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    line-height: 1.2;
    color: #fff;
    margin-right: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Button Styles */
.btn {
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1);
}

.btn-primary {
    background-color: #4A90E2;
}

.btn-primary:hover {
    background-color: #357ABD;
}

.btn-success {
    background-color: #2ECC71;
}

.btn-success:hover {
    background-color: #27AE60;
}

/* Auth Buttons Container - Move closer to main nav */
.navbar-auth-buttons {
    margin-left: auto !important;
    margin-right: 0 !important;
    gap: 0.2rem;
    display: flex;
    align-items: center;
}

/* All Auth Buttons - Same Size as Login */
.navbar-auth-buttons .nav-link {
    min-width: 80px;
    min-height: 60px;
    padding: 0.6rem 0.8rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px;
    font-size: 0.67rem !important; /* Reduced by 30% from 0.95rem */
    font-weight: 600 !important;
    line-height: 1.2;
    text-align: center;
}

.navbar-auth-buttons .nav-link i {
    font-size: 0.98rem; /* Reduced by 30% from 1.4rem */
    margin-bottom: 0.3rem;
    margin-right: 0 !important; /* Override any left margin */
    display: block;
    text-align: center; /* Center the icon */
    width: 100%; /* Full width to center properly */
}

.signup-text {
    display: block;
    white-space: nowrap;
    font-size: inherit; /* Inherit the reduced font size from parent */
}

.btn-student-signup {
    background-color: #2c3e50 !important;
    color: white !important;
}

.btn-student-signup:hover {
    background-color: #34495e !important;
    transform: translateY(-2px);
}

.btn-teacher-signup {
    background-color: #2ECC71 !important;
    color: white !important;
}

.btn-teacher-signup:hover {
    background-color: #27AE60 !important;
    transform: translateY(-2px);
}

/* Theme-specific navbar overrides */

/* Kid Theme */
.theme-kid .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    border-bottom: 4px solid var(--primary-dark);
}

/* Teen Theme */
.theme-teen .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    border-bottom: 2px solid rgba(175, 245, 11, 0.5);
    padding: 0;
    margin: 0;
}
.theme-teen .navbar .container {
    padding: 0;
    margin: 0;
}

/* Adult Theme */
.theme-adult .navbar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    padding: 0;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}
.theme-adult .navbar .container {
    padding: 0;
    margin: 0;
}

/* Fix for main content padding */
body.theme-teen main.container,
body.theme-adult main.container {
    padding-top: 1rem;
    margin-top: 0;
}

/* Remove any top spacing between navbar and content for public theme */
body.theme-public main.container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
body.theme-public main.container > :first-child {
    margin-top: 0 !important; /* prevent margin-collapsing gap */
}

/* Align inline SVG logo to center to avoid baseline gaps */
.navbar-brand svg { 
    display: block; 
    margin: 0 auto; /* Center block element instead of using vertical-align */
}

/* Teen Theme */
.theme-teen .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    border-bottom: 2px solid rgba(175, 245, 11, 0.5);
    padding: 0 !important;
    margin: 0 !important;
}
.theme-teen .navbar .container {
    padding: 0 !important;
    margin: 0 !important;
}

/* Adult Theme */
.theme-adult .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}
.theme-adult .navbar .container {
    padding: 0 !important;
    margin: 0 !important;
}

.theme-kid .navbar-brand {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-large);
    color: white !important;
    display: flex;
    align-items: center;
}

.theme-kid .nav-link {
    color: white !important;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-medium);
    padding: 0.5rem 1rem;
    border-radius: 15px;
    transition: background-color var(--transition-speed);
}

.theme-kid .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.theme-kid .dropdown-menu {
    border-radius: 15px;
    border: 2px solid var(--accent-color);

    background-color: white;
    z-index: 1050;
}

.theme-kid .dropdown-item {
    font-family: var(--font-family-primary);
    padding: 0.75rem 1rem;
    transition: background-color var(--transition-speed);
    color: var(--text-color);
}

.theme-kid .dropdown-item:hover {
    background-color: #FFB347;
    color: #222;
}

.theme-kid .profile-dropdown {
    background-color: rgba(40, 40, 40, 1);
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    min-width: 150px;
}

.theme-kid .profile-name {
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

/* Teen Theme */
.theme-teen .navbar {
    background: #02031e !important;
    border-bottom: 2px solid #aff50b;
}

.theme-teen .navbar-nav .nav-link {
    color: white !important;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition-smooth);
    border-radius: var(--border-radius-md);
    margin: 0 0.25rem;
    padding: 0.5rem 1rem;
}

.theme-teen .navbar-nav .nav-link:hover {
    color: #aff50b !important;
    background-color: rgba(175, 245, 11, 0.1);
}

.theme-teen .navbar-nav .nav-link.active {
    color: #f1f3e8 !important;
    background-color: rgba(175, 245, 11, 0.15);
}

/* Adult Theme */
.theme-adult .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
}

.theme-adult .nav-link {
    font-size: 1.1em;
    padding: 0.8rem 1rem !important;
}

/* Teacher Theme */
.theme-teacher .navbar {
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background: linear-gradient(90deg, #2c3e50, #2c3e50);
    border-bottom: 4px solid var(--accent-color);
    color: white;

}

.theme-teacher .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    color: var(--text-primary) !important;
}

/* Force navbar to be visible on public pages (to override Tailwind CSS) */
.theme-public .navbar {
    background: url('/static/images/ruler1.png') center 45% / 86.7% 148.1125% no-repeat !important;
    background-color: transparent !important;
    margin-top: 0 !important;
    padding-top: 0.5rem !important;
    margin-bottom: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1000 !important;
}

/* Only force these on desktop to override Tailwind */
@media (min-width: 992px) {
    .theme-public .navbar-collapse {
        display: flex !important;
        flex-basis: auto !important;
        flex-grow: 1 !important;
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .theme-public .navbar-nav {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .theme-public .nav-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .theme-public .nav-link {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

.theme-public .nav-link {
    font-size: 1.1em;
    padding: 0.8rem 1rem !important;
}

/* Game-specific navbar overrides */
.game-page .navbar {
    background: var(--primary-dark) !important;
    color: white !important;
}

.game-page .navbar-brand, 
.game-page .navbar-nav .nav-link {
    color: white !important;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .theme-kid .navbar-collapse {
        background-color: var(--primary-color);
        padding: 1rem;
        border-radius: 15px;
        margin-top: 1rem;
    }

    .theme-kid .nav-link {
        padding: 0.75rem 1rem;
    }

    .theme-kid .d-flex {
        margin-top: 1rem;
        justify-content: center;
    }

    .theme-kid .profile-name {
        max-width: 80px;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem !important;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .profile-name {
        max-width: 80px;
    }
    
    .navbar-user-name {
        font-size: 1rem;
    }
    
    .navbar-user-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25em;
    }
    
    .dropdown-menu {
        border-radius: 0;

        border: 1px solid rgba(255,255,255,0.1);
    }
}

/* Navbar User Section */
.navbar-user-container {
    gap: 0.5em;
}

.navbar-user-link {
    transition: opacity 0.2s ease;
    text-decoration: none;
}

.navbar-user-link:hover {
    opacity: 0.8;
    text-decoration: none;
}

.navbar-user-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
    vertical-align: middle;
    opacity: 0.9;
}

.navbar-dropdown-container {
    display: inline-block;
}

.navbar-dropdown-toggle {
    display: inline;
    color: rgba(255,255,255,0.9) !important;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.navbar-dropdown-toggle:hover {
    color: white !important;
    background: rgba(255,255,255,0.1);
}

/* .navbar-dropdown-toggle:focus - styles can be added here if needed */

/* User Type and Role Badges */
.user-type-badge {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge {
    background: #007bff;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navbar Collapse Animation */
.navbar-collapse {
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.navbar-nav {
    padding: 0 !important;
    margin: 0 !important;
    align-items: center;
}

/* Ensure profile dropdown stays on the right */
.d-flex.align-items-center {
    margin-left: auto;
}

.navbar .d-flex {
    margin-left: auto;
}

/* Ensure user dropdown nav is on the right side */
.navbar-nav.ms-auto {
    margin-left: auto !important;
}

/* Alternative: if ms-auto doesn't work, use this */
.navbar-collapse > .navbar-nav:last-child {
    margin-left: auto !important;
}

.navbar-collapse.collapsing {
    transition: height 0.35s ease;
}

/* Navbar Brand Logo */
.navbar-brand-logo {
    width: 40px;
    height: 40px;
    margin-right: 0.5rem;
}

/* Navbar Search (if needed) */
.navbar-search {
    position: relative;
    margin: 0 1rem;
}

.navbar-search-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: white;
    width: 200px;
}

.navbar-search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.navbar-search-input:focus {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);

    color: white;
}

/* Navbar Notifications */
.navbar-notifications {
    position: relative;
    margin-right: 1rem;
}

.navbar-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Navbar Theme Variations */
.navbar-dark {
    background: #343a40;
}

.navbar-light {
    background: #f8f9fa;
}

.navbar-light .navbar-brand,
.navbar-light .navbar-nav .nav-link {
    color: #495057 !important;
}

.navbar-light .navbar-nav .nav-link:hover {
    color: #007bff !important;
}

/* Navbar Fixed Top */
.navbar-fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

/* Navbar with Shadow */
/* .navbar-shadow - styles can be added here if needed */

/* Navbar Glass Effect */
.navbar-glass {
    background: rgba(102, 126, 234, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
} 

/* Final hard reset to eliminate any browser/override margins that create a top gap */
html, body { 
    margin: 0 !important; 
    padding: 0 !important; 
}

/* Prevent fixed navbar from covering in-page anchors */
html { scroll-padding-top: 64px; } /* default pad for anchor jumps */

/* In case content sections are targets, give them a scroll-margin */
main, section, [id^="section-"], [data-anchor="true"] { scroll-margin-top: 64px; }

/* Theme-specific offsets if navbar height differs */
body.theme-teen html,
body.theme-public html,
body.theme-adult html,
body.theme-teacher html,
body.theme-kid html { scroll-padding-top: 64px; }