@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Update the body style */
body {
    /* CHANGED: Swapped Inter for Montserrat */
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f8fafc;
}

/* ADD THIS: Ensures buttons, inputs, and textareas also use Montserrat */
button, input, textarea, select {
    font-family: inherit;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1f2937;
    font-size: 1.875rem;
    font-weight: 700;
}

.login-card p {
    text-align: center;
    margin-bottom: 2rem;
    color: #6b7280;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn-primary {
    background: #2563eb;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem 1.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

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

.btn-icon {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.btn-icon:hover {
    background: #e5e7eb;
}

/* --- Header Layout --- */
.main-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-logo {
    max-height: 5rem;
    width: auto;
}

/* Search Bar */
.header-center {
    flex: 1;
    max-width: 500px;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.5rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 25px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-input:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Profile Section */
.header-right {
    display: flex;
    align-items: center;
}

.profile-dropdown-container {
    position: relative;
}

.profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    background: linear-gradient(90deg, #f1c57a, #c69645);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

.profile-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.avatar-initials {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    width: 240px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.2s ease;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-header {
    padding: 1rem 1.25rem;
}

.user-name {
    display: block;
    font-weight: 600;
    color: #1f2937;
}

.user-email {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1.25rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f9fafb;
}

.dropdown-item.text-danger {
    color: #ef4444;
}

.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
    .search-container { display: none; }
}

.platform-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 1rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
    justify-content: center;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    text-decoration: none;
}

.tab-btn.active {
    color: #f1c57a;
    border-bottom-color: #f1c57a;
}

.tab-btn:hover {
    color: #f1c57a;
}

/* Course Layout */
.course-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 70vh;
}

.chapters-sidebar {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.progress-overview {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.progress-overview h3 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-size: 1.125rem;
}

.progress-bar {
    background: #f3f4f6;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background: linear-gradient(90deg, #10b981, #059669);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.chapter {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.5rem;
}

.chapter:last-child {
    border-bottom: none;
}

.chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.chapter-header:hover {
    background: #f9fafb;
}

.chapter-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.chapter-progress {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
}

.chapter-toggle {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: #9ca3af;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.3s ease;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
}

.chapter.expanded .chapter-toggle {
    transform: rotate(90deg);
    color: #2563eb;
}

.lessons-list {
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    display: none;
}

.chapter.expanded .lessons-list {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.lesson-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lesson-item:hover {
    background: #f3f4f6;
}

.lesson-item.active {
    background: #dbeafe;
    color: #2563eb;
}

.lesson-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.lesson-status.completed {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.lesson-status.in-progress {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.lesson-name {
    flex: 1;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.lesson-header h2 {
    color: #1f2937;
    font-size: 1.5rem;
}

.lesson-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#lesson-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

#lesson-status.not-started {
    background: #f3f4f6;
    color: #6b7280;
}

#lesson-status.in-progress {
    background: #fef3c7;
    color: #d97706;
}

#lesson-status.completed {
    background: #d1fae5;
    color: #065f46;
}

.lesson-content {
    margin-bottom: 2rem;
    min-height: 400px;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

/* Video Player */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    aspect-ratio: 16 / 9;
}

.lesson-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Big Play Button */
.big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(118, 75, 162, 0.7);
    animation: pulse-purple 2s infinite;
    z-index: 20;
    transition: transform 0.2s;
}

.big-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.big-play-btn svg {
    width: 30px;
    height: 30px;
    fill: white;
}

@keyframes pulse-purple {
    0% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(118, 75, 162, 0); }
    100% { box-shadow: 0 0 0 0 rgba(118, 75, 162, 0); }
}

.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 30;
}

.video-wrapper:hover .custom-controls,
.video-wrapper.paused .custom-controls {
    opacity: 1;
    transform: translateY(0);
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    padding: 5px;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}

.control-btn:hover {
    color: #667eea;
    transform: scale(1.1);
}

.seek-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
}

.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: transform 0.2s;
}

.seek-slider:hover::-webkit-slider-thumb {
    transform: scale(1.3);
    background: #667eea;
}

.time-display {
    color: white;
    font-size: 12px;
    font-family: monospace;
    font-weight: bold;
    min-width: 100px;
    text-align: center;
}

