/* main.css - COMPLETE FIXED VERSION */

/* Base imports */
@import url('base.css');
@import url('layout.css');
@import url('components.css');
@import url('messages.css');
@import url('calendar.css'); /* Fixed spelling */
@import url('exams.css');
@import url('courses.css');
@import url('dashboard.css');
@import url('resources.css');
@import url('reader.css');
@import url('nurseiq.css');
@import url('loading.css');
@import url('profile.css');
@import url('attendance.css');
@import url('responsive.css');

/* ========== CORE STYLES ========== */
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1a202c;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ========== HEADER STYLES ========== */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    z-index: 1000;
}

/* Left: Logo & Title */
.header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 8px;
}

.header-titles {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.main-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
    margin: 2px 0 0 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right: User Profile & Controls */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Mobile Menu Toggle - FIXED: Shows on mobile, hides on desktop */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.profile-avatar.round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.profile-role {
    font-size: 0.75rem;
    opacity: 0.8;
}

.dropdown-icon {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform 0.2s;
}

.user-profile-dropdown:hover .dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu - FIXED: Hidden by default, shows on click */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: #1e1b4b; /* Dark purple */
    min-width: 200px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    display: none; /* HIDDEN BY DEFAULT */
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.dropdown-menu.show {
    display: block; /* Shows when .show class added */
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: rgba(124, 58, 237, 0.3);
    color: white;
    padding-left: 20px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* Current Time Display */
.current-time {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
}

.current-time i {
    font-size: 0.8rem;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ========== SIDEBAR STYLES - FIXED: Solid background, no transparency ========== */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%); /* SOLID gradient */
    color: white;
    overflow-y: auto;
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.35s ease;
    z-index: 1000; /* HIGHER z-index */
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    transform: translateX(0);
}

/* Sidebar header */
.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-header img {
    width: 70px;
    height: 70px;
    margin-bottom: 12px;
    border-radius: 10px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-header h2 {
    color: white;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Navigation */
.nav {
    list-style: none;
    padding: 15px 0;
    margin: 0;
}

.nav li {
    margin: 0;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.nav a:hover {
    background: rgba(124, 58, 237, 0.2);
    color: white;
    border-left-color: rgba(139, 92, 246, 0.5);
}

.nav a.active {
    background: rgba(124, 58, 237, 0.3);
    color: white;
    border-left-color: #8b5cf6;
    font-weight: 600;
}

.nav a i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* NurseIQ navigation item */
.nurseiq-nav {
    position: relative;
    background: rgba(124, 58, 237, 0.1);
    border-left-color: #8b5cf6 !important;
}

.nav-icon-wrapper {
    position: relative;
    display: inline-block;
}

.nav-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Logout button in sidebar */
.logout {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.logout a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.logout a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ========== LAYOUT ADJUSTMENTS ========== */
.container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    margin-top: 70px;
}

/* Overlay - FIXED: Covers entire screen below header */
.overlay {
    position: fixed;
    inset: 70px 0 0 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* Main Content - FIXED: Lower z-index than sidebar */
.main {
    flex: 1;
    width: 100%;
    padding: 20px;
    background-color: #f8fafc;
    position: relative;
    z-index: 1; /* Lower than sidebar */
}

/* ========== LOADING SCREEN ========== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

/* ========== TAB SYSTEM ========== */
.tab-content {
    display: none;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ========== RESPONSIVE STYLES ========== */

/* Mobile styles */
@media (max-width: 768px) {
    .main-header {
        padding: 0 1rem;
        height: 60px;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .header-logo {
        width: 40px;
        height: 40px;
    }
    
    .main-title {
        font-size: 1.2rem;
    }
    
    .subtitle {
        font-size: 0.65rem;
    }
    
    /* Hide some elements on mobile */
    .current-time,
    .header-actions {
        display: none !important;
    }
    
    .profile-name {
        max-width: 80px;
    }
    
    /* Adjust layout for mobile */
    .container {
        margin-top: 60px;
    }
    
    .sidebar {
        top: 60px;
        width: 250px;
        z-index: 1000;
    }
    
    .overlay {
        top: 60px;
        z-index: 999;
    }
    
    .main {
        margin-left: 0;
        width: 100%;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .main-header {
        padding: 0 0.75rem;
    }
    
    /* Hide titles on very small screens */
    .header-titles {
        display: none;
    }
    
    .logo-container {
        gap: 8px;
    }
    
    .profile-trigger {
        padding: 4px 8px;
    }
    
    /* Hide profile info text on small screens */
    .profile-info {
        display: none;
    }
    
    .profile-avatar.round {
        width: 35px;
        height: 35px;
    }
    
    .sidebar {
        width: 85vw;
        max-width: 300px;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 280px;
        width: calc(100% - 280px);
    }
    
    /* Hide overlay on desktop */
    .overlay {
        display: none !important;
    }
    
    /* Hide mobile menu toggle on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ========== UTILITY CLASSES ========== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

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

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== TOAST NOTIFICATION ========== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4C1D95;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    max-width: 400px;
    word-wrap: break-word;
}

.toast.success {
    background: #10B981;
}

.toast.error {
    background: #EF4444;
}

.toast.warning {
    background: #F59E0B;
}

/* ========== OFFLINE INDICATOR ========== */
.offline-indicator {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: #EF4444;
    color: white;
    text-align: center;
    padding: 10px;
    z-index: 999;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ========== FOOTER ========== */
.app-footer {
    margin-top: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-bottom {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}
/* In main.css, add at the end: */

/* Force desktop for any screen > 768px */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
        position: fixed !important;
    }
    
    .main {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
    }
    
    .overlay,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .current-time,
    .header-actions,
    .profile-info,
    .header-titles {
        display: flex !important;
    }
}
/* Loading screen styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-screen.app-splash {
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
}

#loading-screen.loading-exit {
    opacity: 0;
    visibility: hidden;
}

.loading-container {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 2rem;
}

.welcome-text h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.loading-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.progress-fill {
    height: 100%;
    background: white;
    width: 0%;
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
    min-height: 1.2em;
}

.status-steps {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
    gap: 0.5rem;
}

.status-step {
    flex: 1;
    font-size: 0.8rem;
    opacity: 0.5;
    text-align: center;
}

.status-step.completed {
    opacity: 1;
    color: #10B981;
}

.fun-fact {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-version {
    margin-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.6;
}
/* SIMPLE DROPDOWN - No flashing, no conflicts */
.simple-dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1001;
    padding: 8px 0;
}

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

.simple-menu-item {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    cursor: pointer;
}

.simple-menu-item:hover {
    background: #f9fafb;
}

.simple-menu-item:last-child {
    border-bottom: none;
    color: #ef4444;
}

.simple-menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}
