/* Fixed Header CSS - public/css/header.css */

:root {
    --test-bar-height: 60px;
    --primary-blue: #2d4296;
    --secondary-blue: #4460b8;
    --text-gray: #4a5568;
    --bg-light: #f7fafc;
    --border-light: #e2e8f0;
    --gradient-primary: linear-gradient(135deg, #2d4296 0%, #4460b8 100%);
    --shadow-primary: rgba(45, 66, 150, 0.3);
}

/* ==========================================================================
   Test Bar
   ========================================================================== */
.test-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--gradient-primary);
    color: white;
    z-index: 60;
    height: 60px;
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
}

.test-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.test-icon {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.test-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.test-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.test-separator {
    font-weight: bold;
    opacity: 0.8;
}

.test-description {
    font-size: 0.875rem;
    opacity: 0.95;
}

.feedback-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.feedback-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    color: white;
}

/* ==========================================================================
   Main Header
   ========================================================================== */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
}

.main-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.12);
}

.main-header.test-bar-hidden {
    top: 0 !important;
}

/* Logo */
.logo-link {
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
    background: rgba(45, 66, 150, 0.05);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav-link {
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-blue);
    background: rgba(45, 66, 150, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-primary);
    color: white;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.auth-link {
    color: #64748b;
    font-weight: 500;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.auth-link:hover {
    color: var(--primary-blue);
    background: #f8fafc;
}

.btn-add {
    background: rgba(248, 250, 252, 0.8);
    color: #475569;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

.btn-add:hover {
    background: rgba(239, 246, 255, 0.9);
    color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-primary);
}

/* ==========================================================================
   Notifications & User Menu
   ========================================================================== */
.notification-btn, .user-btn {
    position: relative;
    padding: 0.625rem;
    border-radius: 0.75rem;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-btn:hover, .user-btn:hover {
    color: var(--primary-blue);
    background: rgba(239, 246, 255, 0.8);
    transform: translateY(-1px);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.user-avatar, .user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
}

.user-avatar-placeholder {
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-avatar-large, .user-avatar-placeholder-large {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
}

.user-avatar-placeholder-large {
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

/* ==========================================================================
   FIXED DROPDOWNS (RTL Positioning)
   ========================================================================== */
.dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0; /* Changed from right: 0 to left: 0 */
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    min-width: 280px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
}

/* Arrow positioning fix for RTL */
.dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px; /* Changed from right: 20px to left: 20px */
    width: 12px;
    height: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    border-radius: 2px;
}

.dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Notification Dropdown */
.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 1rem 1rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: rtl;
}

.dropdown-content {
    max-height: 320px;
    overflow-y: auto;
    direction: rtl;
}

.dropdown-footer {
    padding: 0.75rem;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    border-radius: 0 0 1rem 1rem;
    text-align: center;
    direction: rtl;
}

.dropdown-footer a {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
    direction: rtl;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-blue);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    margin-left: 0.5rem; /* RTL spacing */
}

.dropdown-divider {
    border-top: 1px solid #f1f5f9;
    margin: 0.5rem 0;
}

.logout-btn {
    color: #ef4444 !important;
}

.logout-btn:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* User Menu Header */
.user-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.875rem;
}

.user-email {
    color: #64748b;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Notifications Dropdown */
.mark-all-btn {
    color: var(--primary-blue);
    font-size: 0.75rem;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mark-all-btn:hover {
    color: var(--secondary-blue);
    transform: scale(1.05);
}

.notification-item {
    padding: 0.875rem;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: start;
    gap: 0.75rem;
    direction: rtl;
    text-align: right;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.unread {
    background: rgba(239, 246, 255, 0.5);
    border-right: 3px solid var(--primary-blue);
}

.notification-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    text-align: right;
}

.notification-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: #64748b;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.notification-time {
    color: #94a3b8;
    font-size: 0.75rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */
.mobile-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    gap: 3px;
}

.mobile-btn span {
    width: 20px;
    height: 2px;
    background: #64748b;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-btn:hover span {
    background: var(--primary-blue);
}

.mobile-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.show {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 320px;
    max-width: 90vw;
    background: white;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.2);
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    direction: rtl;
}

.mobile-menu.show {
    transform: translateX(0);
}

.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gradient-primary);
    color: white;
}

.mobile-close {
    padding: 0.5rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 80px);
    overflow-y: auto;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #475569;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    direction: rtl;
    text-align: right;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
    background: #f8fafc;
    color: var(--primary-blue);
}

.mobile-nav-link.active {
    border-right: 4px solid var(--primary-blue);
}

.mobile-actions {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

.mobile-section-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569;
    padding: 0.5rem 0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.mobile-section-title:first-child {
    margin-top: 0;
}

.mobile-action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    color: #475569;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: right;
    position: relative;
    direction: rtl;
}

.mobile-action-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.mobile-action-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.mobile-action-btn.logout {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.mobile-action-btn.logout:hover {
    background: #fecaca;
}

.mobile-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    direction: rtl;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header button {
    padding: 0.5rem;
    color: #6b7280;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-header button:hover {
    color: #374151;
    background: #f3f4f6;
}

.form-group {
    margin-bottom: 1rem;
    padding: 0 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: right;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(45, 66, 150, 0.1);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #f1f5f9;
    direction: rtl;
}

.form-actions .btn-primary {
    flex: 1;
}

.success-message {
    padding: 1.5rem;
    text-align: center;
    color: #065f46;
    background: #ecfdf5;
    border-radius: 0.5rem;
    margin: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --test-bar-height: 80px;
    }

    .test-bar {
        height: 80px;
    }

    .test-bar .container > div {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .test-message {
        flex-direction: column;
        gap: 0.25rem;
        align-items: center;
    }

    .test-separator {
        display: none;
    }

    .mobile-menu {
        width: 100%;
    }

    .dropdown {
        width: calc(100vw - 2rem);
        left: 1rem;
        right: 1rem;
    }

    .dropdown::before {
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }
}

@media (max-width: 640px) {
    .feedback-btn span {
        display: none;
    }

    .feedback-btn {
        padding: 0.625rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }

    .test-icon {
        width: 36px;
        height: 36px;
    }
}

/* ==========================================================================
   Body Padding Adjustments
   ========================================================================== */
body {
    transition: padding-top 0.4s ease;
}

body.test-bar-hidden {
    padding-top: 64px !important;
}

body:not(.test-bar-hidden) {
    padding-top: calc(var(--test-bar-height) + 64px) !important;
}

/* Add this CSS to handle very small screens if using xs: prefix */
@media (max-width: 540px) {
    .xs\:mt-2 {
        margin-top: 2rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Reduce header height on very small screens */
    .main-header .flex {
        height: 3rem; /* 48px instead of 56px */
    }
}
