/* =========================================================
   SIMSISWA — Neumorphism Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root{
  /* --- palette --- */
  --bg:            #e6ebf1;
  --bg-elevated:   #e6ebf1;
  --shadow-light:  #ffffff;
  --shadow-dark:   #b3bccb;
  --text-primary:  #354160;
  --text-secondary:#7c88a1;
  --text-muted:    #a3adc2;

  --accent:        #5b7fff;
  --accent-dark:   #4361ee;
  --accent-soft:   #e8edff;

  --danger:        #ff6b6b;
  --danger-dark:   #e85555;
  --success:       #34c38f;
  --warning:       #ffb02e;

  --radius-sm:  12px;
  --radius-md:  18px;
  --radius-lg:  26px;
  --radius-pill:999px;

  --font-display:'Poppins', sans-serif;
  --font-body:'Inter', sans-serif;

  --nav-h:72px;
  --topbar-h:64px;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text-primary);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  scroll-behavior:smooth;
}

h1,h2,h3,h4,.font-display{ font-family:var(--font-display); color:var(--text-primary); margin:0; }
p{ margin:0; }
a{ text-decoration:none; color:inherit; }
button{ font-family:var(--font-body); cursor:pointer; }
input,select,textarea{ font-family:var(--font-body); }

/* =========================================================
   Neumorphic primitives
   ========================================================= */

.neu-raised{
  background:var(--bg-elevated);
  border-radius:var(--radius-md);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
}

.neu-raised-sm{
  background:var(--bg-elevated);
  border-radius:var(--radius-sm);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.neu-inset{
  background:var(--bg);
  border-radius:var(--radius-sm);
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.neu-flat{
  background:var(--bg);
  border-radius:var(--radius-sm);
}

/* =========================================================
   Layout shell
   ========================================================= */

.app-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  padding-bottom:calc(var(--nav-h) + 16px);
}

.topbar{
  position:sticky; top:0; z-index:40;
  height:var(--topbar-h);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 18px;
  background:var(--bg);
  backdrop-filter:blur(6px);
}

.topbar .brand{
  display:flex; align-items:center; gap:10px;
}
.topbar .brand .logo{
  width:40px;height:40px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(145deg,#6f8fff,#4361ee);
  box-shadow:5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  color:#fff; font-family:var(--font-display); font-weight:700;
}
.topbar .brand .title{ font-family:var(--font-display); font-weight:600; font-size:17px; }
.topbar .brand .subtitle{ font-size:11px; color:var(--text-secondary); }

.icon-btn{
  width:42px;height:42px; border:none; border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  background:var(--bg-elevated);
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  color:var(--text-secondary);
  transition:box-shadow .15s ease, transform .15s ease, color .15s ease;
}
.icon-btn:active{
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  transform:scale(.97);
}

.container{
  width:100%;
  max-width:1080px;
  margin:0 auto;
  padding:18px 16px 8px;
}

/* =========================================================
   Stat cards
   ========================================================= */

.stats-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
  margin-bottom:20px;
}
@media (min-width:640px){
  .stats-grid{ grid-template-columns:repeat(4,1fr); }
}

.stat-card{
  padding:16px;
  display:flex; flex-direction:column; gap:10px;
}
.stat-card .stat-icon{
  width:40px;height:40px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background:var(--accent-soft); color:var(--accent-dark);
}
.stat-card .stat-value{ font-family:var(--font-display); font-size:22px; font-weight:700; }
.stat-card .stat-label{ font-size:12.5px; color:var(--text-secondary); }

/* =========================================================
   Section header
   ========================================================= */

.section-head{
  display:flex; align-items:center; justify-content:space-between;
  margin:6px 0 14px;
  gap:10px;
  flex-wrap:wrap;
}
.section-head h2{ font-size:18px; font-weight:600; }
.section-head .sub{ font-size:12.5px; color:var(--text-secondary); margin-top:2px; }

/* =========================================================
   Toolbar (search + filter + actions)
   ========================================================= */

.toolbar{
  display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap;
  align-items:center;
}
.search-box{
  flex:1 1 220px;
  display:flex; align-items:center; gap:10px;
  padding:0 16px; height:48px;
}
.search-box input{
  border:none; background:transparent; outline:none;
  width:100%; font-size:14px; color:var(--text-primary);
}
.search-box svg{ color:var(--text-muted); flex-shrink:0; }

.select-filter{
  height:48px; padding:0 14px; border:none; outline:none;
  background:var(--bg-elevated); border-radius:var(--radius-sm);
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  color:var(--text-secondary); font-size:13.5px;
  min-width:120px;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn{
  height:46px; padding:0 22px; border:none; border-radius:var(--radius-sm);
  font-weight:600; font-size:14px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--bg-elevated);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  color:var(--text-secondary);
  transition:transform .12s ease, box-shadow .12s ease;
}
.btn:active{ transform:scale(.97); box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); }

