/* ============================================
   E-KESISWAAN — STYLESHEET
   Disamakan dengan design system Portal Pegawai / E-Kepegawaian:
   Gojek Green Native + Material Design 3
   ============================================ */
:root {
    --accent:            #00AA13;
    --accent-light:      #E6F6E8;
    --accent-container:  #F0FDF4;
    --accent-dark:       #00880C;
    --accent-gradient:   linear-gradient(135deg, #00AA13 0%, #00C853 100%);
    --on-accent:         #ffffff;

    --success: #00AA13; --success-bg:#E6F6E8;
    --warning: #FF9900; --warning-bg:#FFF5E6;
    --danger:  #ED2736; --danger-bg:#FDEAEB;
    --info:    #2563eb; --info-bg:#dbeafe;
    --purple:  #9333ea; --purple-bg:#f3e8ff;

    --bg-app:  #F9F9F9;
    --bg-card: #ffffff;
    --text-primary:   #101820;
    --text-secondary: #687176;
    --border:  #EAEAEA;

    --sidebar-bg:     #0D2B12;
    --sidebar-bg-alt: #123818;
    --sidebar-text:   rgba(255,255,255,0.72);

    --th-bg: #F0FDF4; --th-color:#3f6b45;
    --sidebar-width:260px;

    --shadow-sm: 0 1px 4px rgba(0,170,19,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 14px rgba(0,170,19,0.10), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 30px rgba(0,170,19,0.15), 0 4px 10px rgba(0,0,0,0.08);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 100px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --accent:            #00E676;
    --accent-light:      rgba(0,230,118,0.18);
    --accent-container:  rgba(0,230,118,0.12);
    --accent-dark:       #00AA13;
    --accent-gradient:   linear-gradient(135deg, #00E676 0%, #00AA13 100%);
    --on-accent:         #0d1117;

    --success:#00E676; --success-bg:rgba(0,230,118,0.12);
    --warning:#FFB74D; --warning-bg:rgba(255,183,77,0.12);
    --danger: #FF5252; --danger-bg:rgba(255,82,82,0.15);
    --info:   #60a5fa; --info-bg:rgba(96,165,250,0.15);
    --purple: #c084fc; --purple-bg:rgba(192,132,252,0.15);

    --bg-app:  #0D190E;
    --bg-card: #162518;
    --text-primary:   #F5F5F5;
    --text-secondary: #9E9E9E;
    --border:  #243D27;

    --sidebar-bg:     #0A1A0C;
    --sidebar-bg-alt: #0D2B12;
    --sidebar-text:   rgba(255,255,255,0.68);

    --th-bg: #1C331E; --th-color:#9ecfa4;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.6);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.7);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-alt) 100%);
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s var(--ease);
}

.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,170,19,0.35);
}

.brand-text h1 { color: white; font-size: 14px; font-weight: 700; }
.brand-text p  { color: var(--sidebar-text); font-size: 10px; margin-top: 2px; }

.sidebar-menu { padding: 12px 8px; }

.menu-category {
    font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    padding: 14px 10px 4px;
    text-transform: uppercase;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background 0.15s var(--ease), transform 0.1s var(--ease), color 0.15s var(--ease);
    font-size: 12px; font-weight: 500;
}

.nav-item:hover  { background: rgba(255,255,255,0.08); color: white; }
.nav-item:active { transform: scale(0.98); }
.nav-item.active {
    background: var(--accent);
    color: white; font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,170,19,0.35);
}
.nav-item.active .material-icons-round { color: white; }
.nav-item .material-icons-round { font-size: 18px; flex-shrink: 0; }

.back-btn {
    color: #6ee888;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 0;
    padding-bottom: 12px;
    text-decoration: none;
}

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

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

.header-title { font-weight: 700; color: var(--text-primary); font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.datetime-container div:first-child { font-size: 11px; color: var(--text-secondary); }
.live-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.theme-switch {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent-light);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--accent);
    transition: transform 0.15s var(--ease);
}
.theme-switch:active { transform: scale(0.92); }
.theme-switch::after { content: '🌙'; font-size: 16px; }
[data-theme="dark"] .theme-switch::after { content: '☀️'; }

