/* ============================================
   EduManager Pro - School Management System
   Custom Theme - Indian School Friendly
   ============================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1342a8;
    --primary-light: #e8eefb;
    --secondary: #059669;
    --accent: #f59e0b;
    --danger: #dc2626;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }
body {
    font-family: 'Nunito', sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
}

/* ============= LOGIN PAGE ============= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a56db 0%, #7c3aed 50%, #059669 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -200px; right: -100px;
}
.login-wrapper::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    bottom: -100px; left: -50px;
}
.login-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}
.login-logo {
    width: 70px; height: 70px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
}
.login-card h2 {
    font-weight: 800;
    color: var(--gray-900);
    text-align: center;
    margin-bottom: 0.25rem;
}
.login-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.login-card .form-control {
    border-radius: var(--radius-sm);
    border: 2px solid var(--gray-200);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.15);
}
.login-card .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--primary);
    border: none;
    transition: all 0.3s;
}
.login-card .btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(26,86,219,0.3);
}
.demo-creds {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1.25rem;
    font-size: 0.82rem;
    border: 1px dashed var(--gray-300);
}
.demo-creds strong { color: var(--primary); }

/* ============= LAYOUT ============= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.sidebar-brand h5 {
    margin: 0;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.2;
}
.sidebar-brand small {
    opacity: 0.5;
    font-size: 0.7rem;
}
.sidebar-nav { padding: 0.75rem 0; }
.nav-section-title {
    padding: 0.75rem 1.5rem 0.4rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.4;
    font-weight: 700;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}
.sidebar-nav a.active {
    background: rgba(26,86,219,0.2);
    color: white;
    border-left-color: var(--primary);
}
.sidebar-nav a i { font-size: 1.1rem; width: 22px; text-align: center; }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
}

/* Top Bar */
.topbar {
    background: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--gray-900);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-50);
    padding: 0.4rem 0.75rem 0.4rem 0.4rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}
.user-avatar {
    width: 32px; height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
}
.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* Page Content */
.page-content { padding: 1.5rem; }

/* ============= CARDS ============= */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin: 0.5rem 0 0.2rem;
}
.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--gray-500);
    font-weight: 600;
}
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

/* ============= CONTENT CARDS ============= */
.content-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}
.content-card .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}
.content-card .card-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
}
.content-card .card-body { padding: 1.25rem; }

/* ============= TABLE ============= */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-modern thead th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.table-modern tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.table-modern tbody tr:hover {
    background: var(--gray-50);
}

/* ============= BADGES ============= */
.badge-status {
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.badge-paid { background: #d1fae5; color: #059669; }
.badge-paid::before { background: #059669; }
.badge-pending { background: #fee2e2; color: #dc2626; }
.badge-pending::before { background: #dc2626; }
.badge-partial { background: #fef3c7; color: #d97706; }
.badge-partial::before { background: #d97706; }
.badge-advance { background: #dbeafe; color: #2563eb; }
.badge-advance::before { background: #2563eb; }

/* ============= BUTTONS ============= */
.btn-modern {
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.55rem 1.25rem;
    transition: all 0.25s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-blue { background: var(--primary); color: white; }
.btn-blue:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); }
.btn-green { background: var(--secondary); color: white; }
.btn-green:hover { background: #047857; color: white; transform: translateY(-1px); }
.btn-amber { background: var(--accent); color: white; }
.btn-amber:hover { background: #d97706; color: white; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-200);
    color: var(--gray-700);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.btn-sm-icon {
    width: 34px; height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-500);
    transition: all 0.2s;
    cursor: pointer;
}
.btn-sm-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ============= FORMS ============= */
.form-modern .form-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--gray-700);
    margin-bottom: 0.3rem;
}
.form-modern .form-control,
.form-modern .form-select {
    border-radius: var(--radius-sm);
    border: 2px solid var(--gray-200);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.form-modern .form-control:focus,
.form-modern .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* ============= RECEIPT ============= */
.receipt-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.receipt-header {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    padding: 1.25rem;
    text-align: center;
}
.receipt-header h3 { margin: 0 0 0.25rem; font-weight: 800; }
.receipt-body { padding: 1.25rem; }
.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--gray-200);
}
.receipt-total {
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
}

/* ============= RESPONSIVE ============= */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .btn-sidebar-toggle {
        display: block;
    }
    .page-content {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}
@media (max-width: 575.98px) {
    .login-card {
        padding: 1.5rem;
    }
    .topbar {
        padding: 0.6rem 1rem;
    }
    .topbar-title {
        font-size: 0.95rem;
    }
    .table-modern {
        font-size: 0.82rem;
    }
    .table-modern thead th,
    .table-modern tbody td {
        padding: 0.5rem 0.6rem;
    }
}

/* ============= MISC ============= */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}
.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}
.animate-number {
    transition: all 0.5s ease;
}
.quick-action-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    border: 2px solid var(--gray-200);
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: var(--gray-700);
    display: block;
}
.quick-action-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.quick-action-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}
.quick-action-card span {
    font-weight: 700;
    font-size: 0.85rem;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Print */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin: 0; }
    .page-content { padding: 0; }
}
