/* ============================================================
   APLIKASI INVENTORY DAPUR - Custom Stylesheet
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary:       #FF6B35;
  --primary-dark:  #e55a24;
  --primary-light: #fff0eb;
  --secondary:     #2C3E50;
  --sidebar-w:     260px;
  --sidebar-bg:    #1a1f2e;
  --sidebar-text:  #a8b2c1;
  --sidebar-hover: rgba(255,107,53,0.15);
  --sidebar-active:#FF6B35;
  --topbar-h:      64px;
  --card-radius:   14px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,.08);
  --shadow-md:     0 4px 20px rgba(0,0,0,.12);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.16);
  --transition:    .25s cubic-bezier(.4,0,.2,1);
  --font-family:   'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: #f4f6fb;
  color: #2C3E50;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #c5c9d4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9fa6b2; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-title {
  font-size: .95rem; font-weight: 700;
  color: #fff; letter-spacing: -.01em;
}
.sidebar-brand-sub {
  font-size: .72rem; color: rgba(255,255,255,.45);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 0;
}

.sidebar-section {
  padding: 16px 20px 6px;
  font-size: .68rem; font-weight: 600;
  color: rgba(255,255,255,.3);
  letter-spacing: .08em; text-transform: uppercase;
}

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem; font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}

.sidebar-link i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-link:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

.sidebar-link.active {
  color: #fff;
  background: var(--sidebar-hover);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-link.active i { color: var(--primary); }

.sidebar-badge {
  margin-left: auto;
  font-size: .68rem; padding: 2px 7px;
  border-radius: 20px; font-weight: 600;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-footer-text {
  font-size: .72rem; color: rgba(255,255,255,.3); text-align: center;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-w);
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  display: flex; align-items: center;
  padding: 0 28px;
  z-index: 1030;
  gap: 14px;
  transition: left var(--transition);
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  border: none; background: none;
  font-size: 1.3rem; color: #666;
  cursor: pointer; padding: 4px;
  border-radius: 8px;
}
.topbar-toggle:hover { background: #f0f2f5; }

.topbar-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--secondary); flex: 1;
}
.topbar-subtitle {
  display: block; font-size: .72rem;
  font-weight: 400; color: #888;
}

.topbar-date {
  font-size: .8rem; color: #888;
  background: #f4f6fb; padding: 6px 14px;
  border-radius: 20px;
}

.topbar-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 10px; border: none;
  background: #f4f6fb; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #666; font-size: 1rem;
  transition: background var(--transition);
}
.topbar-btn:hover { background: #e8ecf0; }
.topbar-btn .badge {
  position: absolute; top: -3px; right: -3px;
  font-size: .6rem; padding: 2px 5px;
}

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 10px;
  cursor: pointer; border: none; background: #f4f6fb;
  transition: background var(--transition);
}
.topbar-user:hover { background: #e8ecf0; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); display: flex;
  align-items: center; justify-content: center;
  color: #fff; font-size: .8rem; font-weight: 700;
}
.topbar-user-name { font-size: .82rem; font-weight: 600; color: #333; }
.topbar-user-role { font-size: .7rem; color: #999; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.page-content { padding: 28px; }

.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-left h1 {
  font-size: 1.4rem; font-weight: 700; color: var(--secondary);
}
.page-header-left p { font-size: .85rem; color: #888; margin-top: 2px; }

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 18px;
  border: 1px solid #f0f2f5;
  transition: all var(--transition);
  height: 100%;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}

.stat-icon.orange  { background: #fff0eb; color: var(--primary); }
.stat-icon.blue    { background: #eff6ff; color: #3b82f6; }
.stat-icon.green   { background: #f0fdf4; color: #22c55e; }
.stat-icon.red     { background: #fff1f2; color: #f43f5e; }
.stat-icon.yellow  { background: #fefce8; color: #eab308; }
.stat-icon.purple  { background: #faf5ff; color: #a855f7; }
.stat-icon.teal    { background: #f0fdfa; color: #14b8a6; }
.stat-icon.indigo  { background: #eef2ff; color: #6366f1; }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: #888; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 1.55rem; font-weight: 800;
  color: var(--secondary); line-height: 1.2;
  margin-top: 4px;
}
.stat-value.small { font-size: 1.15rem; }
.stat-trend {
  font-size: .75rem; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.stat-trend.up   { color: #22c55e; }
.stat-trend.down { color: #f43f5e; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  border: 1px solid #f0f2f5 !important;
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-sm) !important;
}
.card-header {
  background: #fff !important;
  border-bottom: 1px solid #f0f2f5 !important;
  padding: 16px 20px !important;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}
.card-title {
  font-size: .95rem; font-weight: 700;
  color: var(--secondary); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 20px !important; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid #f0f2f5;
  overflow: hidden;
}
.table-wrapper .table-header {
  padding: 16px 20px;
  display: flex; align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0f2f5;
  flex-wrap: wrap; gap: 12px;
}
.table-wrapper .table-header h5 {
  font-size: .95rem; font-weight: 700;
  color: var(--secondary); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.table-wrapper .table-header h5 i { color: var(--primary); }

.table { margin: 0; }
.table thead th {
  background: #f8fafc;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: #666; border-bottom: 2px solid #e8ecf0;
  padding: 12px 16px; white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #fafbfc; }
.table td {
  padding: 12px 16px; vertical-align: middle;
  border-color: #f0f2f5; font-size: .875rem;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-label {
  font-size: .82rem; font-weight: 600;
  color: #555; margin-bottom: 6px;
}

.form-control, .form-select {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
  outline: none;
}
.form-control::placeholder { color: #bbb; }

.search-box {
  position: relative; max-width: 280px;
}
.search-box i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: #aaa; font-size: .9rem;
  pointer-events: none;
}
.search-box input {
  padding-left: 36px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  font-size: .82rem;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  border-radius: 10px !important;
  font-weight: 600 !important;
  font-size: .85rem !important;
  padding: 8px 18px !important;
  transition: all var(--transition) !important;
  display: inline-flex !important;
  align-items: center !important; gap: 7px !important;
}
.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,107,53,.35) !important;
}
.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
  background: var(--primary) !important;
  color: #fff !important;
}
.btn-sm { padding: 5px 12px !important; font-size: .78rem !important; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0 !important; border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important; justify-content: center !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: .72rem; font-weight: 600; padding: 4px 9px; border-radius: 6px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
  border-radius: 16px !important;
  border: none !important;
  box-shadow: var(--shadow-lg) !important;
}
.modal-header {
  border-bottom: 1px solid #f0f2f5 !important;
  padding: 18px 24px !important;
}
.modal-title {
  font-size: 1rem; font-weight: 700;
  color: var(--secondary);
  display: flex; align-items: center; gap: 8px;
}
.modal-title i { color: var(--primary); }
.modal-body { padding: 20px 24px !important; }
.modal-footer {
  border-top: 1px solid #f0f2f5 !important;
  padding: 14px 24px !important;
}
.btn-close { opacity: .6 !important; }
.btn-close:hover { opacity: 1 !important; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
  border-radius: 10px; overflow: hidden;
  background: #f0f2f5;
}
.progress-bar { transition: width .8s ease; }

/* ============================================================
   STOK INDICATOR
   ============================================================ */
