/* ================================================================
   WAKASEK KURIKULUM — Admin Panel Stylesheet
   ================================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ── CSS Variables ── */
:root {
    --color-primary: #1a56db;
    --color-secondary: #1e429f;
    --color-primary-light: #1a56db18;
    --color-primary-hover: #1e429f;
    --sidebar-width: 272px;
    --navbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.1), 0 8px 10px rgba(0,0,0,.04);
    --border-color: #e2e8f0;
    --transition: all .22s cubic-bezier(.4,0,.2,1);
}

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.1rem;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
    gap: .75rem;
}
.navbar-left, .navbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.navbar-right { gap: .5rem; }

/* Hamburger — visible on ALL devices */
.hamburger {
    display: flex; flex-direction: column; gap: 5px;
    background: rgba(255,255,255,.12); border: none; cursor: pointer;
    padding: 9px 10px; border-radius: 8px;
    transition: background .2s ease; flex-shrink: 0;
}
.hamburger:hover { background: rgba(255,255,255,.22); }
.hamburger span {
    display: block; width: 20px; height: 2px;
    background: #fff; border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Brand */
.navbar-brand { display: flex; align-items: center; gap: .55rem; color: #fff; }
.navbar-brand i { font-size: 1.35rem; }
.brand-text { font-weight: 700; font-size: .95rem; white-space: nowrap; }
@media(max-width:460px) { .brand-text { display: none; } }

/* TP Badge */
.tp-badge {
    background: rgba(255,255,255,.13);
    color: rgba(255,255,255,.9);
    font-size: .72rem; padding: .25rem .7rem; border-radius: 20px;
    display: none; align-items: center; gap: .35rem; white-space: nowrap;
    border: 1px solid rgba(255,255,255,.18);
}
@media(min-width:640px) { .tp-badge { display: flex; } }

/* User Menu */
.user-menu { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: .45rem;
    background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22);
    cursor: pointer; color: #fff;
    padding: .3rem .8rem .3rem .35rem;
    border-radius: 24px; font-size: .84rem; font-weight: 500;
    transition: background .2s ease;
}
.user-btn:hover { background: rgba(255,255,255,.25); }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .78rem; color: #fff; flex-shrink: 0;
}
.user-name { display: none; }
@media(min-width:540px) { .user-name { display: block; } }

