/* New Kembang Daman - Style v2.0 - Mobile First */
:root {
  --primary: #1a4d6e;
  --primary-dark: #0d3350;
  --primary-light: #2980b9;
  --secondary: #e8a818;
  --accent: #27ae60;
  --danger: #e74c3c;
  --bg-light: #f4f7fb;
  --text-dark: #1a2a3a;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 15px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --sidebar-width: 240px;
}

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

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg-light);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }

/* ========== NAVBAR PUBLIK ========== */
.navbar-kd {
  background: var(--primary);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.navbar-kd .navbar-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
}
.navbar-kd .navbar-brand img { width: 36px; height: 36px; border-radius: 6px; }
.navbar-kd .brand-text { line-height: 1.2; }
.navbar-kd .brand-text small { font-size: .65rem; font-weight: 400; opacity: .8; display: block; }
.navbar-kd .nav-link { color: rgba(255,255,255,.85) !important; font-size: .85rem; padding: .5rem .75rem; border-radius: 6px; transition: all .2s; }
.navbar-kd .nav-link:hover, .navbar-kd .nav-link.active { color: #fff !important; background: rgba(255,255,255,.15); }
.navbar-toggler { border-color: rgba(255,255,255,.3); }
.navbar-toggler-icon { filter: invert(1); }

/* ========== HERO BERANDA ========== */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; position: relative; }
.hero-subtitle { font-size: .9rem; opacity: .85; margin-bottom: 1.5rem; position: relative; }

/* ========== CARDS LAYANAN ========== */
.layanan-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: none;
  transition: transform .2s, box-shadow .2s;
  height: 100%;
  text-decoration: none;
  color: inherit;
  display: block;
}
.layanan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: inherit;
}
.layanan-card .icon-wrap {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: .75rem;
}
.layanan-card h6 { font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
.layanan-card p { font-size: .75rem; color: var(--text-muted); margin: 0; }

/* ========== STATUS BADGE ========== */
.badge-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: .25rem .65rem; border-radius: 20px; font-size: .7rem; font-weight: 600;
}

/* ========== TIMELINE STATUS ========== */
.timeline-status { position: relative; padding: 0; list-style: none; margin: 0; }
.timeline-status li {
  display: flex; align-items: flex-start; gap: .75rem;
  padding-bottom: 1rem; position: relative;
}
.timeline-status li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 16px; top: 32px;
  width: 2px; bottom: 0;
  background: var(--border);
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0; font-weight: 700;
}

/* ========== ADMIN LAYOUT ========== */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  min-height: 100vh;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .3s;
}
.admin-sidebar .nav-link {
  color: rgba(255,255,255,.75);
  font-size: .82rem;
  padding: .45rem .75rem;
  border-radius: 8px;
  transition: all .2s;
}
.admin-sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.admin-sidebar .nav-link.active { color: #fff; background: var(--primary-light); }
.admin-sidebar .nav-link i { width: 18px; }

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin .3s;
}
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.admin-content { padding: 1.25rem; }

/* Sidebar mobile toggle */
#sidebarToggle {
  display: none;
  background: transparent; border: none;
  font-size: 1.3rem; color: var(--primary); cursor: pointer;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 999;
}

/* ========== CARDS ADMIN ========== */
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow); border: none;
}
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); }

/* ========== TABLE ========== */
.table-kd thead th {
  background: var(--primary); color: #fff;
  font-size: .78rem; font-weight: 600; padding: .6rem .85rem;
  border: none; white-space: nowrap;
}
.table-kd tbody td { font-size: .82rem; padding: .55rem .85rem; vertical-align: middle; border-color: #f0f0f0; }
.table-kd tbody tr:hover { background: rgba(26,77,110,.04); }
.table-responsive { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* ========== FORMS ========== */
.form-label { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm); border-color: var(--border);
  font-size: .85rem; padding: .55rem .85rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 .2rem rgba(41,128,185,.15);
}

/* ========== BUTTONS ========== */
.btn { border-radius: var(--radius-sm); font-size: .82rem; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--accent); border-color: var(--accent); }

/* ========== CARD SECTION ========== */
.card { border-radius: var(--radius); border: none; box-shadow: var(--shadow); }
.card-header { border-radius: var(--radius) var(--radius) 0 0 !important; border-bottom: 1px solid rgba(0,0,0,.06); }

/* ========== NOTIF BADGE ========== */
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: .65rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ========== STEP WIZARD ========== */
.step-wizard { display: flex; align-items: center; margin-bottom: 1.5rem; overflow-x: auto; padding-bottom: 4px; }
.step-item { display: flex; align-items: center; flex-shrink: 0; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; background: #ddd; color: #999;
}
.step-num.active { background: var(--primary); color: #fff; }
.step-num.done { background: var(--accent); color: #fff; }
.step-label { font-size: .7rem; margin-left: .4rem; color: var(--text-muted); white-space: nowrap; }
.step-line { height: 2px; width: 30px; background: #ddd; flex-shrink: 0; }
.step-line.done { background: var(--accent); }

/* ========== LACAK PAGE ========== */
.tracking-box {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 1.5rem; margin: 1rem 0;
}

/* ========== MODAL ========== */
.modal-content { border-radius: var(--radius); border: none; }
.modal-header { background: var(--primary); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header .btn-close { filter: invert(1); }

/* ========== UPLOAD AREA ========== */
.upload-area {
  border: 2px dashed var(--primary-light); border-radius: var(--radius-sm);
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: all .2s; background: rgba(41,128,185,.04);
}
.upload-area:hover { background: rgba(41,128,185,.08); border-style: solid; }
.upload-area.dragover { background: rgba(41,128,185,.12); }

/* ========== DISPOSISI ========== */
.disposisi-penerima {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem;
}
.penerima-chip {
  background: var(--primary-light); color: #fff;
  padding: .2rem .65rem; border-radius: 20px; font-size: .72rem;
  display: flex; align-items: center; gap: .3rem;
}

/* ========== QR CODE ========== */
.qr-placeholder {
  width: 80px; height: 80px; border: 2px dashed #aaa;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; color: #aaa; text-align: center;
  border-radius: 4px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 767.98px) {
  #sidebarToggle { display: block; }
  .admin-sidebar {
    transform: translateX(-100%);
    width: 260px;
    z-index: 1050;
  }
  .admin-sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .admin-main { margin-left: 0; }
  .admin-content { padding: .85rem; }
  .hero-title { font-size: 1.2rem; }
  .stat-card .stat-num { font-size: 1.3rem; }
  .table-kd thead th, .table-kd tbody td { font-size: .75rem; padding: .45rem .6rem; }
  .btn { font-size: .78rem; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  :root { --sidebar-width: 200px; }
  .admin-sidebar .nav-link { font-size: .78rem; }
}

/* ========== PRINT ========== */
@media print {
  .admin-sidebar, .admin-topbar, .btn, .modal, nav { display: none !important; }
  .admin-main { margin-left: 0 !important; }
  body { background: #fff !important; }
}

/* ========== UTILS ========== */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.rounded-kd { border-radius: var(--radius); }
.shadow-kd { box-shadow: var(--shadow); }
.hover-lift { transition: transform .2s; }
.hover-lift:hover { transform: translateY(-2px); }