.watermark-overlay {
    position: absolute;
    color: rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    user-select: none;
}

.lesson-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #374151;
}

.lesson-text h3 {
    color: #1f2937;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.lesson-text p {
    margin-bottom: 1rem;
}

.lesson-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}


/* =========================================
   NEW CHAT STYLES (Cleaned & Modern)
   ========================================= */

.community-container {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 2px; 
}

/* Base Message Wrapper */
.message {
    display: flex;
    gap: 8px;
    max-width: 70%;
    align-items: flex-end; /* Avatar at bottom */
    position: relative;
    /* Large margin for new speakers */
    margin-top: 15px; 
    animation: fadeIn 0.2s ease;
}

/* Consecutive Messages (Stacked) */
.message.group-middle,
.message.group-end {
    margin-top: 2px;
}

/* --- AVATAR (Them) --- */
.message-avatar {
    width: 28px; 
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
    flex-shrink: 0; 
    margin-bottom: 4px;
    visibility: hidden; 
}

/* Show avatar ONLY on the last message of a group or singles */
.message.group-end .message-avatar,
.message.group-single .message-avatar {
    visibility: visible;
}

/* --- MESSAGE CONTENT WRAPPER --- */
.message-content {
    display: flex;
    flex-direction: column;
    /* CRITICAL FIX: Align left/start so bubbles don't stretch */
    align-items: flex-start; 
    min-width: 0; 
}
.bubble-row {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between bubble and time */
    max-width: 100%;
}
/* --- BUBBLE STYLING --- */
.message-bubble {
    /* Keep existing styles, just ensure max-width allows space for time */
    padding: 8px 14px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #1f2937;
    background: #f3f4f6;
    position: relative;
    overflow-wrap: break-word; 
    word-wrap: break-word; 
    word-break: normal; 
    width: fit-content;
    
    /* Slight change: ensure it doesn't push the time off-screen */
    max-width: 100%; 
}

.message-timestamp {
    font-size: 0.65rem;
    color: #cbd5e1; /* Very light grey, subtle */
    white-space: nowrap; /* Don't wrap 20:13 */
    margin-bottom: 2px; /* Align nicely with bubble curve */
    flex-shrink: 0; /* Never squash the time */
    opacity: 0; /* Optional: Make it fade in on hover? Or keep visible? */
    transition: opacity 0.2s;
}

/* Show time always? or only on hover? 
   Let's show it always as requested, but subtle. */
.message-timestamp {
    opacity: 1; 
}

/* --- SHAPING LOGIC (THEM / LEFT) --- */
.message.group-single:not(.own) .message-bubble { border-radius: 18px; }
.message.group-start:not(.own) .message-bubble { border-radius: 18px 18px 18px 4px; }
.message.group-middle:not(.own) .message-bubble { border-radius: 4px 18px 18px 4px; }
.message.group-end:not(.own) .message-bubble { border-radius: 4px 18px 18px 18px; }

/* --- "ME" (OWN) STYLES --- */
.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-right: 0;
}

/* Hide Avatar/Info for ME */
.message.own .message-avatar,
.message.own .message-info {
    display: none !important;
}

/* Align my bubbles to the right */
.message.own .message-content {
    align-items: flex-end; 
}
.message.own .bubble-row {
    flex-direction: row-reverse;
}
.message.own .message-bubble {
    background: #0084ff; 
    color: white;
}
.message.own .message-timestamp {
    text-align: right;
}
/* --- SHAPING LOGIC (ME / RIGHT) --- */
.message.group-single.own .message-bubble { border-radius: 18px; }
.message.group-start.own .message-bubble { border-radius: 18px 18px 4px 18px; }
.message.group-middle.own .message-bubble { border-radius: 18px 4px 4px 18px; }
.message.group-end.own .message-bubble { border-radius: 18px 4px 18px 18px; }


/* --- INFO TEXT (One Line) --- */
.message-info {
    font-size: 0.75rem;
    color: #9ca3af;
    /*margin-left: 14px; /* Align with bubble start */
    margin-bottom: 5px;
    display: none; 
    flex-direction: row; 
    align-items: center;
}

/* Remove the old dot separator since time is gone */
.message-info .time {
    display: none; /* Hide the old time span if it exists in HTML */
}

