/* ==========================================================
   SHRI ACADEMY & LIBRARY - MODERN DESIGN SYSTEM & UI THEME
   ========================================================== */

:root {
    --font-main: 'Plus Jakarta Sans', 'Noto Sans Devanagari', 'Nirmala UI', system-ui, -apple-system, sans-serif;
    
    /* Core Brand Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    
    --secondary: #0ea5e9;
    --secondary-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    
    --purple: #8b5cf6;
    --purple-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);

    --pink: #ec4899;
    --pink-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);

    /* Neutral & Surfaces */
    --bg-surface: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-subtle: #edf2f7;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Elevation Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    
    /* Layout Sizes */
    --sidebar-width: 270px;
    --topbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* ==========================================================
   APP LAYOUT & STRUCTURE
   ========================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* SIDEBAR */
.app-sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: contain;
    background: #fff;
    padding: 2px;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-text .title {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-brand-text .subtitle {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.85rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.nav-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.8px;
    padding: 0.75rem 0.85rem 0.35rem;
    margin-top: 0.5rem;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    color: #64748b;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-link:hover i {
    color: #38bdf8;
    transform: scale(1.1);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.nav-link.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: #38bdf8;
    font-weight: 600;
    text-transform: capitalize;
}

/* MAIN CONTENT AREA */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    box-sizing: border-box;
    transition: margin-left 0.3s ease;
}

/* TOPBAR */
.app-topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-xs);
    width: 100%;
    box-sizing: border-box;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

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

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* PAGE CONTENT WRAPPER */
.app-content {
    flex: 1;
    padding: 1.75rem 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================
   COLORFUL WIDGETS & STAT CARDS
   ========================================================== */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.widget-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.widget-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.widget-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.widget-card.widget-primary::before { background: var(--primary-gradient); }
.widget-card.widget-secondary::before { background: var(--secondary-gradient); }
.widget-card.widget-success::before { background: var(--success-gradient); }
.widget-card.widget-warning::before { background: var(--warning-gradient); }
.widget-card.widget-danger::before { background: var(--danger-gradient); }
.widget-card.widget-purple::before { background: var(--purple-gradient); }
.widget-card.widget-pink::before { background: var(--pink-gradient); }

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.widget-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.widget-primary .widget-icon { background: var(--primary-gradient); }
.widget-secondary .widget-icon { background: var(--secondary-gradient); }
.widget-success .widget-icon { background: var(--success-gradient); }
.widget-warning .widget-icon { background: var(--warning-gradient); }
.widget-danger .widget-icon { background: var(--danger-gradient); }
.widget-purple .widget-icon { background: var(--purple-gradient); }
.widget-pink .widget-icon { background: var(--pink-gradient); }

.widget-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.widget-subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ==========================================================
   CARDS & PANELS
   ========================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================
   BUTTONS & BADGES
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.3;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger-gradient);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
}

.btn-warning {
    background: var(--warning-gradient);
    color: #ffffff;
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.badge-primary { background: #e0e7ff; color: #4338ca; }
.badge-secondary { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-pink { background: #fce7f3; color: #be185d; }
.badge-dark { background: #334155; color: #f8fafc; }

/* ==========================================================
   FORMS & INPUTS
   ========================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: var(--danger);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.65rem 0.95rem;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

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

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* STREAM SELECTION CARDS (Admission Form Special) */
.stream-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stream-card-checkbox {
    display: none;
}

.stream-card-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.stream-card-label:hover {
    border-color: #a5b4fc;
    background: #faf5ff;
}

.stream-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: #f1f5f9;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.stream-card-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.stream-card-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.stream-card-checkbox:checked + .stream-card-label {
    border-color: var(--primary);
    background: #f5f3ff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.stream-card-checkbox:checked + .stream-card-label .stream-card-icon {
    background: var(--primary-gradient);
    color: #ffffff;
}

/* ==========================================================
   DATA TABLES
   ========================================================== */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.85rem 1rem;
    border-bottom: 1.5px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* ==========================================================
   ALERTS & FLASH MESSAGES
   ========================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

/* ==========================================================
   MODAL COMPONENT
   ========================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalSlide 0.25s ease-out;
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ==========================================================
   STUDENT PROFILE STYLES
   ========================================================== */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.profile-avatar-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    background: #f1f5f9;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================
   RESPONSIVE DESIGN (Mobile & Tablet)
   ========================================================== */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        display: block;
    }

    .app-content {
        padding: 1.25rem;
    }
}

@media (max-width: 640px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
    
    .stream-toggle-grid {
        grid-template-columns: 1fr;
    }
    
    .app-topbar {
        padding: 0 1rem;
    }
}

/* ==========================================================
   PRINT / PDF STYLES (Clean Reporting Layout)
   ========================================================== */
@media print {
    .app-sidebar,
    .app-topbar,
    .sidebar-toggle-btn,
    .btn,
    .card-footer,
    form,
    .pagination,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_paginate,
    .dataTables_info,
    .hide-in-print {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 10.5pt !important;
    }

    .app-main {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
        margin-bottom: 1rem !important;
        page-break-inside: avoid;
    }

    .table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .table th, .table td {
        border: 1px solid #cbd5e1 !important;
        padding: 5px 8px !important;
        font-size: 9pt !important;
        color: #000000 !important;
    }

    .badge {
        border: 1px solid #64748b !important;
        background: transparent !important;
        color: #000000 !important;
        padding: 2px 6px !important;
    }
}

