/* =============================================
   ICSM Franchise Management System - Main CSS
   ============================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #7c3aed;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #0f172a;
    --sidebar-width: 270px;
    --topnav-height: 64px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --font: 'Plus Jakarta Sans', sans-serif;
    --font-alt: 'Space Grotesk', sans-serif;
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-logo { display: flex; align-items: center; gap: 12px; }

.brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-alt);
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 10px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-close { background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; }

.sidebar-centre {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin: 12px 12px 0;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.07);
}

.centre-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px;
    flex-shrink: 0;
}

.centre-name { font-size: 12px; font-weight: 600; color: #e2e8f0; line-height: 1.2; }
.centre-code { font-size: 11px; color: #64748b; margin-top: 2px; }

.sidebar-wallet {
    margin: 10px 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(37,99,235,0.2), rgba(124,58,237,0.2));
    border-radius: var(--radius);
    border: 1px solid rgba(37,99,235,0.3);
}

.wallet-label { font-size: 11px; color: #64748b; margin-bottom: 4px; }

.wallet-amount {
    font-family: var(--font-alt);
    font-size: 20px;
    font-weight: 700;
    color: #34d399;
    line-height: 1;
}

.wallet-recharge {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    color: #60a5fa;
    text-decoration: none;
    background: rgba(96,165,250,0.15);
    padding: 3px 8px;
    border-radius: 20px;
    transition: var(--transition);
}

.wallet-recharge:hover { background: rgba(96,165,250,0.3); color: #93c5fd; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: #1e293b transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 2px; }

.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #334155;
    font-weight: 600;
    padding: 14px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.nav-item:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }

.nav-item.active {
    background: linear-gradient(135deg, rgba(37,99,235,0.25), rgba(124,58,237,0.15));
    color: #60a5fa;
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

/* Nav Group */
.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    user-select: none;
}

.nav-group-toggle:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.nav-group-toggle i:first-child { width: 18px; text-align: center; font-size: 14px; }
.nav-group-toggle span { flex: 1; }
.nav-arrow { font-size: 10px !important; transition: transform 0.2s; }
.nav-group-toggle.open .nav-arrow { transform: rotate(90deg); }

.nav-submenu {
    display: none;
    padding-left: 20px;
    margin-bottom: 4px;
}
.nav-submenu.show { display: block; }

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: #64748b;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    transition: var(--transition);
    margin-bottom: 1px;
    border-left: 2px solid transparent;
}

.nav-sub-item i { font-size: 12px; }
.nav-sub-item:hover { color: #94a3b8; background: rgba(255,255,255,0.04); border-left-color: #475569; }
.nav-sub-item.active { color: #60a5fa; border-left-color: var(--primary); background: rgba(37,99,235,0.1); }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #ef4444;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
}
.sidebar-logout:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* ========== MAIN WRAPPER ========== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

/* ========== TOPNAV ========== */
.topnav {
    height: var(--topnav-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.topnav-left { display: flex; align-items: center; gap: 16px; }
.topnav-right { display: flex; align-items: center; gap: 8px; }

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.sidebar-toggle:hover { background: var(--body-bg); color: var(--text-primary); }

.page-breadcrumb { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.topnav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--body-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    width: 220px;
    transition: var(--transition);
}

.topnav-search:focus-within { border-color: var(--primary); width: 280px; }
.topnav-search i { color: var(--text-muted); font-size: 13px; }
.topnav-search input { background: none; border: none; outline: none; font-size: 13px; width: 100%; color: var(--text-primary); }

.topnav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    transition: var(--transition);
}
.topnav-btn:hover { background: var(--body-bg); color: var(--text-primary); }

.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    width: 18px; height: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    transition: var(--transition);
}
.topnav-user:hover { background: var(--body-bg); }

.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.user-name { font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-muted); }