.message.group-start .message-info,
.message.group-single .message-info {
    display: flex;
}

.user-name {
    font-weight: 600;
    color: #6b7280;
    margin-right: 6px;
}

.message-info .time::before {
    content: "•";
    margin-right: 6px;
    opacity: 0.5;
}

/* --- INPUT AREA --- */
.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    background: #f0f2f5;
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
}

.chat-input:focus {
    background: #e4e6eb;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Quiz & Locked Styles */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.question-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-label:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.option-label input[type="radio"] {
    margin-right: 1rem;
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #667eea;
}

.option-label.correct {
    border-color: #10b981;
    background-color: #ecfdf5;
    color: #065f46;
}

.option-label.incorrect {
    border-color: #ef4444;
    background-color: #fef2f2;
    color: #991b1b;
}

.quiz-results {
    text-align: center;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 12px;
    margin-top: 2rem;
    display: none;
}

.quiz-score {
    font-size: 2rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1rem;
}

.btn-submit-quiz {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
}

/* Locked Card Styles */
.chapter-card.locked {
    background: #f9fafb;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.7;
    filter: grayscale(100%);
    pointer-events: none;
    user-select: none;
}

.chapter-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.chapter-card.locked .card-status-strip {
    background: #d1d5db;
}

.chapter-card.locked .card-icon {
    background: #e5e7eb;
    color: #9ca3af;
}

.chapter-card.locked .action-text {
    color: #9ca3af;
}

.chapter-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0.2;
}

/* --- USER ROLE BADGES --- */
.user-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-right: 6px; /* Space between badge and name */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
}

