/* ============================================================
   Vibes'Meter — Shared Design System
   Design tokens, components, and utilities shared across all pages
   ============================================================ */

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

/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Base palette */
  --bg:        #0a0a0c;
  --surface:   #131316;
  --surface2:  #1a1a1e;
  --surface3:  #222226;
  --surface4:  #2a2a2f;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.10);
  --border3:   rgba(255,255,255,0.16);

  /* Text */
  --fg:    #f0f0f3;
  --fg2:   #9ca3af;
  --fg3:   #6b7280;
  --fg4:   #4b5563;

  /* Accent */
  --accent:    #3b82f6;
  --accent2:   #2563eb;
  --accent-bg: rgba(59,130,246,0.12);

  /* Semantic */
  --ok:      #22c55e;
  --ok-bg:   rgba(34,197,94,0.12);
  --danger:  #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --warn:    #f59e0b;
  --warn-bg: rgba(245,158,11,0.12);
  --info:    #38bdf8;
  --info-bg: rgba(56,189,248,0.12);

  /* Fluids */
  --fluid-elec:  #f59e0b;
  --fluid-gas:   #ef4444;
  --fluid-water: #3b82f6;
  --fluid-heat:  #f97316;
  --fluid-cold:  #06b6d4;
  --fluid-other: #8b5cf6;

  /* Shadows */
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6);
  --glow-accent: 0 0 20px rgba(59,130,246,0.25);

  /* Radius */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   BASE RESET
   ======================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, select, input, textarea { font: inherit; }

button {
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-primary:hover { background: var(--accent2); box-shadow: 0 4px 16px rgba(59,130,246,0.4); }

.btn-secondary {
  background: var(--surface3);
  color: var(--fg);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--surface4); border-color: var(--border3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--fg2);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--fg); background: var(--surface3); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface3);
  color: var(--fg2);
  border: 1px solid var(--border);
}
.btn-icon:hover { color: var(--fg); border-color: var(--border2); }

/* ========================================
   INPUTS
   ======================================== */
.input, input[type="text"], input[type="number"], input[type="search"],
input[type="email"], input[type="tel"], input[type="url"], input[type="date"],
select, textarea {
  background: var(--surface2);
  color: var(--fg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg3);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-help {
  font-size: 12px;
  color: var(--fg4);
  margin-top: 3px;
}

.input-group {
  margin-bottom: 16px;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}
.card-clickable { cursor: pointer; }
.card-clickable:hover {
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
  transform: translateY(-2px);
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-fluid {
  background: var(--accent-bg);
  color: var(--accent);
}
.badge-ok      { background: var(--ok-bg); color: var(--ok); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warn    { background: var(--warn-bg); color: var(--warn); }
.badge-info    { background: var(--info-bg); color: var(--info); }

/* ========================================
   MODAL SYSTEM
   ======================================== */
.vibesmeter-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}
.vibesmeter-modal-overlay.open { display: flex; }

.vibesmeter-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.vibesmeter-modal-title { font-size: 18px; font-weight: 700; }
.vibesmeter-modal-body  { font-size: 15px; color: var(--fg2); line-height: 1.6; }
.vibesmeter-modal-input {
  background: var(--surface2);
  color: var(--fg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  width: 100%;
}
.vibesmeter-modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.vibesmeter-modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.vibesmeter-modal-buttons button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.vibesmeter-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.vibesmeter-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.vibesmeter-toast.info    { background: var(--accent); color: #fff; }
.vibesmeter-toast.success { background: var(--ok); color: #fff; }
.vibesmeter-toast.error   { background: var(--danger); color: #fff; }
.vibesmeter-toast.warning { background: var(--warn); color: #000; }

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ========================================
   SCORE RING
   ======================================== */
.score-ring {
  position: relative;
  width: 48px;
  height: 48px;
}
.score-ring svg {
  transform: rotate(-90deg);
}
.score-ring-bg {
  fill: none;
  stroke: var(--surface3);
  stroke-width: 4;
}
.score-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ========================================
   SECTION HEADER
   ======================================== */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

/* ========================================
   ANIMATIONS
   ======================================== */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--fg4); }

/* ========================================
   UTILITY
   ======================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--fg3); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
