/* ============================================
   COMPONENTS.CSS - Webild SaaS Theme Components
   Premium UI Component Library
   ============================================ */


/* === Navigation Header - Webild Style === */

.nav-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    padding: var(--space-4) 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-header.scrolled {
    background: rgba(3, 7, 18, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .nav-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.nav-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: var(--space-8);
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    transition: color 0.2s ease;
    padding: var(--space-2) 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}


/* === Theme Toggle Button - Webild === */

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-400);
    transform: scale(1.05);
}

.theme-toggle .sun {
    display: none;
}

.theme-toggle .moon {
    display: block;
}

[data-theme="light"] .theme-toggle .sun {
    display: block;
}

[data-theme="light"] .theme-toggle .moon {
    display: none;
}


/* === Card Header - Premium === */

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.card-header i {
    font-size: 1.4rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-header h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}


/* === Page Header - Webild Style === */

.page-header {
    text-align: center;
    padding: 140px 0 80px;
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient( ellipse at center top, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.page-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: var(--font-black);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
    position: relative;
}

.page-title-gradient {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: var(--text-lg);
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
}


/* === Toast Notifications - Premium === */

.toast-container {
    position: fixed;
    top: 100px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-weight: var(--font-medium);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.4s ease 2.7s forwards;
    box-shadow: var(--shadow-xl);
    max-width: 400px;
}

.toast i {
    font-size: 1.25rem;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), var(--glass-bg));
}

.toast.success i {
    color: var(--success-500);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), var(--glass-bg));
}

.toast.error i {
    color: var(--danger-500);
}

.toast.warning {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), var(--glass-bg));
}

.toast.warning i {
    color: var(--warning-500);
}

.toast.info {
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), var(--glass-bg));
}

.toast.info i {
    color: var(--secondary-500);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}


/* === Stats Grid - Webild Style === */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-6);
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 20px 50px rgba(139, 92, 246, 0.2);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: var(--font-extrabold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--space-2);
    font-weight: var(--font-medium);
}


/* === Student Card - Webild Style === */

.student-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.student-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(139, 92, 246, 0.15);
}

.student-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-bottom: 1px solid var(--glass-border);
}

.student-info {
    padding: var(--space-5);
}

.student-name {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.student-class {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-3);
}

.student-subject {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-full);
    color: var(--primary-400);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}


/* === Loader / Spinner === */

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}


/* === Avatar === */

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-cyan);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.avatar-lg {
    width: 150px;
    height: 150px;
}

.avatar-sm {
    width: 50px;
    height: 50px;
}


/* === Empty State === */

.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-desc {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}


/* === Tabs === */

.tabs {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: var(--space-lg);
}

.tab {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}


/* === Modal === */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    z-index: var(--z-modal);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 800;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}


/* === Footer === */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-3xl) 0;
    margin-top: var(--space-3xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-xl);
}

.footer-section h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.footer-section a {
    display: block;
    color: var(--text-muted);
    padding: var(--space-xs) 0;
}

.footer-section a:hover {
    color: var(--accent-cyan);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-xl);
    margin-top: var(--space-xl);
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
}


/* === Mobile Navigation === */

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-link {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.mobile-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    transition: width 0.3s ease;
}

.mobile-nav-link:hover::after,
.mobile-nav-link.active::after {
    width: 100%;
}


/* === Responsive Media Queries === */

@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Hide desktop links */
    }
    .mobile-menu-btn {
        display: block;
        /* Show hamburger */
    }
    .page-title {
        font-size: 2.5rem;
    }
    .container {
        padding: 0 var(--space-md);
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        /* 2 columns on mobile */
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    .card-header h2 {
        font-size: 1.5rem;
    }
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .stats-section .container {
        padding: 0 10px;
    }
    .stat-card {
        padding: 20px 10px;
    }
    .stat-card-number {
        font-size: 2.5rem !important;
    }
    .stat-card-icon {
        font-size: 2.5rem !important;
    }
    .actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 15px !important;
        padding: 0 20px;
    }
    .hero .btn {
        width: 100% !important;
        justify-content: center;
    }
    .page-header {
        padding: 80px 0 30px;
    }
    /* Fix overlapping/cutoff content */
    .container {
        padding: 0 16px;
        overflow-x: hidden;
        /* Prevent horizontal scroll causing 'broken' look */
    }
    .glass-card,
    .card {
        padding: 20px !important;
        border-radius: 20px;
    }
    h1 {
        font-size: 2rem !important;
    }
    h2 {
        font-size: 1.5rem !important;
    }
    /* Portfolio/Card tweaks */
    .portfolio-item,
    .project-card {
        min-width: 0;
        /* Allow flex shrinking */
    }
    /* === Mobile Bottom Navigation === */
    .mobile-bottom-nav {
        display: flex;
        /* Show flex on mobile */
    }
    /* Add padding to body to prevent content being hidden behind nav */
    body {
        padding-bottom: 80px;
    }
}


/* Base styles for bottom nav (hidden by default, shown by media query above) */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(10, 10, 25, 0.9);
    /* Dark background */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    z-index: 9999;
    /* Highest priority */
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 10px);
    /* Handle iPhone notches */
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 4px;
    flex: 1;
    height: 100%;
    transition: all 0.3s ease;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

.bottom-nav-item.active {
    color: var(--accent-cyan);
    /* Active color */
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.bottom-nav-item:active {
    transform: scale(0.95);
}