/* =====================================================================
   E-ARSIP SURAT MA BAHRUL ULUM KEPOHBARU
   Neumorphism Design System - style.css
   ===================================================================== */

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

:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-bg: #F8FAFC;
  --color-bg-alt: #E2E8F0;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #3B82F6;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --surface: #F8FAFC;
  --shadow-light: #FFFFFF;
  --shadow-dark: #C8D0DA;
  --radius: 20px;
  --radius-sm: 12px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
  --bottomnav-height: 68px;
}

[data-theme="dark"] {
  --color-bg: #1A1F2C;
  --color-bg-alt: #232838;
  --surface: #1E2433;
  --shadow-light: #2A3142;
  --shadow-dark: #12151E;
  --color-text: #E8ECF3;
  --color-text-muted: #94A3B8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  transition: var(--transition);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .brand, .font-poppins { font-family: 'Poppins', sans-serif; }

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--shadow-dark); border-radius: 10px; }

/* ---------------------------------------------------------------------
   Neumorphism Base Components
   --------------------------------------------------------------------- */
.neu {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  transition: var(--transition);
}

.neu-inset {
  background: var(--surface);
  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(--surface);
  border-radius: var(--radius-sm);
  box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 8px 8px 20px var(--shadow-dark), -8px -8px 20px var(--shadow-light);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { transform: translateY(-2px); }

/* Glassmorphism (dashboard summary cards) */
.glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,255,255,0.15));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.12);
  padding: 22px;
  color: var(--color-text);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .glass-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
}

.glass-card .icon-box {
  width: 52px; height: 52px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.icon-blue { background: rgba(37,99,235,0.15); color: var(--color-primary); }
.icon-green { background: rgba(16,185,129,0.15); color: var(--color-success); }
.icon-orange { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.icon-red { background: rgba(239,68,68,0.15); color: var(--color-danger); }

.glass-card .value { font-size: 30px; font-weight: 700; font-family: 'Poppins', sans-serif; }
.glass-card .label { color: var(--color-text-muted); font-size: 13px; margin-top: 4px; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: none; border-radius: 14px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--color-text);
  box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  transition: var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light); transform: translateY(0); }

