/* ==========================================================================
   SATUDATA SLB - Modern Design System & Component Stylesheet
   Designed for: Pengawas Sekolah, Satuan Pendidikan Khusus SLB, dan Dinas Pendidikan
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    
    --secondary: #0f172a;
    --secondary-light: #1e293b;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #065f46;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;

    --info: #06b6d4;
    --info-bg: #ecfeff;
    --info-text: #155e75;

    --purple: #8b5cf6;
    --purple-bg: #f5f3ff;
    --purple-text: #5b21b6;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border-card: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 14px 28px -6px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 20px 35px -8px rgba(37, 99, 235, 0.18);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--secondary);
    font-weight: 700;
    line-height: 1.25;
}

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

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

/* App Header & Navbar */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-badge {
    background: #dbeafe;
    color: var(--primary);
    font-size: 0.68rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* User & Action Bar */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.role-switcher-box {
    display: flex;
    align-items: center;
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.6rem 0.2rem 0.8rem;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.role-badge {
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.role-select {
    background: #ffffff;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
    outline: none;
}

.btn-notif {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-notif:hover {
    background: var(--bg-page);
    border-color: #cbd5e1;
}

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

/* Navigation Tabs (The 6 Tahapan) */
.stage-nav-bar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 61px;
    z-index: 45;
}

.stage-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.stage-nav-container::-webkit-scrollbar {
    height: 4px;
}

.stage-nav-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.nav-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.nav-tab-btn:hover {
    background: var(--bg-page);
    color: var(--secondary);
}

.nav-tab-btn.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
}

.nav-tab-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    background: #e2e8f0;
    color: var(--text-muted);
}

.nav-tab-btn.active .nav-tab-pill {
    background: var(--primary);
    color: #ffffff;
}

/* Main Layout */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
    flex: 1;
}

/* Hero & Quick Stat Cards */
.hero-section {
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    padding: 2rem;
    color: #ffffff;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero-section::after {
    content: '';
    position: absolute;
    right: -50px;
    bottom: -50px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-greeting {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero-desc {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.25rem;
    max-width: 620px;
}

.hero-badges-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
}

.hero-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
}

.hero-sync-info {
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: #bfdbfe;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.amber { background: #fef3c7; color: #b45309; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.cyan { background: #cffafe; color: #0e7490; }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Card & Panels */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

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

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-icon-pill {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--secondary);
}

.card-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background: #ffffff;
    border-color: var(--border-card);
    color: var(--secondary);
}

.btn-secondary:hover {
    background: var(--bg-page);
    border-color: #cbd5e1;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-warning:hover {
    background: #d97706;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-white {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-white:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.badge-negeri {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-swasta {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-tuntas {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #a7f3d0;
}

.badge-menunggu {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-revisi {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid #fde68a;
}

.badge-belum {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid #fecaca;
}

.badge-terverifikasi {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.badge-diajukan {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

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

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

.custom-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border-card);
    white-space: nowrap;
}

.custom-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-card);
    color: var(--secondary);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition);
}

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

/* Forms & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.col-span-2 {
    grid-column: span 2;
}

.form-group.col-span-full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--secondary);
    background: #ffffff;
    transition: var(--transition);
}

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

textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

.form-range-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-range {
    flex: 1;
    cursor: pointer;
    accent-color: var(--primary);
}

.range-val-badge {
    min-width: 46px;
    text-align: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid #bfdbfe;
}

/* Scoring Summary Box */
.score-summary-card {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.score-big {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.predikat-badge {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.98);
    transition: var(--transition);
    overflow: hidden;
}

.modal-container.modal-lg {
    max-width: 960px;
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

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

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

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--secondary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

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

/* Charts Containers */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: #ffffff;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

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

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Calendar Styles */
.calendar-agenda-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.agenda-item {
    background: #ffffff;
    border: 1px solid var(--border-card);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.agenda-item:hover {
    border-color: #93c5fd;
    transform: translateX(4px);
}

.agenda-item.manajerial {
    border-left-color: var(--purple);
}

.agenda-item.selesai {
    border-left-color: var(--success);
    opacity: 0.85;
}

.agenda-date-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 90px;
    flex-shrink: 0;
}

.agenda-date-badge .day {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
}

.agenda-date-badge .month {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 320px;
    max-width: 440px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition);
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warning { border-left: 4px solid var(--warning); }

/* Official TTE & Print Styles */
.tte-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tte-qr {
    width: 72px;
    height: 72px;
    background: #ffffff;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.tte-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.tte-info strong {
    color: var(--secondary);
}

/* Print Rules */
@media print {
    body {
        background: #ffffff;
        color: #000000;
    }
    .app-header, .stage-nav-bar, .hero-section, .btn, .role-switcher-box, .modal-close {
        display: none !important;
    }
    .card-panel {
        border: none !important;
        box-shadow: none !important;
    }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.col-span-2 {
        grid-column: 1;
    }
}
