:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
    color: #334155;
    overflow-x: hidden;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.login-card .logo p {
    color: #94a3b8;
    font-size: 14px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.sidebar-brand small {
    font-size: 11px;
    color: #94a3b8;
    display: block;
}

.sidebar-nav {
    padding: 12px 0;
}

.sidebar-nav .nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 12px 20px 6px;
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(79,70,229,0.15);
    color: #818cf8;
    border-left-color: var(--primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: left 0.3s ease;
}

.main-header .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    padding: 8px;
}

.main-header .page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-actions .admin-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
}

.header-actions .admin-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-area {
    padding: 24px;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-card .stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-card .stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-card .stat-icon.orange { background: #fff7ed; color: #f59e0b; }
.stat-card .stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-card .stat-icon.purple { background: #faf5ff; color: #a855f7; }
.stat-card .stat-icon.cyan { background: #ecfeff; color: #06b6d4; }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Cards */
.app-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.app-card .card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.app-card .card-header-custom h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.app-card .card-body-custom {
    padding: 20px;
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom thead th {
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: #f8fafc;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge-active { background: #dcfce7; color: #16a34a; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-paid { background: #dcfce7; color: #16a34a; }
.badge-partial { background: #dbeafe; color: #2563eb; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* Buttons */
.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-sm-custom {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

/* Forms */
.form-group-custom {
    margin-bottom: 16px;
}

.form-group-custom label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* Modals */
.modal-custom .modal-content {
    border: none;
    border-radius: 12px;
}

.modal-custom .modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
}

.modal-custom .modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-custom .modal-body {
    padding: 20px;
}

.modal-custom .modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-header {
        left: 0;
    }

    .main-header .menu-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .content-area {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .main-header .page-title {
        font-size: 15px;
    }
}

/* Print Styles */
@media print {
    .sidebar, .main-header, .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding-top: 0;
    }

    .app-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Attendance cells */
.attendance-present { color: #16a34a; font-weight: 600; }
.attendance-absent { color: #dc2626; font-weight: 600; }
.attendance-late { color: #d97706; font-weight: 600; }

/* Student photo */
.student-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.student-photo-large {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

/* Day selection checkboxes */
.day-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.day-chip {
    padding: 6px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.day-chip:hover {
    border-color: var(--primary-light);
}

.day-chip.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Quick presets for days */
.day-preset {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin: 4px 4px 4px 0;
    transition: all 0.2s;
}

.day-preset:hover {
    background: var(--primary);
    color: #fff;
}

/* Certificate */
.certificate-wrapper {
    width: 800px;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    border: 8px double var(--primary);
    padding: 40px;
    text-align: center;
    position: relative;
}

.certificate-wrapper h1 {
    font-size: 36px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 5px;
}

.certificate-wrapper h3 {
    font-size: 18px;
    color: #64748b;
    font-weight: 400;
    margin-bottom: 30px;
}

.certificate-wrapper .cert-body {
    font-size: 16px;
    line-height: 2;
    color: #334155;
    margin: 30px 0;
}

.certificate-wrapper .cert-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    border-bottom: 2px solid var(--primary);
    display: inline-block;
    padding: 0 20px;
}

/* Fee receipt */
.receipt-wrapper {
    max-width: 400px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border: 1px dashed #ccc;
    font-size: 13px;
}

.receipt-wrapper .receipt-header {
    text-align: center;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.receipt-wrapper .receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.receipt-wrapper .receipt-total {
    border-top: 1px dashed #ccc;
    margin-top: 12px;
    padding-top: 12px;
    font-weight: 700;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 14px;
}

/* 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: 4px;
}

/* Toast / Alert */
.alert-toast {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Checkbox days styled */
.form-check-days {
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
}

.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