.content-area { flex: 1; padding: 24px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp 0.25s var(--ease); }
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

/* CARDS & PANELS */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}

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

.card-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* STAT GRID */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon { width: 46px; height: 46px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon .material-icons-round { font-size: 24px; }
.stat-info h3 { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-info p  { font-size: 11px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }

/* QUICK ACTION BAR */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

.quick-btn {
    flex: 1; min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    font-weight: 600; font-size: 12px;
    color: var(--text-primary);
    transition: transform 0.1s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.quick-btn:hover  { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.quick-btn:active { transform: scale(0.97); }

.quick-btn .icon-box { width: 32px; height: 32px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; color: white; flex-shrink:0; }

/* TABLES */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead tr { background: var(--th-bg); }
th { padding: 11px 14px; font-size: 10px; font-weight: 700; color: var(--th-color); text-transform: uppercase; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover { background: var(--accent-light); cursor: pointer; }

.text-left   { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }

/* BUTTONS — Material 3 filled, pill, dgn tactile press feedback */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.1s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
    white-space: nowrap;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--accent-gradient); color: var(--on-accent); border-color: transparent; box-shadow: 0 4px 12px rgba(0,170,19,0.28); }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(0,170,19,0.38); filter: brightness(1.03); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--accent-dark); }

.btn-warning { background: var(--warning); color: white; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-danger:hover { filter: brightness(0.92); }

.btn-outline { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-app); }

.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn .material-icons-round { font-size: 16px; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 700; line-height: 1.4; white-space:nowrap; }
.badge-l { background: var(--info-bg); color: var(--info); }
.badge-p { background: #fce7f3; color: #9d174d; }
.badge-gray    { background: var(--th-bg); color: var(--text-secondary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-purple  { background: var(--purple-bg);  color: var(--purple); }

/* FORMS & INPUTS */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

.input-control {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px; font-family: inherit;
    background: var(--bg-card); color: var(--text-primary);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    outline: none; width: 100%;
}
.input-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.search-wrapper { position: relative; }
.search-icon-mini { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-secondary); }

.search-input-mini {
    padding: 8px 10px 8px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 12px; font-family: inherit;
    background: var(--bg-card); color: var(--text-primary);
    outline: none; min-width: 220px;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-input-mini:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* MODAL — overlay solid instan (anti-kedip), kartu dgn animasi & resize halus */
.modal-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(5px);
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 680px; max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.22s var(--ease);
    transition: max-width 0.25s var(--ease), width 0.25s var(--ease), max-height 0.25s var(--ease), height 0.25s var(--ease);
}
.modal-lg { max-width: 980px; }
.modal-xl { max-width: 1200px; }

/* Mode Layar Penuh (Fullscreen) untuk Komputer / Laptop */
.modal-card.is-fullscreen {
    max-width: 96vw !important;
    width: 96vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    border-radius: var(--radius-md);
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: var(--bg-card);
    z-index: 10;
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-actions { display: flex; align-items: center; gap: 6px; }

.modal-action-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
    border-radius: 50%; padding: 6px; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.modal-action-btn:hover { background: var(--bg-app); color: var(--accent); }

.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
    border-radius: 50%; padding: 6px; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.modal-close:hover { background: var(--bg-app); color: var(--danger); }

.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

@keyframes modalIn {
    from { transform: translateY(10px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* DETAIL SISWA */
.detail-section { margin-bottom: 18px; }
.detail-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--accent);
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent-light);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.detail-item { background: var(--bg-app); border-radius: var(--radius-xs); padding: 10px 14px; border: 1px solid var(--border); }
.detail-item .label { font-size: 10px; font-weight: 600; color: var(--text-secondary); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.3px; }
.detail-item .value { font-size: 13px; font-weight: 600; color: var(--text-primary); word-break: break-word; }

/* Grid 2 Kolom untuk Seksi Orang Tua pada Layar Lebar */
.detail-parents-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) {
    .detail-parents-grid { grid-template-columns: 1fr; }
}

/* KELAS TABS */
.kelas-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.kelas-tab {
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--bg-card); color: var(--text-secondary);
    transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.kelas-tab.active, .kelas-tab:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* EKSTRAKURIKULER GRID */
.ekstra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ekstra-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.ekstra-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ekstra-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ekstra-icon {
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    background: var(--accent-light); color: var(--accent-dark);
    display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink:0;
}
.ekstra-info h4 { font-size: 14px; font-weight: 700; }
.ekstra-info p  { font-size: 11px; color: var(--text-secondary); }

/* TIMELINE LIST (Kedisiplinan & Prestasi) */
.timeline-list { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-app); border-left: 4px solid var(--accent); }
.timeline-item.danger  { border-left-color: var(--danger); }
.timeline-item.warning { border-left-color: var(--warning); }
.timeline-item.success { border-left-color: var(--success); }
.timeline-item.purple  { border-left-color: var(--purple); }

/* UPLOAD AREA */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 32px 20px;
    text-align: center;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
    cursor: pointer;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--accent); background: var(--accent-light); }

/* TOAST */
.toast-notif {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    background: #1e293b; color: white;
    padding: 12px 20px; border-radius: var(--radius-md);
    font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px); opacity: 0;
    transition: all 0.3s var(--ease);
    max-width: 320px;
}
.toast-notif.show { transform: translateY(0); opacity: 1; }

