/* ════════════════════════════════════════════════════════
   AARYA HARDWARE — Admin Dashboard Styles
   Industrial Dark Steel & Orange Theme
   ════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Design Tokens ─────────────────────────────────── */
:root {
  /* Primary: Amber Orange (hardware/construction feel) */
  --rose: #f57c00;
  --rose-light: #ff9800;
  --rose-dark: #e65100;
  /* Accent: Steel Blue */
  --gold: #0288d1;
  --gold-light: #29b6f6;
  --purple: #37474f;
  --coral: #e53935;
  --teal: #00897b;
  --green: #388e3c;

  /* Backgrounds: charcoal / dark steel */
  --bg: #0f1215;
  --bg2: #161b20;
  --bg3: #1d2328;
  --bg4: #242b32;
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.09);

  /* Text */
  --text: #ecf0f1;
  --text-muted: #8fa0ae;
  --text-dim: #546e7a;

  --sidebar-w: 230px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

body {
  display: flex;
  background: radial-gradient(ellipse at 10% 20%, rgba(245,124,0,0.07) 0%, transparent 50%),
              radial-gradient(ellipse at 90% 80%, rgba(2,136,209,0.06) 0%, transparent 50%),
              var(--bg);
}

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--rose-dark); border-radius: 3px; }

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

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

.brand-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(245,124,0,0.6));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-align: left;
}

.nav-item:hover {
  background: var(--glass);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(245,124,0,0.2), rgba(2,136,209,0.15));
  color: var(--rose-light);
  border: 1px solid rgba(245,124,0,0.3);
}

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

