/* ============================================================
   APOTEK SEHAT SENTOSA - Main Stylesheet
   Font: Syne (display) + DM Sans (body)
   Theme: Deep Teal + Amber accent + Clean white
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  --primary:      #0d6e6e;
  --primary-dark: #094f4f;
  --primary-light:#e6f4f4;
  --accent:       #f59e0b;
  --accent-dark:  #d97706;
  --danger:       #ef4444;
  --success:      #10b981;
  --warning:      #f59e0b;
  --info:         #3b82f6;
  --dark:         #1a2332;
  --gray-900:     #111827;
  --gray-700:     #374151;
  --gray-500:     #6b7280;
  --gray-300:     #d1d5db;
  --gray-100:     #f3f4f6;
  --gray-50:      #f9fafb;
  --white:        #ffffff;
  --sidebar-w:    260px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition:   all .2s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--gray-700);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
  box-shadow: 0 0 0 4px rgba(13,110,110,.25);
}
.sidebar-brand .brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--white);
  letter-spacing: .5px;
  line-height: 1.3;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

.sidebar-nav { padding: 16px 0; flex: 1; }

.nav-section {
  padding: 0 16px;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  margin-top: 20px;
}
.nav-section:first-child { margin-top: 0; }

.nav-item { margin: 2px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: var(--white); }
.nav-link.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(13,110,110,.4);
}
.nav-link .nav-icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-link .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 12.5px; color: white; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: rgba(255,255,255,.4); text-transform: capitalize; }
.sidebar-user .logout-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  transition: var(--transition);
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user .logout-btn:hover { background: rgba(239,68,68,.2); color: var(--danger); }

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

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  padding: 0 28px;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--dark);
}
.breadcrumb-mini { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 6px; }
.breadcrumb-mini a { color: var(--primary); text-decoration: none; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12px; color: var(--gray-500); }
.topbar-clock { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--primary); }

.main-content { padding: 24px 28px; flex: 1; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-300);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white);
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--dark);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-300);
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.teal    { background: var(--primary-light); color: var(--primary); }
.stat-icon.amber   { background: #fef3c7; color: var(--accent-dark); }
.stat-icon.green   { background: #d1fae5; color: var(--success); }
.stat-icon.red     { background: #fee2e2; color: var(--danger); }
.stat-icon.blue    { background: #dbeafe; color: var(--info); }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; color: var(--dark); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--gray-500); margin-top: 3px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: 0 4px 12px rgba(13,110,110,.35); }
.btn-accent  { background: var(--accent); color: white; }
.btn-accent:hover  { background: var(--accent-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #dc2626; color: white; }
.btn-info    { background: var(--info); color: white; }
.btn-info:hover    { background: #2563eb; color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-outline-primary { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-icon { padding: 7px; }
.btn-block { width: 100%; justify-content: center; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl thead th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-300);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--gray-50); }
.tbl tfoot td {
  padding: 11px 14px;
  font-weight: 600;
  background: var(--gray-50);
  border-top: 2px solid var(--gray-300);
}
.tbl .text-right { text-align: right; }
.tbl .text-center { text-align: center; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray     { background: var(--gray-100); color: var(--gray-700); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--gray-900);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,110,110,.12); }
.form-control::placeholder { color: var(--gray-300); }
.form-control:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: 8px 0 0 8px; flex: 1; }
.input-group .input-addon { padding: 9px 12px; background: var(--gray-100); border: 1.5px solid var(--gray-300); border-left: none; border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--gray-500); display: flex; align-items: center; white-space: nowrap; }
.input-prefix .input-addon { border-left: 1.5px solid var(--gray-300); border-right: none; border-radius: 8px 0 0 8px; }
.input-prefix .form-control { border-radius: 0 8px 8px 0; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-icon    { font-size: 16px; margin-top: 1px; flex-shrink: 0; }

/* ---- GRID ---- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---- UTILITIES ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold  { font-weight: 700; }
.fw-semi  { font-weight: 600; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.w-100 { width: 100%; }
.flex-1 { flex: 1; }
.nowrap { white-space: nowrap; }
.font-mono { font-family: 'Courier New', monospace; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
}
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 16px 0; }

/* ---- FILTER BAR ---- */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
}
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-label { font-size: 11px; margin-bottom: 4px; }
.filter-bar .form-control { padding: 7px 10px; font-size: 13px; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 999;
  background: rgba(17,24,39,.5);
  backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; color: var(--dark); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--gray-500); line-height: 1; padding: 0; transition: var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; background: var(--gray-50); }

/* ---- PRINT ---- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  body { background: white; font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
  .btn { display: none; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ---- ANIMATIONS ---- */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- TOOLTIP ---- */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: 120%; left: 50%;
  transform: translateX(-50%);
  background: var(--dark); color: white;
  font-size: 11px; padding: 4px 8px; border-radius: 5px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ---- STOK INDICATOR ---- */
.stok-ok      { color: var(--success); font-weight: 600; }
.stok-low     { color: var(--warning); font-weight: 600; }
.stok-empty   { color: var(--danger); font-weight: 600; }

/* ---- NUMBER FORMAT ---- */
.rupiah { font-family: 'Syne', sans-serif; font-weight: 600; }