/* 1. ADMIN: Red (Authoritative) */
.badge-admin {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* 2. GOLD: Gold/Yellow (Premium) */
.badge-gold {
    background-color: #fffbeb;
    color: #d97706; /* Dark gold text */
    border: 1px solid #fcd34d;
    box-shadow: 0 1px 2px rgba(251, 191, 36, 0.2);
}

/* 3. MEDIUM: Blue/Purple (Intermediate) */
.badge-medium {
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

/* 4. STANDARD: Grey (Default) */
.badge-standard {
    background-color: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* Adjust message info layout to accommodate badge */
.message-info {
    align-items: center; /* Vertically center badge with name */
}

/* --- Header Right Section Layout --- */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem; /* Space between the main groups */
}

/* 1. Gold Social Icons */
.social-icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-link {
    color: #c69645; /* Darker Gold for visibility */
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}

.social-link:hover {
    color: #f1c57a; /* Lighter gold on hover */
    transform: translateY(-2px);
}

/* Vertical Separator line */
.header-separator {
    width: 1px;
    height: 24px;
    background-color: #e5e7eb;
}

/* 2. Support Button */
.btn-support {
    padding: 0.4rem 1.2rem;
    border: 1px solid #e5e7eb;
    border-radius: 50px; /* Full rounded pill shape */
    background: white;
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-support:hover {
    border-color: #c69645;
    color: #c69645;
    background: #fffbeb;
}

/* 3. Notification Bell */
.notification-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    color: #6b7280;
    padding: 5px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.notification-btn:hover {
    color: #1f2937;
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background-color: #ef4444; /* Red alert */
    border: 1px solid white;
    border-radius: 50%;
}

/* 4. Profile Ring Logic */
.profile-ring-wrapper {
    /* This creates the gradient border effect */
    background: linear-gradient(90deg, #f1c57a, #c69645);
    padding: 2px; /* This determines the thickness of the gold ring */
    border-radius: 50%;
    
    /* Optional: Add a shadow to the ring */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 1); /* White spacing OUTSIDE the ring? */
    /* OR if you want the spacing INSIDE (between ring and button): */
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* We use a white border to create the "spacing" between the gradient ring and the avatar */
    border: 2px solid white; 
    
    /* The button background itself (gradient) */
    background: linear-gradient(90deg, #f1c57a, #c69645);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    
    /* Ensure no default gray border overrides our style */
    outline: none;
}

.profile-btn:hover {
    transform: scale(1.05); /* Slight zoom on hover */
}

/* =========================================
   1. TOP MOTIVATION BAR (FIXED)
   ========================================= */
.top-bar-container {
    width: 100%;
    height: 32px; 
    background: linear-gradient(90deg, #f1c57a, #c69645);
    overflow: hidden; 
    position: relative;
    z-index: 200; 
    display: flex; /* Flexbox controls layout */
    align-items: center;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

.ticker-wrap {
    flex: 1; /* FIX 1: Force it to fill the width */
    overflow: hidden;
    position: relative;
    z-index: 5; /* FIX 2: Sit ABOVE the shimmer light */
}

.ticker-move {
    display: flex;
    align-items: center;
    white-space: nowrap;
    width: fit-content; /* Ensure container fits text */
    /* Speed: Adjust 40s to make it faster/slower */
    animation: ticker-scroll 40s linear infinite; 
}

.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: white; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}

/* Loop Logic: Moves exactly 50% left (because we duplicated the text in HTML) */
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } 
}


/* =========================================
   2. MODULAR SHIMMER (FIXED)
   ========================================= */
.shimmer-gold {
    position: relative;
    overflow: hidden; 
}

.shimmer-gold::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; 
    width: 100%; 
    height: 100%;
    
    /* The Light Effect */
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%
    );
    
    transform: skewX(-25deg);
    
    /* FIX 3: Ensure light is BEHIND the text (z-index 1 vs 5) */
    z-index: 1; 
    pointer-events: none;
    
    /* Animation settings */
    animation: shimmer-sweep 6s infinite;
}

@keyframes shimmer-sweep {
    0% { left: -150%; }
    40% { left: 150%; } /* Sweep across */
    100% { left: 150%; } /* Wait */
}

/* --- NOTIFICATIONS --- */
.notification-container {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background-color: #ef4444; /* Red for alert */
    border: 1px solid white;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* --- RESPONSIVE HEADER & NOTIFICATION CSS --- */

/* 1. NOTIFICATION DROPDOWN (Global Base) */
.notif-dropdown {
    position: absolute;
    width: 320px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: none; /* Hidden by default */
    z-index: 1000;
    transform-origin: top right;
    animation: scaleIn 0.2s ease;
}

.notif-dropdown.show {
    display: block;
}

/* 2. DESKTOP SPECIFIC FIX (Prevent overflow to right) */
/* Targets the ID used in desktop HTML */
#notif-dropdown-desktop {
    top: 140%;
    right: 0; /* Align perfectly with the bell button's right edge */
    /* If container is small, this ensures it anchors leftwards */
}

/* 3. MOBILE SPECIFIC POSITIONING */
/* Targets the ID used in mobile HTML */
#notif-dropdown-mobile {
    top: 130%; /* Slightly lower to clear header */
    right: 50%; /* Center relative to button */
    transform: translateX(50%); /* Center trick */
    /* Or if you want it aligned right: */
    /* right: -10px; transform: none; */
}

/* --- REST OF CSS (Standard) --- */
.notification-container {
    position: relative; /* Anchor for absolute positioning */
}

