/* Josh Wellness Hub – Admin Panel CSS */
:root {
  --gold: #b8893a;
  --gold-light: #f5e8cc;
  --gold-dark: #8a6520;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.10);
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --sidebar-bg: #1c1c1e;
  --sidebar-text: #e5e5e5;
  --sidebar-active: #b8893a;
  --danger: #c0392b;
  --success: #1e7e4a;
  --warning: #e67e22;
  --info: #2980b9;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.admin-wrap { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: transform 0.25s; }
.sidebar-brand { padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 10px; }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 8px; object-fit: contain; }
.sidebar-brand strong { font-size: 14px; color: #fff; display: block; }
.sidebar-brand small { font-size: 11px; color: #999; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 0.65rem 1.2rem; color: var(--sidebar-text); font-size: 14px; transition: background 0.15s, color 0.15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(184,137,58,0.15); color: var(--sidebar-active); text-decoration: none; }
.sidebar-nav a i { font-size: 18px; }
.sidebar-nav .nav-section { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #666; padding: 1rem 1.2rem 0.25rem; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer a { display: flex; align-items: center; gap: 8px; color: #999; font-size: 13px; }
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

/* ── Main area ── */
.main-area { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 1.5rem; height: 58px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 90; }
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-title { font-size: 17px; font-weight: 600; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 1rem; font-size: 14px; color: var(--muted); }

/* ── Page content ── */
.page-content { padding: 1.5rem; flex: 1; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--gold); }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.gold .value { color: var(--gold-dark); }
.stat-card.success .value { color: var(--success); }
.stat-card.danger .value { color: var(--danger); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg); text-align: left; padding: 0.65rem 1rem; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); }
tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafaf8; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-paid    { background: #d4edda; color: #155724; }
.badge-unpaid  { background: #f8d7da; color: #721c24; }
.badge-partial { background: #fff3cd; color: #856404; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 1.1rem; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; transition: filter 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.97); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.1); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); color: #fff; text-decoration: none; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 13px; }
.btn-icon { padding: 0.4rem; border-radius: 6px; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea { padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; transition: border-color 0.15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,58,0.12); }
.field textarea { resize: vertical; min-height: 80px; }
.form-section { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 1.25rem 0 0.5rem; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ── Invoice Items ── */
.items-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 0.5rem; }
.items-table th { background: var(--bg); padding: 0.5rem 0.75rem; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); }
.items-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.items-table input, .items-table select { padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; width: 100%; }
.items-table input:focus, .items-table select:focus { outline: none; border-color: var(--gold); }
.item-total-cell { font-weight: 600; min-width: 80px; }
.remove-row { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 18px; padding: 2px 6px; border-radius: 4px; }
.remove-row:hover { background: #fde8e8; }
.add-item-btn { margin-top: 0.5rem; }

/* ── Invoice Totals ── */
.invoice-totals { max-width: 320px; margin-left: auto; margin-top: 1rem; }
.total-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 14px; }
.total-row.grand { font-size: 17px; font-weight: 700; border-top: 2px solid var(--text); margin-top: 4px; padding-top: 8px; }

/* ── Print Invoice ── */
.invoice-doc { max-width: 780px; margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.invoice-logo { display: flex; align-items: center; gap: 10px; }
.invoice-logo img { width: 52px; height: 52px; border-radius: 8px; }
.invoice-logo strong { font-size: 18px; color: var(--text); }
.invoice-logo small { font-size: 12px; color: var(--muted); display: block; }
.invoice-meta { text-align: right; }
.invoice-meta .inv-number { font-size: 22px; font-weight: 700; color: var(--gold-dark); }
.invoice-meta .inv-date { font-size: 13px; color: var(--muted); }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 1.5rem; }
.inv-party { font-size: 14px; }
.inv-party strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
.inv-items { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 14px; }
.inv-items th { background: var(--gold); color: #fff; padding: 0.6rem 0.9rem; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.inv-items td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.inv-items tr:last-child td { border-bottom: none; }
.inv-totals { max-width: 280px; margin-left: auto; font-size: 14px; }
.inv-totals .inv-total-row { display: flex; justify-content: space-between; padding: 4px 0; }
.inv-totals .grand-total { font-weight: 700; font-size: 17px; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; }
.inv-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); text-align: center; }
.inv-actions { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; }

/* ── Search / Filter bar ── */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 0.45rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--gold); }

/* ── Login Page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem 2rem; width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand img { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 0.75rem; }
.login-brand h1 { font-size: 20px; font-weight: 700; }
.login-brand p { font-size: 13px; color: var(--muted); }
.login-error { background: #fde8e8; color: #7f1d1d; border-radius: 8px; padding: 0.6rem 1rem; font-size: 14px; margin-bottom: 1rem; }
.login-success { background: #d4edda; color: #155724; border-radius: 8px; padding: 0.6rem 1rem; font-size: 14px; margin-bottom: 1rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card .btn { width: 100%; justify-content: center; padding: 0.65rem; font-size: 15px; }

/* ── Alert ── */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: block; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .inv-parties { grid-template-columns: 1fr; gap: 1rem; }
  .invoice-header { flex-direction: column; gap: 1rem; }
  .invoice-meta { text-align: left; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .inv-actions { flex-direction: column; }
  .page-content { padding: 1rem; }
}

/* ── Print Styles ── */
@media print {
  .no-print, .sidebar, .topbar, .inv-actions { display: none !important; }
  .main-area { margin-left: 0; }
  .invoice-doc { border: none; padding: 0; }
  body { background: #fff; }
}