/* ============================================================
   HAMRO RMS — Custom Styles
   Pair with Tailwind CSS (CDN or local build)
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --amber:       #F59E0B;
  --amber-light: #FCD34D;
  --amber-dark:  #D97706;
  --charcoal:    #1C1917;
  --charcoal-2:  #292524;
  --charcoal-3:  #3D3835;
  --surface:     #28231F;
  --text-primary:#F5F0EB;
  --text-muted:  #A8A29E;
  --danger:      #EF4444;
  --success:     #10B981;
  --info:        #3B82F6;
  --warning:     #F59E0B;
  --sidebar-w:   250px;
  --topbar-h:    64px;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,0.35);
  --transition:  all 0.22s cubic-bezier(0.4,0,0.2,1);
}

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

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

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--charcoal);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5 { font-family: 'Syne', sans-serif; font-weight: 700; line-height: 1.2; }

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-light); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--charcoal-2); }
::-webkit-scrollbar-thumb { background: var(--charcoal-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--amber-dark); }

/* ── Page Load Animation ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes pulse-amber {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.anim-fade-up    { animation: fadeUp 0.45s ease both; }
.anim-fade-in    { animation: fadeIn 0.3s ease both; }
.anim-delay-1    { animation-delay: 0.06s; }
.anim-delay-2    { animation-delay: 0.12s; }
.anim-delay-3    { animation-delay: 0.18s; }
.anim-delay-4    { animation-delay: 0.24s; }
.anim-delay-5    { animation-delay: 0.30s; }

/* ── Admin Layout ─────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--charcoal-2);
  border-right: 1px solid var(--charcoal-3);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--charcoal-3);
}

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

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 18px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(245,158,11,0.06);
  border-left-color: rgba(245,158,11,0.3);
}
.nav-item.active {
  color: var(--amber);
  background: rgba(245,158,11,0.10);
  border-left-color: var(--amber);
}
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--charcoal-3);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--charcoal-2);
  border-bottom: 1px solid var(--charcoal-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 { font-size: 1.6rem; }
.page-header p  { color: var(--text-muted); font-size: 0.88rem; margin-top: 3px; }

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--charcoal-2);
  border: 1px solid var(--charcoal-3);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  cursor: default;
}
.kpi-card:hover {
  border-color: var(--amber-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.kpi-card .kpi-icon {
  font-size: 1.5rem;
  width: 44px; height: 44px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.kpi-card .kpi-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.kpi-card .kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-card .kpi-change {
  font-size: 0.76rem;
  display: flex; align-items: center; gap: 4px;
  margin-top: 2px;
}

/* KPI Icon color variants */
.bg-amber  { background: rgba(245,158,11,0.15); color: var(--amber); }
.bg-green  { background: rgba(16,185,129,0.15); color: var(--success); }
.bg-blue   { background: rgba(59,130,246,0.15); color: var(--info); }
.bg-red    { background: rgba(239,68,68,0.15);  color: var(--danger); }
.bg-purple { background: rgba(139,92,246,0.15); color: #8B5CF6; }

/* ── Cards / Panels ───────────────────────────────────────── */
.card {
  background: var(--charcoal-2);
  border: 1px solid var(--charcoal-3);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--charcoal-3);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--amber);
  color: var(--charcoal);
}
.btn-primary:hover { background: var(--amber-light); color: var(--charcoal); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--charcoal-3);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--amber); color: var(--amber); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 11px 26px; font-size: 0.95rem; }
.btn-icon { padding: 8px; border-radius: 7px; }

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-amber   { background: rgba(245,158,11,0.18); color: var(--amber); }
.badge-green   { background: rgba(16,185,129,0.18); color: var(--success); }
.badge-red     { background: rgba(239,68,68,0.18);  color: var(--danger); }
.badge-blue    { background: rgba(59,130,246,0.18); color: var(--info); }
.badge-gray    { background: rgba(168,162,158,0.18);color: var(--text-muted); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase;
}
.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--charcoal);
  border: 1px solid var(--charcoal-3);
  border-radius: 7px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a8a29e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none;
  padding-right: 32px;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--charcoal-3);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(61,56,53,0.5);
  vertical-align: middle;
  color: var(--text-primary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(245,158,11,0.04); }

/* ── Toast Notifications ──────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--charcoal-2);
  border: 1px solid var(--charcoal-3);
  border-radius: 9px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  min-width: 260px; max-width: 360px;
  animation: slideInRight 0.3s ease;
  font-size: 0.88rem;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger);  }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--info);    }
.toast-icon { font-size: 1.1rem; }
.toast-msg  { flex: 1; }
.toast-close { cursor: pointer; opacity: 0.5; font-size: 1.1rem; }
.toast-close:hover { opacity: 1; }

/* ── Alert (static) ───────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 0.88rem;
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6EE7B7; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #FCA5A5; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #FCD34D; }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--amber); color: var(--charcoal);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.85rem;
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Status dots ──────────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.dot-green  { background: var(--success); animation: pulse-amber 2s infinite; }
.dot-amber  { background: var(--amber); }
.dot-red    { background: var(--danger); }
.dot-gray   { background: var(--text-muted); }

/* ── Mobile Bottom Nav ────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--charcoal-2);
  border-top: 1px solid var(--charcoal-3);
  height: 60px;
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; color: var(--text-muted);
  font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  text-decoration: none; cursor: pointer;
  transition: var(--transition); padding: 4px 0;
}
.bottom-nav-item .bn-icon { font-size: 1.3rem; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--amber); }

/* ── Sidebar Toggle ───────────────────────────────────────── */
.sidebar-toggle {
  display: none; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.3rem; padding: 4px;
}

/* ── Overlay ──────────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 99;
}

/* ── Low Stock Alert Bar ──────────────────────────────────── */
.low-stock-bar {
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  padding: 11px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.84rem; margin-bottom: 20px;
}
.low-stock-bar .lsa-icon { font-size: 1.1rem; }

/* ── Charts Container ─────────────────────────────────────── */
.chart-container { position: relative; height: 220px; }

/* ── Order Status Chips ───────────────────────────────────── */
.order-status { display: inline-flex; align-items: center; gap: 5px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); animation: slideInLeft 0.28s ease; }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; align-items: center; }
  .bottom-nav { display: flex; }
  .page-content { padding: 16px 14px 76px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card .kpi-value { font-size: 1.35rem; }
  .topbar-title { display: none; }
}
