/* Bright, Fresh, and Modern Light Theme CSS System for Sistem Portofolio Santri Terpadu - QSBS Al-Kautsar 561 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Action Colors */
    --primary: #6366f1;       /* Indigo for buttons & main actions */
    --primary-hover: #4f46e5;
    --sky-blue: #3b82f6;     /* Sky Blue for Academic */
    --emerald: #10b981;      /* Emerald Green for Quran & Worship */
    --emerald-hover: #059669;
    --amber-gold: #f59e0b;   /* Gold Accent */
    --rose-danger: #ef4444;   /* Soft Danger */

    --border-color: #e2e8f0;
    --border-radius: 16px;
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 12px 28px -4px rgba(99, 102, 241, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Wrapper Layout */
.app-wrapper {
    display: flex;
    width: 100%;
}

/* Glassmorphism Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.school-logo-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.sidebar-sub {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    flex: 1;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 12px 12px 6px 12px;
    font-weight: 800;
}

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

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.menu-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-link:hover, .menu-link.active {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
}

.menu-link.active i {
    color: var(--primary);
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(248, 250, 252, 0.7);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

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

.user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.73rem;
    color: var(--primary);
    font-weight: 600;
}

/* Main Content Layout */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 32px 40px;
    min-height: 100vh;
}

/* Navbar Top */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title-box h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.page-title-box p {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Cards & Glassmorphism Surfaces */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 26px;
    margin-bottom: 26px;
    box-shadow: var(--shadow-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-panel:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

/* Student Profile Header Banner (Bright & Modern) */
.student-profile-card {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 32px;
    display: flex;
    gap: 28px;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.08);
}

.student-profile-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}

.student-avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 24px;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.3);
}

.student-details {
    flex: 1;
}