/* ========== NOTIFICATIONS DROPDOWN ========== */
.notif-dropdown { width: 300px; padding: 0; border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius); }
.notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px !important; }
.notif-item:hover { background: var(--body-bg); }
.notif-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.notif-icon.warning { background: #fef3c7; color: #d97706; }
.notif-icon.info { background: #e0f2fe; color: #0891b2; }
.notif-icon.success { background: #d1fae5; color: #059669; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.notif-time { font-size: 11px; color: var(--text-muted); }

/* ========== FLASH ========== */
.flash-container { padding: 0 24px; margin-top: 16px; }

/* ========== PAGE CONTENT ========== */
.page-content { flex: 1; padding: 24px; }

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-value {
    font-family: var(--font-alt);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    display: flex; align-items: center; gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

.stat-card .bg-decoration {
    position: absolute;
    right: -20px; top: -20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    opacity: 0.08;
}

/* ========== CARDS ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
    margin: 0;
}

.card-body { padding: 20px; }

/* ========== TABLES ========== */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h5 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex; align-items: center; gap: 8px;
}

.table-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table { margin: 0; }
.table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 13px 16px;
    font-size: 13.5px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-active, .status-paid, .status-pass, .status-generated { background: #d1fae5; color: #059669; }
.status-inactive, .status-dropped { background: #fee2e2; color: #dc2626; }
.status-pending { background: #fef3c7; color: #d97706; }
.status-new { background: #dbeafe; color: #2563eb; }
.status-contacted { background: #e0f2fe; color: #0891b2; }
.status-converted { background: #d1fae5; color: #059669; }
.status-closed { background: #f1f5f9; color: #64748b; }
.status-completed { background: #ede9fe; color: #7c3aed; }

/* ========== BUTTONS ========== */
.btn { font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); padding: 8px 16px; transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }

/* ========== FORMS ========== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 9px 12px;
    font-size: 13.5px;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-text { font-size: 12px; }

/* ========== WALLET CARD ========== */
.wallet-card {
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    color: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.wallet-card::before {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 180px; height: 180px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

.wallet-card::after {
    content: '';
    position: absolute;
    right: 60px; bottom: -60px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

/* ========== MODAL ========== */
.modal-content { border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 20px; }

/* ========== SIDEBAR OVERLAY ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show { display: block; }
    .main-wrapper { margin-left: 0; }
}

/* ========== ACTIVITY ITEM ========== */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ========== SEARCH BOX ========== */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    padding-left: 36px;
    border-radius: 20px;
    background: var(--body-bg);
    border: 1px solid var(--border);
    font-size: 13px;
    width: 220px;
}

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-title { font-size: 22px; font-weight: 800; color: var(--text-primary); margin: 0; }
.page-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ========== EXAM MARKS ========== */
.marks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.marks-input-group .form-label { font-size: 12px; }

.percentage-display {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.percentage-value {
    font-family: var(--font-alt);
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
}

.percentage-grade { font-size: 14px; opacity: 0.9; margin-top: 4px; }

/* ========== CERTIFICATE CHECKBOX ========== */
.student-cert-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.student-cert-card:hover { border-color: var(--primary); background: var(--primary-light); }
.student-cert-card.selected { border-color: var(--primary); background: var(--primary-light); }

/* ========== TIMELINE ========== */
.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--border); }

.timeline-item { display: flex; gap: 16px; margin-bottom: 20px; position: relative; }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; z-index: 1; border: 2px solid var(--card-bg); }
.timeline-content { flex: 1; padding-bottom: 10px; }
.timeline-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.timeline-time { font-size: 11px; color: var(--text-muted); }

/* ========== LOGIN PAGE ========== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(37,99,235,0.15) 0%, transparent 50%),
                      radial-gradient(circle at 75% 75%, rgba(124,58,237,0.15) 0%, transparent 50%);
}

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    width: 420px;
    max-width: 100%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

/* ========== QUICK ACCESS ========== */
.quick-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.quick-card:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--primary); }

.quick-card-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.quick-card-label { font-size: 12px; font-weight: 600; }

/* ========== PROGRESS ========== */
.progress { height: 6px; border-radius: 3px; }

/* ========== AVATAR ========== */
.student-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 700;
}

/* ========== PRINT ========== */
@media print {
    .sidebar, .topnav, .btn, .no-print { display: none !important; }
    .main-wrapper { margin-left: 0; }
    .page-content { padding: 0; }
}

/* ========== ANIMATIONS ========== */
.fade-in { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--body-bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