.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 10px);
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-xl); min-width: 200px;
    border: 1px solid var(--border-color); z-index: 2000; overflow: hidden;
}
.user-dropdown.show { display: block; animation: fadeDown .18s ease; }
.user-dropdown a {
    display: flex; align-items: center; gap: .6rem;
    padding: .75rem 1.1rem; font-size: .875rem; color: #374151;
    transition: background .15s ease;
}
.user-dropdown a:hover { background: var(--color-primary-light); color: var(--color-primary); }
.user-dropdown a i { width: 15px; text-align: center; color: #9ca3af; font-size: .82rem; }
.user-dropdown a:hover i { color: var(--color-primary); }
.dropdown-divider { height: 1px; background: #f1f5f9; margin: .25rem 0; }

/* ================================================================
   SIDEBAR — Overlay mode on ALL devices (desktop, tablet, HP)
   ================================================================ */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.45); z-index: 900;
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sidebar-overlay.show { display: block; animation: fadeIn .2s ease; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: #0f172a;
    z-index: 950;
    overflow-y: auto; overflow-x: hidden;
    transform: translateX(calc(-1 * var(--sidebar-width)));
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
}
.sidebar.open { transform: translateX(0); }

/* Sidebar Header */
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    min-height: var(--navbar-height);
    flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: .7rem; color: #fff; }
.sidebar-logo > i { font-size: 1.55rem; opacity: .95; }
.sidebar-title { font-weight: 700; font-size: .9rem; color: #fff; line-height: 1.3; }
.sidebar-subtitle { font-size: .68rem; color: rgba(255,255,255,.7); font-weight: 400; }
.sidebar-close {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; transition: background .2s ease; flex-shrink: 0;
}
.sidebar-close:hover { background: rgba(255,255,255,.28); }

/* Sidebar Nav */
.sidebar-nav { flex: 1; padding: .6rem 0 2.5rem; }
.nav-section-label {
    font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: #475569; padding: 1.1rem 1.1rem .4rem;
}
.nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .85rem; margin: 1px .55rem;
    color: #94a3b8; font-size: .855rem; font-weight: 500;
    border-radius: 8px; transition: var(--transition); cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: .88rem; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.nav-item.active {
    background: rgba(96,165,250,.15); color: #60a5fa; font-weight: 600;
}
.nav-item.active i { color: #60a5fa; }
.nav-item-danger { color: #f87171; }
.nav-item-danger:hover { background: rgba(239,68,68,.12); color: #fca5a5; }

/* ================================================================
   MAIN CONTENT — always full width (sidebar = overlay)
   ================================================================ */
.main-content {
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

.page-header {
    background: #fff; padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .75rem;
}
.page-title { font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.breadcrumb {
    display: flex; align-items: center; gap: .35rem;
    font-size: .77rem; color: #94a3b8; margin-top: .2rem; flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { font-size: .55rem; opacity: .6; }

.page-content { padding: 1.25rem; }
@media(min-width:768px) { .page-content { padding: 1.5rem; } }
@media(min-width:1280px) { .page-content { padding: 1.75rem 2rem; } }

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border-color);
    margin-bottom: 1.25rem; overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
}
.card-title {
    font-size: .92rem; font-weight: 700; color: #0f172a;
    display: flex; align-items: center; gap: .5rem;
}
.card-title i { color: var(--color-primary); font-size: .88rem; }
.card-body { padding: 1.25rem; }

/* ================================================================
   STATS
   ================================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media(min-width:900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 1.15rem 1.2rem;
    box-shadow: var(--shadow); border: 1px solid var(--border-color);
    display: flex; align-items: center; gap: .9rem;
    transition: box-shadow .2s ease, transform .2s ease;
    border-top: 3px solid var(--color-primary);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 46px; height: 46px; border-radius: 10px;
    background: var(--color-primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-primary); font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: #0f172a; line-height: 1; }
.stat-label { font-size: .77rem; color: #64748b; margin-top: .25rem; line-height: 1.4; }

/* ================================================================
   GRIDS
   ================================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media(min-width:768px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media(min-width:640px)  { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media(min-width:1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ================================================================
   TABLES — clean light header
   ================================================================ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: #f8fafc; }
thead th {
    padding: .7rem 1rem; text-align: left; font-weight: 600;
    font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
    color: #64748b; white-space: nowrap; border-bottom: 2px solid #e2e8f0;
}
tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .14s ease; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: .78rem 1rem; color: #334155; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .2rem .65rem; border-radius: 20px;
    font-size: .7rem; font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-teal   { background: #ccfbf1; color: #0f766e; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; border-radius: var(--radius-sm); border: none;
    font-size: .875rem; font-weight: 600; cursor: pointer;
    transition: var(--transition); white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-secondary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,86,219,.3); }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-sm { padding: .3rem .75rem; font-size: .78rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-outline { background: transparent; border: 1.5px solid var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-ghost { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

/* ================================================================
   FORMS
   ================================================================ */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: .45rem; }
.form-control {
    width: 100%; padding: .6rem .875rem;
    border: 1.5px solid #e2e8f0; border-radius: var(--radius-sm);
    font-size: .875rem; color: #1e293b;
    transition: border-color .2s ease, box-shadow .2s ease;
    background: #fff; font-family: inherit; line-height: 1.5;
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.form-control:disabled { background: #f9fafb; cursor: not-allowed; color: #9ca3af; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media(min-width:640px) { .form-row.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media(min-width:768px) { .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.form-hint  { font-size: .73rem; color: #94a3b8; margin-top: .3rem; }
.form-error { font-size: .73rem; color: #ef4444; margin-top: .3rem; }

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: .85rem 1.1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; display: flex; align-items: flex-start; gap: .6rem;
    font-size: .875rem; border-left: 4px solid;
}
.alert i { margin-top: .1rem; flex-shrink: 0; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #16a34a; }
.alert-danger  { background: #fef2f2; color: #dc2626; border-color: #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #3b82f6; }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); z-index: 3000;
    align-items: center; justify-content: center; padding: 1rem;
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; animation: fadeIn .2s ease; }
.modal {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 600px;
    box-shadow: var(--shadow-xl); max-height: 90vh;
    display: flex; flex-direction: column;
}
.modal-header {
    padding: 1.2rem 1.5rem; border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.modal-close {
    background: #f1f5f9; border: none; width: 32px; height: 32px;
    border-radius: 8px; cursor: pointer; color: #64748b;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); font-size: .9rem;
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid #f1f5f9;
    display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; opacity: .35; display: block; }
.empty-state h3 { font-size: .92rem; color: #64748b; margin-bottom: .4rem; font-weight: 600; }
.empty-state p { font-size: .8rem; }

/* ================================================================
   FILTER / SEARCH BAR
   ================================================================ */
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.search-box { position: relative; flex: 1; min-width: 180px; }
.search-box i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .8rem; }
.search-box input { padding-left: 2.25rem; }
.filter-selects { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-selects select { width: auto; }

/* ================================================================
   PROGRESS
   ================================================================ */
.progress { background: #f1f5f9; border-radius: 20px; height: 7px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-primary); border-radius: 20px; transition: width .4s ease; }
.progress-bar.green  { background: #16a34a; }
.progress-bar.orange { background: #d97706; }
.progress-bar.red    { background: #dc2626; }

/* ================================================================
   TIMELINE
   ================================================================ */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.5rem; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--color-primary); border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--color-primary);
}
.timeline-date  { font-size: .73rem; color: #94a3b8; margin-bottom: .2rem; }
.timeline-title { font-size: .875rem; font-weight: 600; color: #0f172a; }
.timeline-desc  { font-size: .8rem; color: #64748b; margin-top: .15rem; }

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 2.5rem 2rem;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-xl);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo i { font-size: 2.8rem; color: var(--color-primary); }
.login-logo h1 { font-size: 1.3rem; font-weight: 800; color: #0f172a; margin-top: .75rem; }
.login-logo p { font-size: .84rem; color: #64748b; margin-top: .3rem; }

/* ================================================================
   CALENDAR
   ================================================================ */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-day-name {
    text-align: center; font-size: .63rem; font-weight: 700;
    color: #94a3b8; padding: .35rem; text-transform: uppercase;
}
.cal-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: .78rem; cursor: default;
    transition: background .14s ease; position: relative; color: #334155;
}
.cal-day.other-month { opacity: .3; }
.cal-day.today { background: var(--color-primary); color: #fff; font-weight: 700; }
.cal-day.has-event { font-weight: 700; }
.cal-day:not(.today):hover { background: #f1f5f9; }
.event-dot { width: 4px; height: 4px; border-radius: 50%; position: absolute; bottom: 3px; }
.cal-day.libur    .event-dot { background: #ef4444; }
.cal-day.ujian    .event-dot { background: #f59e0b; }
.cal-day.kegiatan .event-dot { background: #059669; }

/* ================================================================
   UTILITIES
   ================================================================ */
.text-primary  { color: var(--color-primary) !important; }
.text-muted    { color: #94a3b8 !important; }
.text-sm       { font-size: .8rem !important; }
.text-xs       { font-size: .72rem !important; }
.fw-bold       { font-weight: 700 !important; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-xs        { gap: .35rem; }
.gap-sm        { gap: .5rem; }
.gap-md        { gap: .75rem; }
.justify-between { justify-content: space-between; }
.action-btns   { display: flex; gap: .35rem; flex-wrap: wrap; }
.w-full        { width: 100%; }
.mt-1 { margin-top: .5rem; }
.mb-1 { margin-bottom: .5rem; }

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(8px);  } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn  { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .sidebar, .sidebar-overlay, .navbar, .filter-bar, .action-btns, .btn { display: none !important; }
    .main-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
}
