/* =====================================================
   School Management System - Design System
   Premium, modern interface with smooth animations
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
    /* TA'ALEEM GROUP OF SCHOOLS Brand Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --secondary: #64748b;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --body-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .1);
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-warning: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
    --gradient-genius: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --transition: all .3s cubic-bezier(.4, 0, .2, 1);
}

/* ---- Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--gray-800);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ---- Login Page ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--gradient-genius);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: loginBg 20s linear infinite;
}

@keyframes loginBg {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.school-logo {
    margin-bottom: 1rem;
    position: relative;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
    transition: var(--transition);
}

.logo-img:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(37, 99, 235, 0.4);
}

/* Fallback CSS logo if image doesn't load */
.school-logo::before {
    content: 'GA';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    background: var(--gradient-primary);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--primary);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0.5rem 0 0.25rem;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.school-tagline {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0.25rem 0 0.5rem;
    font-style: italic;
}

.signin-text {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
}

/* Role Tabs */
.role-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.role-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: none;
    background: var(--white);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.role-tab i {
    font-size: 1.1rem;
}

.role-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.role-tab.active {
    background: var(--gradient-primary);
    color: var(--white);
}

/* ---- Form Controls ---- */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    padding: 0.6rem 0.9rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    outline: none;
}

.form-control-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-logo i {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-user {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar {
    font-size: 2rem;
    color: var(--primary-light);
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h6 {
    color: var(--white);
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
    color: var(--white);
    background: rgba(79, 70, 229, 0.3);
    border-left-color: var(--primary);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.nav-divider {
    padding: 0.5rem 1.5rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Top navbar (mobile) */
.top-navbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    z-index: 998;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.top-navbar .brand {
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    flex: 1;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.25rem;
}

.page-header p {
    color: var(--gray-500);
    margin: 0;
    font-size: 0.875rem;
}

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.1;
    transform: translate(20px, -20px);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.primary {
    border-left-color: var(--primary);
}

.stat-card.primary::after {
    background: var(--primary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.success::after {
    background: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.warning::after {
    background: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.danger::after {
    background: var(--danger);
}

.stat-card.secondary {
    border-left-color: var(--secondary);
}

.stat-card.secondary::after {
    background: var(--secondary);
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-card.primary .stat-icon {
    color: var(--primary);
}

.stat-card.success .stat-icon {
    color: var(--success);
}

.stat-card.warning .stat-icon {
    color: var(--warning);
}

.stat-card.danger .stat-icon {
    color: var(--danger);
}

.stat-card.secondary .stat-icon {
    color: var(--secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ---- Content Card ---- */
.content-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.content-card:hover {
    box-shadow: var(--shadow-md);
}

.content-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    background: transparent;
}

.content-card .card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.content-card .card-body {
    padding: 1.25rem;
}

/* ---- Tables ---- */
.table-modern {
    width: 100%;
    border-collapse: collapse;
}

.table-modern thead th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table-modern tbody tr:hover {
    background: rgba(79, 70, 229, 0.02);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Buttons ---- */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 10px;
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    background: var(--gradient-primary);
}

.btn-success {
    background: var(--gradient-success);
    border: none;
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
    background: var(--gradient-success);
}

.btn-warning {
    background: var(--gradient-warning);
    border: none;
    color: var(--white);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-danger {
    background: var(--gradient-danger);
    border: none;
    color: var(--white);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-modern {
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-outline-primary {
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-outline-danger {
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-outline-info {
    border: 1px solid #0ea5e9;
    color: #0ea5e9;
}

.btn-outline-info:hover {
    background: #0ea5e9;
    color: var(--white);
}

.btn-outline-secondary {
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline-secondary:hover {
    background: var(--gray-600);
    color: var(--white);
}

/* ---- Badges ---- */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: 6px;
}

/* ---- Animations ---- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Notification Items ---- */
.notification-item {
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: rgba(79, 70, 229, 0.05) !important;
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .top-navbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding-top: 70px;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 1.5rem;
    }

    .role-tabs {
        flex-wrap: wrap;
    }

    .role-tab {
        flex: 1 1 45%;
    }

    .stat-value {
        font-size: 1.4rem;
    }
}

/* ---- Scrollbar ---- */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* ---- Print ---- */
@media print {

    .sidebar,
    .top-navbar,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}