.stok-badge-ok      { color: #22c55e; font-weight: 700; }
.stok-badge-menipis { color: #f59e0b; font-weight: 700; }
.stok-badge-habis   { color: #f43f5e; font-weight: 700; }

.stock-alert-row { background: #fff8f5 !important; }
.stock-danger-row { background: #fff1f2 !important; }

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container { position: relative; }
.chart-container canvas { max-height: 280px; }

/* ============================================================
   ALERTS & TOASTS
   ============================================================ */
.alert {
  border-radius: 10px !important;
  border: none !important;
  font-size: .875rem;
}
.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger   { background: #fff1f2; color: #be123c; }
.alert-warning  { background: #fefce8; color: #854d0e; }
.alert-info     { background: #eff6ff; color: #1d4ed8; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 48px 24px;
}
.empty-state-icon {
  font-size: 3.5rem; margin-bottom: 16px;
  opacity: .35;
}
.empty-state h5 {
  font-size: 1rem; font-weight: 700;
  color: var(--secondary); margin-bottom: 8px;
}
.empty-state p { font-size: .875rem; color: #888; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination .page-link {
  border-radius: 8px !important;
  border-color: #e8ecf0;
  font-size: .82rem; color: #555;
  padding: 6px 12px;
  transition: all var(--transition);
}
.pagination .page-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e8ecf0 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }

/* ============================================================
   TRANSITIONS & ANIMATIONS
   ============================================================ */
.fade-in {
  animation: fadeIn .35s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-in-left {
  animation: slideInLeft .3s ease forwards;
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.show { display: block; }

  .topbar {
    left: 0;
  }
  .topbar-toggle { display: flex; }
  .topbar-date   { display: none; }

  .main-content { margin-left: 0; }

  .page-content { padding: 16px; }
  .stat-value   { font-size: 1.25rem; }
  .page-header  { margin-bottom: 16px; }
}

@media (max-width: 575.98px) {
  .topbar { padding: 0 14px; }
  .page-content { padding: 12px; }
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.15rem; }
  .search-box { max-width: 100%; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-orange  { color: var(--primary) !important; }
.bg-orange    { background: var(--primary) !important; }
.bg-orange-lt { background: var(--primary-light) !important; }
.rounded-xl   { border-radius: 14px !important; }
.fw-800       { font-weight: 800 !important; }
.text-muted-sm{ font-size: .78rem; color: #888; }
.gap-2        { gap: .5rem !important; }
.gap-3        { gap: 1rem !important; }
.cursor-pointer { cursor: pointer; }
.border-dashed { border-style: dashed !important; }

/* Rupiah color */
.text-income { color: #22c55e; font-weight: 700; }
.text-expense { color: #f43f5e; font-weight: 700; }

/* Nomor urut */
.row-number {
  width: 28px; height: 28px;
  background: #f4f6fb; border-radius: 50%;
  display: inline-flex; align-items: center;
  justify-content: center; font-size: .72rem;
  font-weight: 700; color: #666;
}

/* Filter bar */
.filter-bar {
  background: #fff; padding: 14px 20px;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid #f0f2f5;
  margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
