/* ═══════════════════════════════════════════
   WattMatch Discover — Styles
   ═══════════════════════════════════════════ */

* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; color: #1C1917; margin: 0; padding: 0; background: #FAFAF9; }
h1, h2, h3, h4, h5, h6 { font-family: 'Suisse Screen', sans-serif; margin: 0; }

/* ── Layout ─────────────────────────────── */
.discover-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.discover-map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.discover-sidebar {
  width: 420px;
  flex-shrink: 0;
  background: white;
  border-left: 1px solid #E5E5E5;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1000;
}

/* ── Header ─────────────────────────────── */
.discover-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #F5F5F4;
  flex-shrink: 0;
}

.discover-header .logo {
  font-family: 'Suisse Screen WM', 'Suisse Screen', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1C1917;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}
.discover-header .logo span { color: #15803D; }

.discover-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1C1917;
  margin: 0;
}

/* ── Steps (shared) ──────────────────────── */
.discover-step {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #F5F5F4;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #78716C;
  margin: 0 0 0.75rem 0;
}

/* ── Inputs ──────────────────────────────── */
.discover-input {
  width: 100%;
  border: 2px solid #E5E5E5;
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
  background: #FAFAF9;
  color: #1C1917;
}
.discover-input:focus {
  outline: none;
  border-color: #15803D;
  background: white;
}
.discover-input::placeholder {
  color: #78716C;
}

.input-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.input-group {
  flex: 1;
  position: relative;
}
.input-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #57534E;
  margin-bottom: 0.25rem;
}

.input-group-npa { flex: 0 0 100px; }
.input-group-number { flex: 0 0 70px; }

/* ── Autocomplete suggestions ────────────── */
.discover-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #E5E5E5;
  border-radius: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.discover-suggestions .sug-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  border-bottom: 1px solid #F5F5F4;
  transition: background 0.15s;
}
.discover-suggestions .sug-item:last-child { border-bottom: none; }
.discover-suggestions .sug-item:hover { background: #F0FDF4; }

/* ── Primary button ──────────────────────── */
.discover-btn-primary {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #15803D 0%, #166534 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: 'Inter', sans-serif;
}
.discover-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.discover-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Back button ─────────────────────────── */
.discover-back-btn {
  background: none;
  border: none;
  color: #15803D;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.75rem;
  font-family: 'Inter', sans-serif;
}
.discover-back-btn:hover { text-decoration: underline; }

/* ── Address badge ───────────────────────── */
.discover-address-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  color: #166534;
  margin-bottom: 1rem;
}
.discover-address-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  flex-shrink: 0;
}

/* ── CEL info card ───────────────────────── */
.discover-cel-card {
  background: #FAFAF9;
  border: 1px solid #E7E5E4;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, background 0.2s;
}
.discover-cel-card:hover {
  border-color: #15803D;
  transform: translateY(-1px);
}
.discover-cel-card.active {
  border-color: #15803D;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
  background: #F0FDF4;
}
.discover-cel-card.active .cel-card-header h4::after {
  content: ' ← sur la carte';
  font-size: 0.6875rem;
  font-weight: 500;
  color: #15803D;
}

.cel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.cel-card-header h4 {
  font-size: 0.9375rem;
  font-weight: 700;
}

.rebate-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
}
.rebate-badge-20 {
  background: #FEF3C7;
  color: #92400E;
}
.rebate-badge-40 {
  background: #DBEAFE;
  color: #1E40AF;
}

.cel-card-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.cel-stat {
  font-size: 0.75rem;
  color: #78716C;
}
.cel-stat strong {
  color: #1C1917;
  font-weight: 600;
}

/* ── Address hint ────────────────────────── */
.address-hint {
  font-size: 0.75rem;
  color: #B45309;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

/* ── No CEL message ──────────────────────── */
.no-cel-message {
  text-align: center;
  padding: 1.5rem 1rem;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 0.75rem;
  color: #92400E;
  font-size: 0.875rem;
}
.no-cel-message p { margin: 0.25rem 0; }
.no-cel-message strong { font-weight: 700; }

/* ── NPA stats card ─────────────────────── */
.npa-stats-card {
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.npa-stats-card h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0C4A6E;
  margin-bottom: 0.5rem;
}
.npa-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
}
.npa-stat {
  font-size: 0.75rem;
  color: #0369A1;
  text-align: center;
}
.npa-stat strong {
  display: block;
  font-size: 1.125rem;
  font-weight: 800;
  color: #0C4A6E;
  font-family: 'Suisse Screen', sans-serif;
}

