/* BotBee Billing - Neumorphism Admin Theme */

:root {
  --bg: #1a2332;
  --surface: #1e2a3b;
  --card: #243044;
  --neu-dark: #141e2c;
  --neu-light: #2a3a52;
  --primary: #4f8ef7;
  --primary-glow: rgba(79,142,247,0.25);
  --secondary: #6c63ff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255,255,255,0.06);
  --shadow-out: 6px 6px 14px #141e2c, -6px -6px 14px #2a3a52;
  --shadow-in: inset 4px 4px 10px #141e2c, inset -4px -4px 10px #2a3a52;
  --shadow-hover: 8px 8px 18px #141e2c, -8px -8px 18px #2a3a52;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Global link color — without this, every <a> falls back to the browser's
   default link blue (#0000EE-ish), which has terrible contrast on this dark
   navy theme. This was the root cause behind multiple "invoice number not
   visible" reports across different pages — one missing rule, many symptoms. */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--primary); }
.nav-item:visited { color: var(--text-muted); }
.nav-item.active:visited { color: var(--primary); }
.btn:visited { color: inherit; }

/* ── Layout ─────────────────────────────────────────────── */

.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--surface);
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img { height: 36px; border-radius: 8px; }
.sidebar-logo .logo-text h2 { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-logo .logo-text span { font-size: 11px; color: var(--text-muted); }

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

.nav-section { margin-bottom: 8px; }
.nav-section-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); padding: 8px 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-out);
}

.nav-item.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-in);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-in);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}

.user-info .name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-info .role { font-size: 11px; color: var(--text-muted); }

/* ── Main Content ────────────────────────────────────────── */

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: var(--card);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
}

.page-title h1 { font-size: 20px; font-weight: 700; color: #fff; }
.page-title p { font-size: 13px; color: var(--text-muted); }

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

/* ── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
  overflow: hidden;
}

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

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-out);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.1;
  transform: translate(20px, -20px);
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.info::before    { background: var(--info); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: var(--shadow-in);
}

.stat-icon.primary { background: rgba(79,142,247,0.15); color: var(--primary); }
.stat-icon.success { background: rgba(34,197,94,0.15); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-icon.danger  { background: rgba(239,68,68,0.15); color: var(--danger); }
.stat-icon.info    { background: rgba(6,182,212,0.15); color: var(--info); }

.stat-value { font-size: 26px; font-weight: 800; color: #fff; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 12px; margin-top: 8px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-out);
}

.btn:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.btn:active { box-shadow: var(--shadow-in); transform: translateY(0); }

.btn-primary  { background: linear-gradient(135deg, #4f8ef7, #3b6fd4); color: #fff; }
.btn-success  { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.btn-danger   { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-warning  { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-info     { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text-muted); box-shadow: none; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--card); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Forms ──────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.form-control {
  width: 100%;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-in);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-in), 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-dim); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

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

/* ── Tables ─────────────────────────────────────────────── */

.table-responsive { overflow-x: auto; }

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

.table thead th {
  padding: 12px 16px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

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

.table tbody tr:hover td { background: rgba(79,142,247,0.04); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success  { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-danger   { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-warning  { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-primary  { background: rgba(79,142,247,0.15); color: var(--primary); }
.badge-info     { background: rgba(6,182,212,0.15);  color: var(--info); }
.badge-muted    { background: rgba(148,163,184,0.15); color: var(--text-muted); }

/* ── Search & Filter Bar ─────────────────────────────────── */

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

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-in);
}

.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); width: 16px; }

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  max-width: 600px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; color: #fff; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-danger  { 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: #fde68a; }
.alert-info    { background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.3); color: #a5f3fc; }

/* ── Pagination ─────────────────────────────────────────── */

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-out);
  transition: var(--transition);
  color: var(--text-muted);
}

.pagination a:hover { color: var(--text); background: var(--surface); }
.pagination .active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,142,247,0.4); }

/* ── Login Page ─────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 20px 20px 40px #0d1520, -20px -20px 40px #253348;
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 26px; font-weight: 800; color: #fff; }
.login-logo p { color: var(--text-muted); margin-top: 6px; }

.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-input {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  box-shadow: var(--shadow-in);
  transition: var(--transition);
}
.otp-input:focus { border-color: var(--primary); outline: none; box-shadow: var(--shadow-in), 0 0 0 3px var(--primary-glow); }

/* ── Toast Notifications ─────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  min-width: 280px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { background: #16a34a; color: #fff; }
.toast-danger  { background: #dc2626; color: #fff; }
.toast-info    { background: #0891b2; color: #fff; }

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

/* ── Email Log Status ────────────────────────────────────── */

.email-log-sent   { color: var(--success); }
.email-log-failed { color: var(--danger); }

/* ── Invoice Card ────────────────────────────────────────── */

.invoice-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Chart Container ─────────────────────────────────────── */

.chart-container {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-out);
  margin-bottom: 24px;
}

/* ── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilities ──────────────────────────────────────────── */

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