/* UTILITY — pengganti inline style 2-kolom yg berulang di banyak modal */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#sidebarOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-primary); }

@media (max-width:1024px) {
    .sidebar { transform: translateX(-100%); width: min(var(--sidebar-width), 82vw); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .mobile-toggle { display: flex; }
    #sidebarOverlay.open { display: block; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* PONSEL — ukuran & spacing dikecilkan supaya tidak saling tabrakan */
@media (max-width:640px) {
    body { font-size: 12px; }

    header { height: 56px; padding: 0 12px; gap: 8px; }
    .header-title { display: none; }
    .header-actions { gap: 8px; }
    .datetime-container div:first-child { display: none; }
    .live-time { font-size: 13px; }
    .theme-switch { width: 32px; height: 32px; }
    .theme-switch::after { font-size: 14px; }

    .content-area { padding: 14px; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 12px; gap: 10px; border-radius: var(--radius-sm); }
    .stat-icon { width: 36px; height: 36px; }
    .stat-icon .material-icons-round { font-size: 18px; }
    .stat-info h3 { font-size: 17px; }
    .stat-info p { font-size: 9px; }

    .quick-actions { flex-direction: column; gap: 8px; }
    .quick-btn { min-width: 0; padding: 10px 12px; }

    .card { border-radius: var(--radius-sm); }
    .card-header { flex-direction: column; align-items: flex-start; padding: 12px 14px; }
    .card-title { font-size: 13px; }
    .card-header-actions { width: 100%; gap: 6px; }
    .card-header-actions .btn { flex: 1 1 auto; justify-content: center; }
    .card-header-actions .search-wrapper { width: 100%; order: -1; }
    .search-input-mini { width: 100%; min-width: 0; }

    .detail-grid { grid-template-columns: 1fr; }
    .grid-2,
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

    .ekstra-grid { grid-template-columns: 1fr; }

    table { font-size: 11px; }
    th, td { padding: 8px; }

    .btn { padding: 8px 12px; font-size: 11px; }
    .btn-sm { padding: 5px 9px; font-size: 10.5px; }

    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-card { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; max-width: 100%; animation: modalInSheet 0.24s var(--ease); }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 16px; }
    .modal-footer { padding: 12px 16px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1 1 auto; justify-content: center; }
    .modal-detail-actions .btn { flex: 1 1 auto; justify-content: center; min-width: 100px; }
    @keyframes modalInSheet { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

    .input-control { padding: 9px 10px; font-size: 12px; }

    .toast-notif { left: 12px; right: 12px; bottom: 16px; max-width: none; text-align: center; }
}

@media (max-width:380px) {
    .stat-grid { grid-template-columns: 1fr; }
}