.student-name-header {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Level Badges: SMP in Gold, SMA in Blue */
.level-badge {
    font-size: 0.78rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.level-smp {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.level-sma {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.student-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.meta-item {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.meta-item strong {
    color: var(--text-main);
    font-weight: 700;
}

/* Soft Pastel Accents & Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Soft Pastel Trend Badges */
.badge-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* Worship Heatmap Soft Badges */
.badge-worship-excellent { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-worship-good { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-worship-attention { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* Custom Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
}

.custom-table th {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-weight: 800;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tr:hover td {
    background: #f8fafc;
}

/* Metric Widgets & Progress Bars */
.progress-container {
    width: 100%;
    background: #e2e8f0;
    height: 10px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #3b82f6);
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Portfolio Nav Tabs */
.portfolio-nav-tabs, .nav-tabs {
    display: flex;
    gap: 8px;
    background: #e2e8f0;
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 28px;
    border-bottom: none;
}

.portfolio-tab-btn, .nav-tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #475569;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.portfolio-tab-btn:hover, .nav-tab-btn:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

.portfolio-tab-btn.active, .nav-tab-btn.active {
    color: #0f172a;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-weight: 800;
}

/* Subject Pill Buttons for B1 Daily Test Charts */
.subject-pill-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.84rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.subject-pill-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.subject-pill-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sharia-pill-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.84rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sharia-pill-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.sharia-pill-btn.active {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.tab-content-panel {
    display: none;
}

.tab-content-panel.active {
    display: block !important;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-accent { background: var(--emerald); color: #fff; }
.btn-accent:hover { background: var(--emerald-hover); }

/* Heatmap Grid Visual (Worship A2) */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.heatmap-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    transition: transform 0.2s ease;
}

.heatmap-card:hover {
    transform: translateY(-3px);
}

.heatmap-card-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Mobile Friendly Quick Input Cards (Wali Kamar) */
.mobile-input-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.toggle-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 4px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.toggle-btn.active-exc { background: #dcfce7; color: #15803d; border-color: #86efac; }
.toggle-btn.active-good { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.toggle-btn.active-attn { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* Empty States Minimalism */
.empty-state-box {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

/* Responsive adjustments & Mobile Optimizations */
@media (max-width: 992px) {
    .sidebar { width: 72px; padding: 12px 0; }
    .sidebar-header { padding: 16px 12px; justify-content: center; }
    .school-logo-box { width: 38px; height: 38px; font-size: 1.1rem; }
    .sidebar-title, .sidebar-sub, .menu-category, .user-info, .menu-link span { display: none; }
    .menu-link { justify-content: center; padding: 12px 0; }
    .menu-link i { margin-right: 0; font-size: 1.2rem; }
    .main-content { margin-left: 72px; padding: 16px; width: calc(100% - 72px); }
    .student-profile-card { flex-direction: column; text-align: center; }
    .student-name-header { justify-content: center; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .app-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .sidebar-header { border-bottom: none; padding: 0; }
    .sidebar-title, .sidebar-sub { display: block; }
    .sidebar-menu {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px 0;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar-menu::-webkit-scrollbar { display: none; }
    .menu-category { display: none; }
    .menu-link {
        padding: 8px 12px;
        white-space: nowrap;
        border-radius: 10px;
        font-size: 0.8rem;
    }
    .menu-link span { display: inline; }
    .menu-link i { margin-right: 6px; font-size: 0.95rem; }
    .sidebar-user { display: none; }

    .main-content {
        margin-left: 0;
        padding: 12px;
        width: 100%;
    }

    /* Cards & Modals Mobile Polish */
    .card-panel {
        padding: 16px 12px;
        border-radius: 14px;
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 1.25rem !important;
    }

    .top-header, .top-navbar {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .top-header > div, .top-navbar > div {
        width: 100%;
    }

    .top-header button, .top-navbar button {
        width: 100%;
        justify-content: center;
    }

    /* Modal Fullscreen/Responsive Padding on Mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px) !important;
    }

    .modal-content {
        border-radius: 16px !important;
    }

    .modal-body {
        padding: 16px !important;
        max-height: 75vh;
        overflow-y: auto;
    }

    /* Tables Mobile Scroll */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

    .custom-table th, .custom-table td,
    .rpt-table th, .rpt-table td,
    .aspek-kualitas-table th, .aspek-kualitas-table td {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    /* Form Controls Touch Target Optimization */
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents auto zoom on mobile browsers */
        padding: 10px 12px;
    }

    .btn {
        padding: 9px 14px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 10px 8px;
    }

    .card-panel {
        padding: 12px 10px;
    }

    .student-profile-card {
        padding: 16px 12px;
    }

    .stat-badge {
        font-size: 0.72rem;
        padding: 4px 8px;
    }
}

/* PRINT STYLESHEET (Official 2-Page Parent Report Format) */
@media print {
    @page { size: A4 portrait; margin: 12mm 15mm; }
    body { background: #fff !important; color: #000 !important; }
    .sidebar, .top-navbar, .nav-tabs, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .print-document { display: block !important; color: #000 !important; background: #fff !important; }
    .print-page { page-break-after: always; padding: 10px 0; }
    .print-page:last-child { page-break-after: avoid; }
    .print-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px double #000; padding-bottom: 10px; margin-bottom: 15px; }
    .print-school-title { text-align: center; flex: 1; }
    .print-school-title h2 { font-size: 16pt; font-weight: bold; margin: 0; text-transform: uppercase; color: #000; }
    .print-school-title p { font-size: 9pt; margin: 2px 0 0 0; color: #333; }
    .print-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 9.5pt; }
    .print-table th, .print-table td { border: 1px solid #000; padding: 6px 8px; color: #000; }
    .print-table th { background-color: #f2f2f2 !important; font-weight: bold; text-align: center; }
    .print-sig-grid { display: flex; justify-content: space-between; margin-top: 30px; text-align: center; font-size: 9.5pt; }
    .print-sig-box { width: 30%; }
    .print-sig-space { height: 60px; }
}
