/* Bright, Fresh, Clean, and Modern Light Theme CSS System for Sistem Portofolio Santri Terpadu - Yayasan 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: #ffffff;
    --text-navy: #172033;
    --text-main: #172033;
    --text-muted: #64748b;
    --text-light: #475569;
    
    /* Brand Color Palette Utama */
    --primary: #059669;          /* Primary Green */
    --primary-hover: #047857;    /* Primary Dark */
    --primary-dark: #047857;
    --dark-navy: #172033;
    --secondary-navy: #1e3a5f;
    --soft-green: #ecfdf5;
    --soft-blue: #eff6ff;
    
    /* Status Colors */
    --sky-blue: #2563eb;        /* Info */
    --emerald: #059669;         /* Success */
    --emerald-hover: #047857;
    --amber-gold: #f59e0b;      /* Warning */
    --rose-danger: #dc2626;      /* Danger */

    --border-color: #e2e8f0;
    --border-radius: 14px;
    --border-radius-card: 14px;
    --border-radius-btn: 8px;
    --border-radius-pill: 9999px;
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 4px 12px 0 rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

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

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
}

.btn-accent {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}
.btn-accent:hover, .btn-accent:focus, .btn-accent:active {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #1e3a5f !important;
    border-color: #1e3a5f !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active {
    background-color: #162c47 !important;
    border-color: #162c47 !important;
    color: #ffffff !important;
}

.btn-neutral {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}
.btn-neutral:hover, .btn-neutral:focus, .btn-neutral:active {
    background-color: #e2e8f0 !important;
    color: #172033 !important;
    border-color: #94a3b8 !important;
}

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%;
}

/* Modern Clean Sidebar */
.sidebar {
    width: 280px;
    background: #ffffff;
    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: 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.school-logo-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #172033;
    line-height: 1.2;
}

.sidebar-sub {
    font-size: 0.72rem;
    color: #059669;
    font-weight: 700;
    letter-spacing: 0.5px;
}

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

.menu-category {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.8px;
    padding: 14px 12px 6px 12px;
    font-weight: 700;
}

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

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #475569;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
}

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

.menu-link:hover {
    background: #f1f5f9;
    color: #172033;
}

.menu-link:hover i {
    color: #059669;
}

.menu-link.active {
    background: #ecfdf5 !important;
    color: #047857 !important;
    font-weight: 700;
    border-left: 3px solid #059669;
    border-radius: 0 10px 10px 0;
}

.menu-link.active i {
    color: #059669 !important;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669, #047857);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

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

.user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #172033;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.73rem;
    color: #059669;
    font-weight: 600;
}

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

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

.page-title-box h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #172033;
    letter-spacing: -0.4px;
}

.page-title-box p {
    font-size: 0.88rem;
    color: #64748b;
    font-weight: 500;
}

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

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

.student-card-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.student-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.06) !important;
    border-color: #cbd5e1 !important;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #172033;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: #059669;
}

/* Student Profile Header Banner (Bright & Modern) */
.student-profile-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 26px;
    margin-bottom: 28px;
    display: flex;
    gap: 24px;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.student-avatar-large {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    background: linear-gradient(135deg, #059669, #047857);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.2rem;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.25);
}

.student-details {
    flex: 1;
}

.student-name-header {
    font-size: 1.45rem;
    font-weight: 800;
    color: #172033;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Level Badges: SMP in Soft Blue, SMA in Soft Green */
.level-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-smp {
    background: #eff6ff;
    color: #1e3a5f;
    border: 1px solid #bfdbfe;
}

.level-sma {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.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: #64748b;
    font-weight: 500;
}

.meta-item strong {
    color: #172033;
    font-weight: 700;
}

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

.badge-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info { background: #eff6ff; color: #1e3a5f; border: 1px solid #bfdbfe; }

/* Worship Heatmap Soft Badges */
.badge-worship-excellent { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-worship-good { background: #eff6ff; color: #1e3a5f; border: 1px solid #bfdbfe; }
.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: #f8fafc;
    color: #64748b;
    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: 700;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: #172033;
    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, #059669, #10b981);
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Portfolio Nav Tabs */
.portfolio-nav-tabs, .nav-tabs {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 12px;
    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: #64748b;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.portfolio-tab-btn.active, .nav-tab-btn.active {
    color: #047857;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    font-weight: 700;
}

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

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

.subject-pill-btn.active {
    background: #1e3a5f;
    color: #ffffff;
    border-color: #1e3a5f;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

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

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

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

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

.tab-content-panel.active {
    display: block !important;
    animation: fadeInSlideUp 0.3s ease forwards;
}

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

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
}

.form-control, .form-select {
    width: 100%;
    padding: 11px 15px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #172033;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #059669 !important;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15) !important;
}

.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; }
}