.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 5px 5px 14px rgba(37,99,235,0.35); }
.btn-success { background: var(--color-success); color: #fff; box-shadow: 5px 5px 14px rgba(16,185,129,0.3); }
.btn-danger { background: var(--color-danger); color: #fff; box-shadow: 5px 5px 14px rgba(239,68,68,0.3); }
.btn-outline { background: transparent; box-shadow: none; border: 1.5px solid var(--shadow-dark); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; color: var(--color-text-muted); }
.form-control {
  width: 100%; padding: 13px 16px;
  background: var(--surface); color: var(--color-text);
  border: none; border-radius: 14px;
  box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light);
  font-family: 'Inter', sans-serif; font-size: 14.5px;
  transition: var(--transition);
}
.form-control:focus { outline: none; box-shadow: inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light), 0 0 0 3px rgba(37,99,235,0.25); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 44px; }
.input-icon-wrap .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--shadow-dark);
  border-radius: var(--radius-sm);
  padding: 30px 16px; text-align: center; cursor: pointer;
  transition: var(--transition);
}
.dropzone.dragover { border-color: var(--color-primary); background: rgba(37,99,235,0.06); }
.dropzone .dz-icon { font-size: 32px; color: var(--color-primary); margin-bottom: 8px; }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge { display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-info { background: rgba(59,130,246,0.15); color: #2563EB; }
.badge-success { background: rgba(16,185,129,0.15); color: #059669; }
.badge-warning { background: rgba(245,158,11,0.15); color: #B45309; }
.badge-danger { background: rgba(239,68,68,0.15); color: #DC2626; }
.badge-secondary { background: rgba(100,116,139,0.15); color: #475569; }

/* ---------------------------------------------------------------------
   Layout: Desktop Sidebar
   --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  box-shadow: 6px 0 18px rgba(0,0,0,0.05);
  padding: 24px 18px;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: var(--transition);
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 24px; }
.sidebar .brand img { width: 42px; height: 42px; border-radius: 12px; }
.sidebar .brand-text { font-size: 15px; font-weight: 700; line-height: 1.3; }
.sidebar .brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--color-text-muted); }

.nav-menu { flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px; margin-bottom: 6px;
  color: var(--color-text-muted); font-size: 14px; font-weight: 500;
  transition: var(--transition); cursor: pointer;
}
.nav-item i { width: 20px; text-align: center; font-size: 17px; }
.nav-item:hover { background: rgba(37,99,235,0.08); color: var(--color-primary); }
.nav-item.active {
  background: var(--color-primary); color: #fff;
  box-shadow: 4px 4px 12px rgba(37,99,235,0.35);
}
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin: 16px 6px 8px; }

.sidebar-footer { padding-top: 14px; border-top: 1px solid var(--shadow-dark); }

.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 26px 30px 40px; transition: var(--transition); min-width: 0; }

/* ---------------------------------------------------------------------
   Topbar
   --------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 14px; flex-wrap: wrap;
}
.topbar-search { flex: 1; max-width: 420px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; }
.user-chip img, .user-chip .avatar-fallback {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover;
  background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-chip .u-name { font-size: 13.5px; font-weight: 600; }
.user-chip .u-role { font-size: 11.5px; color: var(--color-text-muted); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: none;
  background: var(--surface); box-shadow: 5px 5px 10px var(--shadow-dark), -5px -5px 10px var(--shadow-light);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; font-size: 17px;
  color: var(--color-text);
}
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-danger); }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; font-family: 'Poppins', sans-serif; }
.page-subtitle { color: var(--color-text-muted); font-size: 13.5px; margin-top: 4px; }
.breadcrumb { font-size: 12.5px; color: var(--color-text-muted); margin-bottom: 6px; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
.data-table th {
  text-align: left; padding: 14px 16px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--color-text-muted); background: var(--color-bg-alt); position: sticky; top: 0;
}
.data-table th:first-child { border-top-left-radius: 14px; }
.data-table th:last-child { border-top-right-radius: 14px; }
.data-table td { padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid var(--color-bg-alt); }
.data-table tr:hover td { background: rgba(37,99,235,0.04); }
.data-table .row-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------------------
   Skeleton Loading
   --------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-alt) 25%, rgba(255,255,255,0.5) 50%, var(--color-bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s ease-in-out infinite;
  border-radius: 10px;
}
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------------------------------------------------------------------
   Toast Notifications
   --------------------------------------------------------------------- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 280px; max-width: 360px; padding: 14px 18px; border-radius: 14px;
  background: var(--surface); box-shadow: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
  display: flex; align-items: center; gap: 12px;
  animation: toast-in 0.35s ease forwards;
  border-left: 4px solid var(--color-info);
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast .t-icon { font-size: 20px; }
.toast .t-text { font-size: 13.5px; flex: 1; }
.toast .t-close { cursor: pointer; opacity: 0.5; }
@keyframes toast-in { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 640px) { #toast-container { left: 16px; right: 16px; top: 16px; } .toast { min-width: 0; width: 100%; } }

/* ---------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 26px; width: 100%; max-width: 480px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-weight: 700; font-size: 17px; }

/* ---------------------------------------------------------------------
   Login Page
   --------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 20% 20%, rgba(37,99,235,0.08), transparent 40%), var(--color-bg); }
.login-box { width: 100%; max-width: 420px; padding: 40px 34px; text-align: center; }
.login-box .logo { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 16px; background: var(--color-primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; box-shadow: 8px 8px 20px rgba(37,99,235,0.35); }
.login-box h1 { font-size: 18px; margin-bottom: 2px; }
.login-box p.sub { color: var(--color-text-muted); font-size: 13px; margin-bottom: 28px; }
.login-box form { text-align: left; }
.remember-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 20px; color: var(--color-text-muted); }
.remember-row a { color: var(--color-primary); font-weight: 600; }
.captcha-row { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.captcha-box { font-family: 'Poppins', sans-serif; font-weight: 700; letter-spacing: 4px; font-size: 20px; padding: 10px 18px; user-select: none; }

/* ---------------------------------------------------------------------
   Bottom Navigation (Mobile)
   --------------------------------------------------------------------- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottomnav-height);
  background: var(--surface); box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
  z-index: 200; padding: 8px 6px; justify-content: space-around; align-items: center;
  border-top-left-radius: 22px; border-top-right-radius: 22px;
}
.bottom-nav .bn-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; color: var(--color-text-muted); flex: 1; padding: 6px 0; border-radius: 14px; }
.bottom-nav .bn-item i { font-size: 19px; }
.bottom-nav .bn-item.active { color: var(--color-primary); font-weight: 600; }

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 768px) {
  .main-content { padding: 18px 16px 90px; }
  .bottom-nav { display: flex; }
  .topbar-search { order: 3; max-width: 100%; width: 100%; }
  .glass-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Grid helpers */
.glass-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

.text-muted { color: var(--color-text-muted); }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.d-flex{display:flex}.align-center{align-items:center}.justify-between{justify-content:space-between}.gap-2{gap:12px}
.w-full{width:100%}
.text-center{text-align:center}
.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }
.empty-state i { font-size: 46px; margin-bottom: 14px; opacity: 0.5; }
