/* ========================================
   NAVBAR CONSOLIDATED STYLES
   ======================================== */

/* CSS Variables for Navbar */
:root {
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-border: rgba(0, 0, 0, 0.1);
    --navbar-brand-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --navbar-brand-gradient-alt: linear-gradient(135deg, #059669, #047857);
    --navbar-nav-bg: rgba(99, 102, 241, 0.1);
    --navbar-text-color: #1f2937;
    --navbar-text-secondary: #6b7280;
    --navbar-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
    --navbar-transition: all 0.3s ease;
}

/* ========================================
   MAIN NAVBAR STYLES
   ======================================== */

.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--navbar-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--navbar-transition);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* ========================================
   BRAND STYLES
   ======================================== */

.navbar-brand {
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--navbar-text-color);
    font-weight: 700;
    font-size: 1.25rem;
    transition: var(--navbar-transition);
}

.brand:hover {
    transform: scale(1.05);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--navbar-brand-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--navbar-transition);
}

.brand:hover .brand-icon {
    transform: rotate(5deg);
    box-shadow: var(--navbar-shadow);
}

.brand-icon .brand-logo {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

.brand-text {
    background: var(--navbar-brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: var(--text-xl);
}

/* Ensure mobile brand text is visible and properly styled */
.brand-text.mobile-only {
    display: block !important;
    background: var(--navbar-brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   NAVIGATION LINKS
   ======================================== */

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--navbar-text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 12px;
    transition: var(--navbar-transition);
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-item:hover {
    background: var(--navbar-nav-bg);
    color: #6366f1;
    transform: translateY(-2px);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #6366f1;
    border-radius: 50%;
}

.nav-icon {
    font-size: 1.5rem;
    line-height: 1;
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: inherit;
}

/* ========================================
   NOTIFICATION BADGE
   ======================================== */

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   NAVBAR ACTIONS
   ======================================== */

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ========================================
   STATUS INDICATOR
   ======================================== */

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #059669;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #22c55e;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   USER MENU
   ======================================== */

.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: var(--navbar-transition);
}

.user-toggle:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--navbar-brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
}

.user-avatar .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.user-avatar.large {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

.user-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.user-email {
    font-weight: 400;
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

.chevron {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.user-menu.open .chevron {
    transform: rotate(180deg);
}

/* ========================================
   USER DROPDOWN
   ======================================== */

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: var(--navbar-transition);
    z-index: 9999;
    overflow: hidden;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header {
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e5e7eb;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-details {
    flex: 1;
}

.user-details .user-name {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.9rem;
    margin-bottom: 0.125rem;
}

.dropdown-menu {
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: var(--navbar-transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.8);
    width: 100%;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dropdown-item:hover {
    background: var(--navbar-nav-bg);
    border-color: rgba(99, 102, 241, 0.2);
    color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.dropdown-item.admin {
    background: var(--navbar-nav-bg);
    color: #6366f1;
    font-weight: 600;
    border-color: rgba(99, 102, 241, 0.2);
}

.dropdown-item.admin:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.dropdown-item.logout {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.1);
}

.dropdown-item.logout:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.dropdown-item.profile-item {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.dropdown-item.profile-item:hover {
    background: var(--navbar-nav-bg);
    border-color: rgba(99, 102, 241, 0.2);
    color: #4338ca;
}

.dropdown-item.settings-item {
    background: rgba(107, 114, 128, 0.05);
    border-color: rgba(107, 114, 128, 0.1);
    color: #4b5563;
}

.dropdown-item.settings-item:hover {
    background: rgba(107, 114, 128, 0.1);
    border-color: rgba(107, 114, 128, 0.2);
    color: #374151;
}

.dropdown-item.logout-btn {
    background: rgba(220, 38, 38, 0.05);
    border-color: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.dropdown-item.logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: #b91c1c;
}

.item-icon {
    font-size: 1rem;
    width: 20px;
    height: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

.item-icon img {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    display: block !important;
    object-fit: contain !important;
    filter: none;
    opacity: 1;
}

.item-text {
    flex: 1;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

.dropdown-section {
    margin: 0.5rem 0;
}

.section-title {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-form {
    margin: 0;
}

/* ========================================
   AUTH BUTTONS
   ======================================== */

.auth-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--navbar-transition);
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #9ca3af;
}

.btn-primary {
    background: var(--navbar-brand-gradient);
    color: white;
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ========================================
   MOBILE HAMBURGER MENU
   ======================================== */

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--navbar-transition);
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.mobile-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
}

.hamburger {
    width: 24px;
    height: 3px;
    background: #374151;
    border-radius: 2px;
    transition: var(--navbar-transition);
    display: block;
    margin: 0 auto;
}

.mobile-toggle:hover .hamburger {
    background: #6366f1;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .navbar-container {
        padding: 0 var(--space-xl);
        height: clamp(60px, 8vw, 70px);
        gap: var(--space-md);
    }

    .brand-text.mobile-only {
        display: none;
    }

    .brand-text.desktop-only {
        display: block;
    }
}

/* Mobile Navigation */
@media (max-width: 767px) {
    .navbar-container {
        padding: 0 var(--space-sm);
        height: clamp(50px, 7vw, 60px);
        max-width: 100vw;
        overflow: hidden;
    }

    .mobile-toggle {
        display: flex;
    }

    .navbar-nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid #e5e7eb;
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--navbar-transition);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .navbar-nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-item {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        border-radius: 12px;
        background: #f9fafb;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-icon {
        font-size: 1.75rem;
        min-width: 28px;
        min-height: 28px;
    }

    .nav-item:hover {
        background: var(--navbar-nav-bg);
        border-color: rgba(99, 102, 241, 0.2);
    }

    .navbar-actions {
        gap: var(--space-xs);
        flex-shrink: 0;
    }

    .brand-text {
        font-size: var(--text-xs);
    }

    .brand-text.mobile-only {
        display: block !important;
        font-size: 0.75rem;
        font-weight: 700;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-text.desktop-only {
        display: none !important;
    }

    .brand-icon {
        width: clamp(28px, 4vw, 32px);
        height: clamp(28px, 4vw, 32px);
    }

    .brand-icon svg {
        width: clamp(16px, 3vw, 20px);
        height: clamp(16px, 3vw, 20px);
    }
}

/* Small screens under 391px */
@media (max-width: 390px) {
    .navbar-container {
        padding: 0 8px;
        height: 48px;
        justify-content: space-between;
    }

    .brand-text.mobile-only {
        display: block !important;
        font-size: 0.7rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-text.desktop-only {
        display: none !important;
    }

    .brand-icon {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    .brand-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* Medium-small screens (321px - 390px) */
@media (min-width: 321px) and (max-width: 390px) {
    .brand-text.mobile-only {
        display: block !important;
        font-size: 0.75rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-text.desktop-only {
        display: none !important;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    .navbar-container {
        padding: 0 var(--space-2);
        height: 50px;
    }

    .brand-text.mobile-only {
        display: block !important;
        font-size: var(--text-xs);
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-text.desktop-only {
        display: none !important;
    }

    .brand-icon {
        width: clamp(24px, 3vw, 28px);
        height: clamp(24px, 3vw, 28px);
    }

    .brand-icon svg {
        width: clamp(14px, 2.5vw, 16px);
        height: clamp(14px, 2.5vw, 16px);
    }

    .auth-buttons .btn {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }
}

/* Desktop utility classes */
@media (min-width: 1024px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

/* PWA Mobile Styles */
@media (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .navbar {
        border-bottom: 2px solid var(--navbar-border);
    }

    .nav-item {
        border-width: 2px;
    }

    .brand-icon {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .brand,
    .brand-icon,
    .nav-item,
    .user-toggle,
    .dropdown-item,
    .btn,
    .mobile-toggle,
    .hamburger {
        transition: none;
    }

    .brand:hover,
    .nav-item:hover,
    .user-toggle:hover,
    .dropdown-item:hover,
    .btn:hover {
        transform: none;
    }

    .status-dot {
        animation: none;
    }
}

/* ========================================
   ADMIN MESSAGE TOAST NOTIFICATIONS
   ======================================== */

.admin-message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 2px solid #6366f1;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 16px;
    max-width: 400px;
    min-width: 320px;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.admin-message-toast.show {
    transform: translateX(0);
}

.admin-message-toast .toast-content {
    padding: 0;
}

.admin-message-toast .toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1f2937;
}

.admin-message-toast .toast-icon {
    width: 20px;
    height: 20px;
}

.admin-message-toast .toast-title {
    flex: 1;
    font-size: 14px;
}

.admin-message-toast .toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
}

.admin-message-toast .toast-close:hover {
    color: #374151;
}

.admin-message-toast .toast-body {
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.admin-message-toast .toast-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.admin-message-toast .toast-btn {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.2s ease;
}

.admin-message-toast .toast-btn-primary {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.admin-message-toast .toast-btn-primary:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.admin-message-toast .toast-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.admin-message-toast .toast-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Debug Test Button (Development Only) */
.debug-test-button {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 9999;
    background: red;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.debug-test-button:hover {
    background: #dc2626;
}
