/* Custom Design System for Boticário x ELO Synergy Dashboard */

:root {
  --bg-primary: #0F172A;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;

  /* Brand Colors */
  --boti-color: #00A86B;      /* Boticário Emerald Green */
  --boti-bg: rgba(0, 168, 107, 0.15);
  --elo-color: #0284C7;       /* ELO Ocean Blue */
  --elo-bg: rgba(2, 132, 199, 0.15);
  --accent-gold: #F59E0B;
  --accent-rose: #EF4444;

  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --radius-lg: 14px;
  --radius-md: 8px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  gap: 1.25rem;
  max-width: 1800px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--boti-color), var(--elo-color));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.3);
}

.header-brand h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.header-brand h1 span {
  color: var(--boti-color);
  font-weight: 600;
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Parameterization Banner */
.param-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(0, 168, 107, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 168, 107, 0.1);
}

.param-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.param-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.param-icon {
  color: var(--boti-color);
  width: 24px;
  height: 24px;
}

.param-title h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.param-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Capacity Toggle Switch */
.capacity-toggle-box {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--boti-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #475569;
  transition: .3s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--boti-color);
}

input:checked + .slider-toggle:before {
  transform: translateX(22px);
}

.toggle-label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
}

.toggle-label strong {
  color: #ffffff;
}

.toggle-label span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.param-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.param-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.param-card label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-with-slider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.input-with-slider input[type="number"] {
  width: 90px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--boti-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.unit-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--boti-color);
}

.input-with-slider input[type="range"] {
  flex: 1;
  accent-color: var(--boti-color);
  cursor: pointer;
  height: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-emerald {
  background: linear-gradient(135deg, #00A86B, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.3);
}

.btn-emerald:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 168, 107, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.25);
}

.card-boti { border-left: 4px solid var(--boti-color); }
.card-elo { border-left: 4px solid var(--elo-color); }
.card-match { border-left: 4px solid var(--accent-gold); }
.card-savings { border-left: 4px solid #EF4444; }

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.metric-footer {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-subtext {
  font-size: 0.85rem;
  color: var(--accent-gold);
}

/* Controls / Filters */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 180px;
}

.filter-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}

.filter-group select,
.filter-group input[type="text"] {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
  border-color: var(--boti-color);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.2);
}

/* Main Split View */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  min-height: 550px;
}

@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

.map-section, .table-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-boti { background: var(--boti-color); box-shadow: 0 0 8px var(--boti-color); }
.dot-elo { background: var(--elo-color); box-shadow: 0 0 8px var(--elo-color); }

.line-sample {
  width: 18px;
  height: 2px;
  background: var(--accent-gold);
}

/* Leaflet Map */
#map {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Table */
.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.match-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.match-table th {
  background: rgba(15, 23, 42, 0.95);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.match-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.match-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-high {
  background: rgba(0, 168, 107, 0.2);
  color: #10B981;
  border: 1px solid rgba(0, 168, 107, 0.4);
}

.badge-mid {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-none {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.table-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.loading-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 1rem 0;
}
