/* Doogma Platform Admin — clean, focused, BC-native palette */

:root {
  --bg: #f3f4f5;
  --surface: #ffffff;
  --border: #d9dadb;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --brand: #1B3A6B;
  --brand-hover: #142d54;
  --accent: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

.hidden {
  display: none !important;
}

/* ─────────────────────────────────────────────
   LOGIN GATE
   ───────────────────────────────────────────── */

.login-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  padding: 48px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 22px;
}

.login-card p {
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* ─────────────────────────────────────────────
   APP SHELL
   ───────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--brand);
  color: white;
  border-radius: 6px;
  font-weight: 700;
}

.brand-name {
  color: var(--text);
  font-size: 15px;
}

.app-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.tab.active {
  background: var(--brand);
  color: white;
}

.tab.active:hover {
  background: var(--brand-hover);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.user-email {
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────── */

.btn-primary {
  background: var(--brand);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────── */

.app-content {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.empty-state h2 {
  color: var(--text);
  margin: 0 0 12px;
}

.empty-state p {
  color: var(--text-muted);
  margin: 8px 0;
}

.empty-state code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 13px;
}

/* ─────────────────────────────────────────────
   APP DASHBOARD
   ───────────────────────────────────────────── */

.app-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-dashboard-header h2 {
  margin: 0;
  font-size: 20px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card.loading {
  color: var(--text-muted);
  font-style: italic;
}

.stat-card.error {
  border-color: var(--error);
  color: var(--error);
  background: #fef2f2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}

.stat-value.ok {
  color: var(--success);
}

.stat-value.warn {
  color: var(--warning);
}

/* ─────────────────────────────────────────────
   STORES TABLE
   ───────────────────────────────────────────── */

.app-stores {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.app-stores h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.stores-list.loading {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 0;
}

.stores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stores-table th,
.stores-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.stores-table th {
  background: rgba(0, 0, 0, 0.02);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stores-table td code {
  font-family: ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 5px;
  border-radius: 3px;
}

.muted {
  color: var(--text-muted);
}

.error-msg {
  color: var(--error);
  padding: 12px;
  background: #fef2f2;
  border-radius: var(--radius);
}

/* ─────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────── */

.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 360px;
  font-size: 13px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--error);
}

.toast.success {
  background: var(--success);
}