/* ── Gathering CEL card ─────────────────── */
.gathering-cel-card {
  background: #FFFBEB;
  border: 2px dashed #F59E0B;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s, background 0.2s;
  position: relative;
}
.gathering-cel-card:hover {
  border-color: #B45309;
  box-shadow: 0 2px 8px rgba(245,158,11,0.15);
  transform: translateY(-1px);
}
.gathering-cel-card.active {
  border-color: #B45309;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.25);
  background: #FEF9C3;
}
.gathering-cel-card.active .cel-card-header h4::after {
  content: ' ← sur la carte';
  font-size: 0.6875rem;
  font-weight: 500;
  color: #B45309;
}
.gathering-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
}
.gathering-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #F59E0B;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.gathering-cel-card .cel-card-stats {
  margin-top: 0.5rem;
}
.gathering-progress {
  margin-top: 0.5rem;
}
.gathering-progress-bar {
  height: 6px;
  background: #FDE68A;
  border-radius: 3px;
  overflow: hidden;
}
.gathering-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F59E0B, #D97706);
  border-radius: 3px;
  transition: width 0.3s;
}
.gathering-progress-label {
  font-size: 0.6875rem;
  color: #92400E;
  margin-top: 0.25rem;
}

/* ── Role toggle ─────────────────────────── */
.discover-role-toggle {
  display: flex;
  background: #F5F5F4;
  border-radius: 0.75rem;
  padding: 3px;
  margin-bottom: 1rem;
}
.discover-role-toggle button {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: #78716C;
  font-family: 'Inter', sans-serif;
}
.discover-role-toggle button.active {
  background: white;
  color: #1C1917;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Simulation form ─────────────────────── */
.sim-form {
  margin-bottom: 1rem;
}
.sim-form label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #57534E;
  margin-bottom: 0.25rem;
}
.sim-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.sim-input-row .discover-input {
  flex: 1;
}
.sim-unit {
  font-size: 0.75rem;
  color: #78716C;
  padding-bottom: 0.75rem;
  flex-shrink: 0;
}

/* ── Results card ────────────────────────── */
.sim-results-card {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border: 1px solid #BBF7D0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 0.75rem;
}
.sim-results-card .big-number {
  font-family: 'Suisse Screen', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #166534;
  line-height: 1.1;
}
.sim-results-card .big-label {
  font-size: 0.8125rem;
  color: #166534;
  margin-top: 0.25rem;
}
.sim-results-card .sub-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: #15803D;
  margin-top: 0.5rem;
}

.sim-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.sim-detail {
  font-size: 0.75rem;
  color: #57534E;
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #E7E5E4;
}
.sim-detail strong {
  display: block;
  color: #1C1917;
  font-weight: 700;
  font-size: 0.875rem;
}

/* ── Disclaimer ──────────────────────────── */
.discover-disclaimer {
  font-size: 0.6875rem;
  color: #78716C;
  font-style: italic;
  margin: 0.75rem 0 0 0;
  line-height: 1.4;
}

/* ── CTA section ─────────────────────────── */
.discover-cta-card {
  text-align: center;
  padding: 0.5rem 0;
}
.discover-cta-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.discover-cta-card p {
  font-size: 0.8125rem;
  color: #78716C;
  margin: 0 0 1rem 0;
}

.discover-cta-primary {
  display: inline-block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #15803D 0%, #166534 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.2s, transform 0.15s;
  font-family: 'Inter', sans-serif;
}
.discover-cta-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.discover-cta-secondary {
  display: inline-block;
  width: 100%;
  padding: 0.625rem 1.5rem;
  background: white;
  color: #15803D;
  font-weight: 600;
  font-size: 0.875rem;
  border: 2px solid #22C55E;
  border-radius: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
  margin-top: 0.5rem;
  font-family: 'Inter', sans-serif;
}
.discover-cta-secondary:hover { background: #F0FDF4; }

/* ── "Vous êtes ici" marker ──────────────── */
.vous-etes-ici {
  position: relative;
  width: 24px;
  height: 24px;
}
.vous-etes-ici .pin {
  width: 24px;
  height: 24px;
  background: #22C55E;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  position: relative;
  z-index: 2;
}
.vous-etes-ici .pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(34,197,94,0.25);
  border-radius: 50%;
  animation: pulse-ring 2s ease-out infinite;
  z-index: 1;
}
@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* ── Loading overlay ─────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.spinner-lg {
  width: 40px;
  height: 40px;
  border: 4px solid #E5E5E5;
  border-top-color: #15803D;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ── SVG marker (no background) ────────── */
.wm-svg-marker {
  background: none !important;
  border: none !important;
}

/* ── Map legend ─────────────────────────── */
.wm-legend {
  background: white;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: #1C1917;
}
.wm-legend strong {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.375rem;
  color: #57534E;
}
.wm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}
.wm-legend-item:last-child { margin-bottom: 0; }
.wm-legend-item svg { flex-shrink: 0; }

/* ── "Voir tout" reset button ───────────── */
.discover-show-all-btn {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  margin-bottom: 0.75rem;
  background: #F5F5F4;
  border: 1px solid #E5E5E5;
  border-radius: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #57534E;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.discover-show-all-btn:hover {
  background: #FAFAF9;
  border-color: #15803D;
  color: #166534;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .discover-layout {
    flex-direction: column;
  }
  .discover-map-container {
    min-height: 40vh;
    flex: 0 0 40vh;
  }
  .discover-sidebar {
    width: 100%;
    flex: 1;
    border-left: none;
    border-top: 1px solid #E5E5E5;
  }
}
