/* ===========================================================================
   EPO.SI — Common styles, dark theme, design tokens
   Moody blue-purple gradients · glassmorphism · mobile-first
   =========================================================================== */

:root {
  /* Tenant-overridable brand accents (set at runtime via JS) */
  --brand-primary: #6B3FA0;
  --brand-secondary: #2E4A8B;

  /* Dark theme palette */
  --bg-0: #0a0b14;
  --bg-1: #0f1120;
  --bg-2: #161a2e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-blur: 16px;

  --text-0: #f5f6ff;
  --text-1: #c2c6e0;
  --text-2: #8b8fb0;
  --text-3: #5b5f80;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 8px 40px rgba(107, 63, 160, 0.35);

  --tap: 44px; /* minimum tap target */

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter,
    'Helvetica Neue', Arial, sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(107, 63, 160, 0.25), transparent 55%),
    radial-gradient(1000px 700px at 110% 10%, rgba(46, 74, 139, 0.30), transparent 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 60%, var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}

h1, h2, h3, h4 { margin: 0 0 0.4em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 0.8em; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

img { max-width: 100%; display: block; }

/* --- Glass surfaces --------------------------------------------------------*/
.glass {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-soft);
}

/* --- Buttons ---------------------------------------------------------------*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-0);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease),
    box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); }

.btn-success { background: rgba(52, 211, 153, 0.18); border-color: rgba(52, 211, 153, 0.4); color: var(--success); }
.btn-warning { background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.4); color: var(--warning); }
.btn-danger  { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.btn-ghost   { background: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }

/* --- Form fields -----------------------------------------------------------*/
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.input, .textarea, .select {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-0);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.4; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(107, 63, 160, 0.25);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { appearance: none; background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238b8fb0' viewBox='0 0 16 16'><path d='M8 11L3 6h10z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* --- Badges ----------------------------------------------------------------*/
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-new       { background: rgba(52, 211, 153, 0.18); color: var(--success); }
.badge-preparing { background: rgba(251, 191, 36, 0.18); color: var(--warning); }
.badge-served    { background: rgba(96, 165, 250, 0.18); color: var(--info); }
.badge-cancelled { background: rgba(248, 113, 113, 0.16); color: var(--danger); }

/* --- Utility ---------------------------------------------------------------*/
.muted { color: var(--text-2); }
.text-center { text-align: center; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap { flex-wrap: wrap; }

/* --- Spinner ---------------------------------------------------------------*/
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Toast -----------------------------------------------------------------*/
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  pointer-events: auto;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: rgba(20, 22, 40, 0.92);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  animation: toast-in 0.3s var(--ease);
}
.toast.toast-error   { border-color: rgba(248, 113, 113, 0.5); }
.toast.toast-success { border-color: rgba(52, 211, 153, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* --- Empty state -----------------------------------------------------------*/
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
}
.empty-state .emoji { font-size: 2.6rem; margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
