/* ============================================================
   PHARMACY MANAGEMENT SYSTEM — STYLESHEET
   Font: Plus Jakarta Sans + DM Mono
   Theme: Professional Green & White
   ============================================================ */

:root {
  --primary: #1a6b3a;
  --primary-dark: #134f2b;
  --primary-light: #e8f5ee;
  --primary-mid: #2d8a52;
  --accent: #25c16f;
  --accent-glow: rgba(37,193,111,0.18);
  --danger: #e03c3c;
  --danger-light: #fdf0f0;
  --warning: #e08c1a;
  --warning-light: #fdf6e8;
  --info: #1a7ab5;
  --info-light: #e8f3fc;
  --success: #1a9e5c;
  --success-light: #e6f7ee;

  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #f9fbfa;
  --border: #e0ebe5;
  --border-dark: #c5d9ce;

  --text: #0f2419;
  --text-2: #3a5244;
  --text-3: #6b8f7c;
  --text-muted: #9ab5a8;

  --sidebar-w: 255px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 2px 12px rgba(26,107,58,0.08);
  --shadow-md: 0 4px 24px rgba(26,107,58,0.12);
  --shadow-lg: 0 8px 40px rgba(26,107,58,0.16);

  --transition: 0.2s ease;
  --font: 'Plus Jakarta Sans', sans-serif;
  --mono: 'DM Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 99px; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--primary-dark);
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; }

.logo-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: .5px; }

.sidebar-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 18px; cursor: pointer; padding: 4px; display: none;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 12px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all var(--transition); position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37,193,111,0.35);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--warning); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  min-width: 20px; text-align: center;
}
.nav-badge.danger { background: var(--danger); }

.nav-divider {
  height: 1px; background: rgba(255,255,255,0.08);
  margin: 8px 0;
}

.nav-logout:hover { background: rgba(224,60,60,0.2); color: #ff8080; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: capitalize; }

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

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(26,107,58,0.06);
}

.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-2); border-radius: 2px;
  transition: var(--transition);
}

.page-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-alert {
  display: flex; align-items: center; gap: 5px;
  background: var(--warning-light); color: var(--warning);
  border: 1px solid #f0c878;
  padding: 5px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: var(--transition);
}
.topbar-alert:hover { background: var(--warning); color: #fff; }
.alert-count {
  background: var(--warning); color: #fff;
  border-radius: 99px; padding: 1px 6px; font-size: 11px;
}
.topbar-alert:hover .alert-count { background: rgba(255,255,255,0.3); }

.topbar-date { font-size: 13px; color: var(--text-3); font-weight: 500; }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; padding: 28px 28px 40px; max-width: 1400px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 999;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px; margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex; align-items: center; gap: 16px;
  text-decoration: none; color: inherit;
  transition: all var(--transition);
  cursor: pointer; position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--primary); transform: scaleX(0);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-dark); }
.stat-card:hover::after { transform: scaleX(1); }

.stat-icon {
  width: 50px; height: 50px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.green { background: var(--primary-light); }
.stat-icon.blue { background: var(--info-light); }
.stat-icon.orange { background: var(--warning-light); }
.stat-icon.red { background: var(--danger-light); }
.stat-icon.purple { background: #f2eaff; }
.stat-icon.teal { background: #e5f8f5; }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}

.card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.table-empty {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: 14px;
}

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-default { background: var(--surface-2);     color: var(--text-3);  }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,107,58,0.3); }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-warning { background: var(--warning); color: #fff; }

.btn-outline {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost {
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}

input, select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,58,0.1);
}

input[readonly] { background: var(--surface-2); color: var(--text-3); }

textarea { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px;
}

.filter-bar input, .filter-bar select {
  width: auto; min-width: 140px;
}

.search-box { position: relative; }
.search-box input { padding-left: 36px; }
.search-box::before {
  content: '🔍'; position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); font-size: 13px; pointer-events: none;
}

/* ── MODALS ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 2000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}
.modal-lg { max-width: 780px; }

@keyframes modalIn {
  from { transform: scale(.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1)  translateY(0);     opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: none;
  cursor: pointer; font-size: 16px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── TOASTS ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .3s ease;
  max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info);    }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── CHARTS ── */
.chart-wrap { position: relative; width: 100%; }

/* ── PROGRESS ── */
.progress { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--primary); transition: width .6s ease; }

/* ── SUMMARY CARDS ── */
.summary-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.summary-card .s-label {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .4px;
}
.summary-card .s-value {
  font-size: 20px; font-weight: 800; color: var(--text);
  margin-top: 4px;
}
.summary-card .s-value.green { color: var(--success); }
.summary-card .s-value.red   { color: var(--danger);  }
.summary-card .s-value.orange{ color: var(--warning); }
.summary-card .s-value.blue  { color: var(--info);    }

/* ── ITEM ROWS (sales) ── */
.item-row {
  display: grid; grid-template-columns: 1fr 90px 100px 90px 32px;
  gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-mid) 60%, var(--accent) 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 42px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center; margin-bottom: 28px;
}

.login-logo .logo-circle {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; margin-bottom: 12px;
}

.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ── SECTION HEADING ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}

.section-title {
  font-size: 16px; font-weight: 700; color: var(--text);
}

/* ── ALERTS ── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a8dfc0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #f5bcbc; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #f5dcaa; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #a8cfe8; }

/* ── TWO COL LAYOUT ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── MISC ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--success); font-weight: 700; }
.text-red   { color: var(--danger);  font-weight: 700; }
.text-orange{ color: var(--warning); font-weight: 700; }
.text-blue  { color: var(--info);    font-weight: 700; }
.fw-700 { font-weight: 700; }
.mono { font-family: var(--mono); }
.mt-8 { margin-top: 8px; }
.mt-16{ margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: flex; }
  .main-content { padding: 20px 16px 32px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-date { display: none; }
  .item-row { grid-template-columns: 1fr 80px 90px 80px 32px; gap: 6px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-value { font-size: 18px; }
  .login-card { padding: 30px 22px; }
  .modal { max-width: 100%; }
  .btn-group { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .item-row { grid-template-columns: 1fr; }
}

/* ── Password Eye Toggle ─────────────────────────────────── */
.input-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-password-wrap input {
    flex: 1;
    padding-right: 42px;
}
.eye-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.eye-toggle:hover { color: var(--primary); }

/* ── Eye toggle position fix ─────────────────────────────── */
.input-password-wrap { display: block; }
.input-password-wrap input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.eye-toggle { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); }