.nav-badge {
  background: var(--rose);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.urgent {
  background: var(--coral);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background var(--transition);
}

.status-dot.ready { background: #4caf50; box-shadow: 0 0 8px rgba(76,175,80,0.5); }
.status-dot.connecting { background: var(--gold); animation: pulse 1s infinite; }
.status-dot.disconnected { background: var(--coral); }

.status-label { font-size: 12px; color: var(--text-muted); }

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

/* ─── Topbar ────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(13,13,26,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

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

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

.topbar-time {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.topbar-connection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 13px;
}

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.conn-dot.ready { background: #4caf50; box-shadow: 0 0 6px rgba(76,175,80,0.5); }

/* ─── Tab Content ──────────────────────────────────── */
.tab-content {
  display: none;
  padding: 28px;
  flex: 1;
}

.tab-content.active { display: block; }

/* ─── Cards ─────────────────────────────────────────── */
.card {
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ─── Stat Cards ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }

.stat-card.rose  { background: linear-gradient(135deg,rgba(233,30,140,0.18),rgba(233,30,140,0.05)); border-color: rgba(233,30,140,0.25); }
.stat-card.gold  { background: linear-gradient(135deg,rgba(240,165,0,0.18),rgba(240,165,0,0.05)); border-color: rgba(240,165,0,0.25); }
.stat-card.purple{ background: linear-gradient(135deg,rgba(142,36,170,0.18),rgba(142,36,170,0.05)); border-color: rgba(142,36,170,0.25); }
.stat-card.coral { background: linear-gradient(135deg,rgba(230,74,25,0.18),rgba(230,74,25,0.05)); border-color: rgba(230,74,25,0.25); }
.stat-card.teal  { background: linear-gradient(135deg,rgba(0,137,123,0.18),rgba(0,137,123,0.05)); border-color: rgba(0,137,123,0.25); }
.stat-card.green { background: linear-gradient(135deg,rgba(56,142,60,0.18),rgba(56,142,60,0.05)); border-color: rgba(56,142,60,0.25); }

.stat-icon { font-size: 28px; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat-sparkle {
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 14px;
  opacity: 0.4;
}

/* ─── QR Card ──────────────────────────────────────── */
.qr-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: white;
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.qr-hint { text-align: center; font-size: 12px; color: var(--text-muted); }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.badge-warning { background: rgba(240,165,0,0.2); color: var(--gold-light); border: 1px solid rgba(240,165,0,0.3); }
.badge-success { background: rgba(56,142,60,0.2); color: #81c784; border: 1px solid rgba(56,142,60,0.3); }
.badge-danger  { background: rgba(230,74,25,0.2); color: #ff8a65; border: 1px solid rgba(230,74,25,0.3); }
.badge-rose    { background: rgba(233,30,140,0.2); color: var(--rose-light); border: 1px solid rgba(233,30,140,0.3); }

/* ─── Buttons ────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(233,30,140,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 25px rgba(233,30,140,0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-success {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #388e3c, #2e7d32);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-agent {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--rose), var(--purple));
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-agent:hover { opacity: 0.85; }

.btn-return {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--teal), #00695c);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-refresh {
  padding: 6px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-refresh:hover { color: var(--text); border-color: var(--rose); }

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--glass);
  border: 1px dashed var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-upload:hover { border-color: var(--rose); color: var(--rose-light); }

.btn-danger-sm {
  padding: 5px 12px;
  background: rgba(230,74,25,0.15);
  border: 1px solid rgba(230,74,25,0.3);
  color: #ff8a65;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* ─── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.label-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 12px 16px;
  resize: vertical;
  transition: border-color var(--transition);
}
.form-textarea:focus { outline: none; border-color: var(--rose); }
.form-textarea::placeholder { color: var(--text-dim); }

.upload-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.upload-sep { font-size: 12px; color: var(--text-dim); }

.input-footer { padding: 6px 4px; font-size: 11px; color: var(--text-muted); }

/* ─── Analytics ──────────────────────────────────────── */
.analytics-controls { margin-bottom: 20px; }

.period-selector {
  display: inline-flex;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.period-btn {
  padding: 7px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.period-btn.active { background: var(--rose); color: white; }
.period-btn:hover:not(.active) { color: var(--text); }

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container { height: 240px; position: relative; }

.chart-card { overflow: visible; }

.conversion-list { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }

.conversion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 13px;
}
.conv-rank { font-size: 16px; width: 28px; text-align: center; }
.conv-id { font-weight: 600; color: var(--rose-light); flex: 1; }
.conv-count { color: var(--text-muted); font-size: 12px; }

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.report-item {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.report-item .ri-value { font-size: 22px; font-weight: 700; color: var(--rose-light); }
.report-item .ri-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── Lists ──────────────────────────────────────────── */
.handoff-list, .followup-list, .conversations-list, .activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.handoff-item, .followup-item, .convo-item, .activity-item {
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color var(--transition);
}

.handoff-item:hover { border-color: rgba(233,30,140,0.3); }

.item-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 14px; }
.item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.item-time { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.item-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-mini {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-mini .sm-value { font-size: 22px; font-weight: 700; }
.stat-mini .sm-label { font-size: 11px; color: var(--text-muted); }
.stat-mini.success .sm-value { color: #81c784; }
.stat-mini.failed .sm-value { color: #ff8a65; }
.stat-mini.total .sm-value { color: var(--rose-light); }

.results-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 13px;
}

/* ─── Logs ───────────────────────────────────────────── */
.logs-controls { display: flex; align-items: center; gap: 14px; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.logs-container {
  background: var(--bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  height: 480px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry {
  display: flex;
  gap: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  line-height: 1.5;
}
.log-entry.info { color: #90caf9; }
.log-entry.success { color: #81c784; }
.log-entry.error { color: #ef9a9a; }
.log-entry.warning { color: var(--gold-light); }
.log-time { color: var(--text-dim); white-space: nowrap; }
.log-message { color: inherit; word-break: break-word; }

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ─── Modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 540px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-customer { font-size: 13px; color: var(--text-muted); }

.chat-history {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.chat-msg {
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 85%;
  line-height: 1.4;
}
.chat-msg.user { background: var(--bg3); align-self: flex-start; }
.chat-msg.assistant { background: linear-gradient(135deg, rgba(233,30,140,0.15), rgba(142,36,170,0.1)); align-self: flex-end; border: 1px solid rgba(233,30,140,0.2); }
.chat-msg-role { font-size: 10px; color: var(--text-dim); margin-bottom: 2px; }

.modal-actions { display: flex; gap: 12px; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tab-content { padding: 16px; }
  .analytics-grid { grid-template-columns: 1fr; }
}