.btn-primary{
  color:#fff;
  background:linear-gradient(145deg,#6f8fff,#4361ee);
  box-shadow: 6px 6px 14px rgba(67,97,238,.35), -4px -4px 10px rgba(255,255,255,.5);
}
.btn-danger{
  color:#fff;
  background:linear-gradient(145deg,#ff8080,#e85555);
  box-shadow: 6px 6px 14px rgba(232,85,85,.32), -4px -4px 10px rgba(255,255,255,.5);
}
.btn-block{ width:100%; }
.btn-sm{ height:38px; padding:0 16px; font-size:13px; border-radius:12px; }

.fab{
  position:fixed;
  right:22px;
  bottom:calc(var(--nav-h) + 18px);
  width:58px;height:58px; border:none; border-radius:20px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(145deg,#6f8fff,#4361ee);
  color:#fff;
  box-shadow: 8px 8px 16px rgba(67,97,238,.4), -6px -6px 14px rgba(255,255,255,.6);
  z-index:45;
  transition:transform .15s ease;
}
.fab:active{ transform:scale(.94); }

/* =========================================================
   Student list — table (desktop) / cards (mobile)
   ========================================================= */

.list-card{ padding:8px; }

.siswa-table{ width:100%; border-collapse:collapse; display:none; }
.siswa-table th{
  text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.04em;
  color:var(--text-muted); font-weight:600; padding:14px 16px;
}
.siswa-table td{ padding:12px 16px; font-size:14px; }
.siswa-table tbody tr{ border-radius:14px; transition:background .15s ease; }
.siswa-table tbody tr:hover{ background:rgba(255,255,255,.5); }

@media (min-width:820px){
  .siswa-table{ display:table; }
  .siswa-cards{ display:none; }
}

.siswa-cards{ display:flex; flex-direction:column; gap:12px; padding:8px; }

.siswa-item{
  display:flex; align-items:center; gap:12px;
  padding:12px; border-radius:var(--radius-sm);
  background:var(--bg-elevated);
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
}

.avatar{
  width:46px;height:46px; border-radius:14px; object-fit:cover; flex-shrink:0;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
.avatar-lg{ width:64px; height:64px; border-radius:18px; }

.siswa-item .info{ flex:1; min-width:0; }
.siswa-item .info .nama{ font-weight:600; font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.siswa-item .info .meta{ font-size:12px; color:var(--text-secondary); margin-top:2px; }

.badge{
  display:inline-flex; align-items:center; gap:5px;
  font-size:11px; font-weight:600; padding:4px 10px; border-radius:var(--radius-pill);
  background:var(--accent-soft); color:var(--accent-dark);
}
.badge-warning{ background:#fff2df; color:#c9821a; }
.badge-muted{ background:#eef1f6; color:var(--text-secondary); }

.row-actions{ display:flex; gap:8px; }
.row-actions .icon-btn{ width:36px;height:36px; border-radius:11px; }
.row-actions .icon-btn.danger:active{ color:var(--danger); }

.empty-state{
  text-align:center; padding:50px 20px; color:var(--text-secondary);
}
.empty-state .icon{
  width:70px;height:70px;border-radius:20px;margin:0 auto 16px;
  display:flex;align-items:center;justify-content:center;
  background:var(--bg); box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  color:var(--text-muted);
}

/* =========================================================
   Modal / form (Tambah & Edit Siswa)
   ========================================================= */

.modal-overlay{
  position:fixed; inset:0; background:rgba(53,65,96,.35);
  display:flex; align-items:flex-end; justify-content:center;
  z-index:100; opacity:0; pointer-events:none; transition:opacity .2s ease;
  backdrop-filter:blur(2px);
}
.modal-overlay.open{ opacity:1; pointer-events:auto; }

.modal{
  width:100%; max-width:760px; max-height:92vh; overflow-y:auto;
  background:var(--bg); border-radius:26px 26px 0 0;
  box-shadow: 0 -10px 30px rgba(53,65,96,.25);
  transform:translateY(24px); transition:transform .25s ease;
  padding:20px 18px 26px;
}
.modal-overlay.open .modal{ transform:translateY(0); }

@media (min-width:760px){
  .modal-overlay{ align-items:center; }
  .modal{ border-radius:26px; max-height:88vh; padding:26px 28px 30px; }
}

.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding-bottom:14px; margin-bottom:16px;
  border-bottom:1px solid rgba(179,188,203,.35);
}
.modal-header h3{ font-size:19px; font-weight:600; }

.modal-body{ display:grid; gap:18px; }
@media (min-width:760px){
  .modal-body{ grid-template-columns:1fr 220px; align-items:start; }
}

.form-grid{ display:grid; gap:14px; }
@media (min-width:520px){
  .form-grid.cols-2{ grid-template-columns:1fr 1fr; }
}

.field label{
  display:block; font-size:13px; font-weight:600; color:var(--text-secondary);
  margin-bottom:7px;
}
.field label .req{ color:var(--danger); }

.field-row{ display:flex; gap:10px; }
.field-row .neu-inset{ flex-shrink:0; width:64px; text-align:center; }
.field-row .neu-inset + .neu-inset{ flex:1; width:auto; }

.input-el{
  width:100%; border:none; outline:none; background:transparent;
  padding:13px 15px; font-size:14px; color:var(--text-primary);
  border-radius:var(--radius-sm);
}
.input-el::placeholder{ color:var(--text-muted); }
textarea.input-el{ resize:vertical; min-height:80px; font-family:var(--font-body); }

.field-error{ font-size:11.5px; color:var(--danger); margin-top:5px; display:none; }
.field.invalid .neu-inset{ box-shadow: inset 3px 3px 6px rgba(255,107,107,.25), inset -3px -3px 6px var(--shadow-light); }
.field.invalid .field-error{ display:block; }

/* toggle switch */
.switch-row{ display:flex; align-items:center; gap:12px; }
.switch{ position:relative; width:46px; height:26px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch .track{
  position:absolute; inset:0; border-radius:var(--radius-pill);
  background:var(--bg); box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  transition:background .2s ease;
}
.switch .thumb{
  position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%;
  background:var(--bg-elevated); box-shadow:2px 2px 5px var(--shadow-dark), -2px -2px 5px var(--shadow-light);
  transition:transform .2s ease;
}
.switch input:checked + .track{ background:var(--accent-soft); }
.switch input:checked + .track .thumb{ transform:translateX(20px); background:var(--accent); }
.switch-row .switch-label{ font-size:13.5px; color:var(--text-secondary); font-weight:500; }

/* photo uploader */
.photo-upload{
  display:flex; flex-direction:column; align-items:center; gap:10px;
}
.photo-frame{
  width:100%; max-width:220px; aspect-ratio:3/4;
  border-radius:20px; overflow:hidden; position:relative; cursor:pointer;
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}
.photo-frame img{ width:100%; height:100%; object-fit:cover; display:block; }
.photo-frame .overlay{
  position:absolute; inset:0; background:rgba(53,65,96,.0);
  display:flex; align-items:center; justify-content:center; color:#fff;
  opacity:0; transition:opacity .15s ease, background .15s ease; font-size:12px; text-align:center; padding:10px;
}
.photo-frame:hover .overlay{ opacity:1; background:rgba(53,65,96,.45); }
.photo-hint{ font-size:11.5px; color:var(--text-secondary); text-align:center; }

.modal-footer{
  display:flex; justify-content:flex-end; gap:10px; margin-top:22px;
  padding-top:16px; border-top:1px solid rgba(179,188,203,.35);
}

/* =========================================================
   Bottom navigation
   ========================================================= */

.bottom-nav{
  position:fixed; left:0; right:0; bottom:0; z-index:60;
  height:var(--nav-h);
  background:var(--bg-elevated);
  box-shadow: 0 -6px 18px rgba(179,188,203,.5);
  border-radius:24px 24px 0 0;
  display:flex; align-items:center; justify-content:space-around;
  padding-bottom:env(safe-area-inset-bottom);
}
.bottom-nav .nav-item{
  display:flex; flex-direction:column; align-items:center; gap:4px;
  color:var(--text-muted); font-size:10.5px; font-weight:600;
  padding:8px 10px; border-radius:14px; min-width:56px;
  transition:color .15s ease;
}
.bottom-nav .nav-item .nav-icon{
  width:38px; height:38px; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s ease, box-shadow .15s ease;
}
.bottom-nav .nav-item.active{ color:var(--accent-dark); }
.bottom-nav .nav-item.active .nav-icon{
  background:var(--bg);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}
.bottom-nav .nav-item.nav-add .nav-icon{
  width:50px; height:50px; margin-top:-26px; border-radius:16px;
  background:linear-gradient(145deg,#6f8fff,#4361ee); color:#fff;
  box-shadow: 6px 6px 14px rgba(67,97,238,.4), -4px -4px 10px rgba(255,255,255,.6);
}
.bottom-nav .nav-item.nav-add{ color:var(--accent-dark); }

@media (min-width:900px){
  .bottom-nav{ display:none; }
  .app-shell{ padding-bottom:24px; }
  .fab{ display:none; }
}

/* =========================================================
   Login page
   ========================================================= */

.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:24px; background:var(--bg);
}
.login-card{
  width:100%; max-width:380px; padding:34px 28px;
  display:flex; flex-direction:column; gap:20px;
}
.login-logo{
  width:64px; height:64px; border-radius:20px; margin:0 auto;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(145deg,#6f8fff,#4361ee); color:#fff;
  font-family:var(--font-display); font-weight:700; font-size:22px;
  box-shadow: 8px 8px 16px rgba(67,97,238,.35), -6px -6px 14px rgba(255,255,255,.6);
}
.login-title{ text-align:center; }
.login-title h1{ font-size:20px; margin-bottom:4px; }
.login-title p{ font-size:13px; color:var(--text-secondary); }

.alert{
  padding:12px 14px; border-radius:14px; font-size:13px; font-weight:500;
  display:flex; align-items:center; gap:10px;
}
.alert-danger{ background:#ffe8e8; color:var(--danger-dark); }
.alert-success{ background:#e3f9ef; color:#1f9d6f; }

/* =========================================================
   Toast
   ========================================================= */

.toast-container{
  position:fixed; top:16px; left:50%; transform:translateX(-50%);
  z-index:200; display:flex; flex-direction:column; gap:10px; width:min(92vw,380px);
}
.toast{
  padding:13px 16px; border-radius:16px; font-size:13.5px; font-weight:500;
  background:var(--bg-elevated); color:var(--text-primary);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  display:flex; align-items:center; gap:10px;
  animation:toast-in .25s ease;
}
.toast.success{ color:#1f9d6f; }
.toast.error{ color:var(--danger-dark); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(-10px); } to{ opacity:1; transform:translateY(0); } }

/* =========================================================
   Misc utility
   ========================================================= */

.flex{ display:flex; }
.items-center{ align-items:center; }
.gap-8{ gap:8px; }
.gap-12{ gap:12px; }
.mt-8{ margin-top:8px; }
.text-secondary{ color:var(--text-secondary); }
.text-sm{ font-size:12.5px; }
.spin{ animation:spin 1s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.skeleton{
  border-radius:14px; background:linear-gradient(90deg,var(--bg) 25%,#f1f4f8 37%,var(--bg) 63%);
  background-size:400% 100%; animation:skeleton 1.4s ease infinite;
}
@keyframes skeleton{ 0%{background-position:100% 50%;} 100%{background-position:0 50%;} }
