/* Design System & Aesthetics - Carte Électorale du Québec */
:root {
  --bg-primary: #090d16;
  --bg-panel: rgba(15, 23, 42, 0.65);
  --border-panel: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Couleurs des Partis Demandées */
  --color-pcq: #0c2340;       /* Bleu foncé */
  --color-pq: #0055a5;        /* Bleu */
  --color-caq: #00adef;       /* Bleu pâle */
  --color-qs: #ffc20e;        /* Jaune */
  --color-plq: #e31b23;       /* Rouge */
  --color-autres: #64748b;    /* Gris */
  --color-canadien: #b19cd9;  /* Mauve */
  
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Dashboard Container */
.dashboard {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 420px;
  height: 100%;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-panel);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-panel);
}

.sidebar-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.sidebar-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sidebar-content {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Toggle Switch */
.switch-container {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-panel);
  padding: 4px;
  border-radius: 9999px;
  position: relative;
}

.switch-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 9999px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.switch-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Seat Summary Grid */
.seats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.seat-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.seat-card:hover {
  transform: translateY(-2px);
}

.seat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--party-color, var(--text-muted));
}

.seat-party-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.seat-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

/* Detail Panel */
.detail-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-panel);
  border-radius: 16px;
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
}

.detail-panel.active {
  background: rgba(255, 255, 255, 0.05);
  border-style: solid;
  align-items: flex-start;
  text-align: left;
  justify-content: flex-start;
}

.detail-placeholder {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.detail-placeholder svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
}

.detail-header {
  width: 100%;
  border-bottom: 1px solid var(--border-panel);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.detail-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.detail-code {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-value {
  font-weight: 600;
  color: #ffffff;
}

/* Party Badge */
.party-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  background-color: var(--badge-color, var(--text-muted));
}

/* Map Styling */
.map-container {
  flex-grow: 1;
  height: 100%;
  background-color: #0b0e14;
}

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

/* Leaflet Overrides */
.leaflet-container {
  font-family: var(--font-family) !important;
}

.leaflet-bar {
  border: 1px solid var(--border-panel) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-bar a {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-bottom: 1px solid var(--border-panel) !important;
  transition: background-color 0.2s ease;
}

.leaflet-bar a:hover {
  background-color: #334155 !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-panel) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-panel) !important;
  color: var(--text-primary) !important;
  border-radius: 12px !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px solid var(--border-panel) !important;
}

/* Custom Map Tooltip/Popup formatting */
.tooltip-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.tooltip-row {
  font-size: 0.8rem;
  margin-bottom: 2px;
}

/* Legend inside Map */
.info.legend {
  padding: 12px 16px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
}

.info.legend h4 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