.notif-header {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.mark-read-btn {
    background: none; border: none; color: #c69645;
    font-size: 0.75rem; cursor: pointer; font-weight: 600;
}

.notif-list { max-height: 300px; overflow-y: auto; }

.notif-item {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex; gap: 12px;
    cursor: pointer; transition: background 0.2s;
}
.notif-item:hover { background: #f9fafb; }
.notif-item.unread { background: #fffbeb; }

.notif-title { font-weight: 600; font-size: 0.9rem; color: #1f2937; margin-bottom: 2px; }
.notif-msg { font-size: 0.8rem; color: #6b7280; line-height: 1.3; }
.notif-time { font-size: 0.7rem; color: #9ca3af; margin-top: 4px; }
.notif-empty { padding: 2rem; text-align: center; color: #9ca3af; font-size: 0.9rem; }

/* =========================================
   RESPONSIVE HEADER CSS
   ========================================= */

/* --- 1. DEFAULT STATE (Desktop > 1400px) --- */
.mobile-actions, .mobile-menu {
    display: none; /* Hide mobile elements by default */
}

/* --- 2. LAPTOP SCALING (992px - 1400px) --- */
@media (min-width: 992px) and (max-width: 1400px) {
    /* Scale down the entire header content container */
    .header-content {
        padding: 0 1rem;
        gap: 1rem; /* Smaller gap between logo/search/right */
    }

    /* Smaller Logo */
    .header-logo {
        height: 40px; 
    }

    /* Smaller Search Bar */
    .header-center {
        max-width: 350px;
    }
    .search-input {
        padding: 0.7rem 1rem 0.7rem 2.2rem;
        font-size: 0.9rem;
    }
    .search-icon {
        width: 16px; height: 16px; left: 10px;
    }

    /* Tighter Right Section */
    .header-right {
        gap: 0.8rem;
    }
    
    .btn-support {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }

    .profile-btn {
        width: 36px; height: 36px; /* Smaller avatar */
    }
    .avatar-initials {
        font-size: 0.9rem;
    }
    
    /* Slightly smaller social icons */
    .social-link svg {
        width: 18px; height: 18px;
    }
}
/* --- 3. MOBILE & TABLET (< 992px) --- */
@media (max-width: 992px) {
    
    /* 1. Reset Desktop Elements */
    .tab-navigation { display: none !important; }
    .desktop-only { display: none !important; }

    /* 2. Fix Giant Header Issue (Compact Mode) */
    .header-content {
        padding: 0 1rem;
        height: 60px; /* Force compact height */
    }

    /* 3. MOBILE CONTROLS BAR */
    .mobile-actions {
        display: flex;
        align-items: center;
        gap: 15px;
        /* Critical: This acts as the anchor point for the dropdown */
        position: relative; 
    }

    /* Remove relative positioning from the button wrapper itself */
    .notification-container {
        position: static; 
    }

    .hamburger-btn {
        background: none;
        border: none;
        cursor: pointer;
        color: #1f2937;
        padding: 5px;
    }

    /* --- MOBILE NOTIFICATION DROPDOWN FIX --- */
    #notif-dropdown-mobile {
        position: absolute;
        top: 120%; /* Push down slightly */
        
        /* THE FIX: Anchor to the right, remove the shift */
        right: -10px; 
        left: auto; 
        transform: none !important; /* Overwrite any previous centering logic */
        
        /* Sizing: 92% of screen width, but capped at 360px */
        width: 92vw; 
        max-width: 360px;
        
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.15);
        
        display: none;
        z-index: 1100;
        
        /* Ensure animation scales from the top-right corner */
        transform-origin: top right;
    }
    
    #notif-dropdown-mobile.show { display: block; }

    /* --- DRAWER (Menu) --- */
    .mobile-menu {
        display: block; 
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        
        max-height: 0;
        opacity: 0;
        overflow: hidden; 
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 900;
        padding: 0; 
    }

    .mobile-menu.open {
        /* Use 100dvh (Dynamic Viewport) to account for mobile address bars */
        max-height: calc(100dvh - 60px); 
        opacity: 1;
        padding: 1.5rem;
        /* Padding at bottom ensures Social Icons aren't cut off by screen edge */
        padding-bottom: 3rem; 
        overflow-y: auto; 
    }

    /* --- Mobile Menu Internals --- */
    .mobile-search { display: flex; margin-bottom: 1rem; }
    .mobile-search-input { flex: 1; padding: 0.7rem 1rem; border: 1px solid #e5e7eb; border-radius: 8px 0 0 8px; background: #f9fafb; outline: none; font-size: 1rem; }
    .mobile-search-btn { padding: 0 1rem; background: #c69645; border: none; border-radius: 0 8px 8px 0; color: white; font-size: 1.2rem; }

    .mobile-profile-info { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f3f4f6; }
    .mobile-user-details { display: flex; flex-direction: column; }
    .mobile-user-details .user-name { font-size: 0.95rem; color: #1f2937; }
    .mobile-user-details .user-email { font-size: 0.8rem; }

    .mobile-nav-links { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1.5rem; }
    .mobile-link { font-weight: 600; color: #4b5563; text-decoration: none; font-size: 1rem; padding: 8px 0; display: block; }
    .mobile-link:hover { color: #c69645; }
    .mobile-link.text-danger { color: #ef4444; }

    .mobile-socials { 
        display: flex; 
        gap: 2rem; 
        justify-content: center; 
        padding-top: 1.5rem; 
        border-top: 1px solid #f3f4f6; 
        padding-bottom: 1rem;
    }
}