/* =========================================================
   CO2 CALCULATOR - GO PLUS EXPRESS
   Calculateur d'émissions CO₂ pour la logistique
   Préfixe: co2-  |  Design Cargoson-inspired Teal/Gold
   ========================================================= */

.co2-module {
  padding: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Hero header */
.co2-hero {
  background: linear-gradient(135deg, var(--dark) 0%, #1a3144 60%, #0f1e2e 100%);
  position: relative;
  padding: 50px 30px;
  text-align: center;
  overflow: hidden;
  color: #fff;
}
.co2-hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245, 197, 24, 0.15), transparent 70%);
  pointer-events: none;
}
.co2-hero::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0, 169, 157, 0.15), transparent 70%);
  pointer-events: none;
}
.co2-hero-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--gold) 50%, var(--teal) 100%);
}
.co2-hero-content { position: relative; z-index: 2; max-width: 800px; margin: 0 auto; }
.co2-hero h1 {
  font-family: var(--font);
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.co2-hero h1 .accent { color: var(--gold); }
.co2-hero h1 .leaf {
  display: inline-block;
  color: var(--teal);
  margin-right: 8px;
  animation: co2-leaf-sway 3s ease-in-out infinite;
}
@keyframes co2-leaf-sway {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
.co2-hero p {
  font-size: 1.05rem;
  opacity: 0.85;
  margin: 0 auto 6px;
  max-width: 700px;
  line-height: 1.6;
}
.co2-hero-modes {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.co2-mode-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.co2-mode-badge:hover { background: rgba(245, 197, 24, 0.15); border-color: var(--gold); }
.co2-mode-badge i { color: var(--gold); }

/* Form */
.co2-form-section {
  padding: 30px;
  background: #fafbfc;
  border-bottom: 1px solid #e6e9ef;
}
.co2-form-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e6e9ef;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.co2-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}
@media (max-width: 700px) {
  .co2-form-grid { grid-template-columns: 1fr; }
}

.co2-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.co2-fieldset-legend {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.co2-fieldset-legend i {
  width: 24px; height: 24px;
  background: var(--teal);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.co2-fieldset.delivery .co2-fieldset-legend i { background: var(--gold); color: var(--dark); }

.co2-field { margin-bottom: 12px; position: relative; }
.co2-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 5px;
}
.co2-field input,
.co2-field select {
  width: 100%;
  padding: 11px 14px;
  background: #fff;
  border: 1.5px solid #d8dde5;
  border-radius: 8px;
  color: var(--dark);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
}
.co2-field input:focus,
.co2-field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 169, 157, 0.12);
}
.co2-field-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }

.co2-suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #d8dde5;
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  display: none;
}
.co2-suggestions.show { display: block; }
.co2-suggestion {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f0f4f8;
  transition: var(--transition);
}
.co2-suggestion:hover { background: #f0f4f8; }
.co2-suggestion .city { font-weight: 600; color: var(--dark); }
.co2-suggestion .country { color: #6b7280; font-size: 11px; }

.co2-calculate-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--gold);
  border: none;
  border-radius: 10px;
  color: var(--dark);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  letter-spacing: 0.02em;
}
.co2-calculate-btn:hover {
  background: #e0b00d;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 197, 24, 0.3);
}
.co2-calculate-btn:disabled {
  background: #d8dde5;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Results */
.co2-results {
  padding: 30px;
  background: #fafbfc;
  display: none;
}
.co2-results.show { display: block; animation: co2-fade-in 0.5s ease; }
@keyframes co2-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.co2-results-header {
  text-align: center;
  margin-bottom: 24px;
}
.co2-results-header h2 {
  font-size: 1.4rem;
  color: var(--dark);
  margin: 0 0 6px;
}
.co2-results-header p {
  color: #6b7280;
  margin: 0;
  font-size: 14px;
}

.co2-best-card {
  background: linear-gradient(135deg, var(--teal) 0%, #008a80 100%);
  color: #fff;
  padding: 22px 26px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0, 169, 157, 0.25);
}
.co2-best-icon {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.co2-best-content { flex: 1; }
.co2-best-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
  margin-bottom: 4px;
}
.co2-best-mode {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.co2-best-value {
  font-size: 0.95rem;
  opacity: 0.9;
  font-family: 'Courier New', monospace;
}

.co2-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.co2-mode-card {
  background: #fff;
  border: 1.5px solid #e6e9ef;
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.co2-mode-card.unavailable {
  opacity: 0.5;
  background: #f5f7fa;
}
.co2-mode-card:not(.unavailable):hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.co2-mode-card.best {
  border-color: var(--teal);
  background: linear-gradient(135deg, #fff 0%, #f0fdfa 100%);
}
.co2-mode-card.best::before {
  content: '★ MEILLEUR';
  position: absolute;
  top: 10px; right: 10px;
  background: var(--teal);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 999px;
}

.co2-mode-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f4f8;
}
.co2-mode-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}
.co2-mode-icon.road { background: linear-gradient(135deg, #3498db, #2980b9); }
.co2-mode-icon.sea { background: linear-gradient(135deg, var(--teal), #008a80); }
.co2-mode-icon.air { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.co2-mode-icon.rail { background: linear-gradient(135deg, #9b59b6, #8e44ad); }

.co2-mode-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.co2-mode-tagline {
  font-size: 11px;
  color: #6b7280;
  margin: 2px 0 0;
}

.co2-mode-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}
.co2-mode-stat-label { color: #6b7280; }
.co2-mode-stat-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--dark);
}
.co2-mode-stat-value.highlight {
  color: var(--teal);
  font-size: 15px;
}
.co2-mode-stat-value.danger {
  color: #c0392b;
  font-size: 15px;
}

.co2-mode-emission {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px dashed #e6e9ef;
  text-align: center;
}
.co2-emission-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 4px;
}
.co2-emission-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  letter-spacing: -0.02em;
}
.co2-emission-value.low { color: var(--teal); }
.co2-emission-value.mid { color: #f39c12; }
.co2-emission-value.high { color: #c0392b; }
.co2-emission-unit {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  margin-left: 4px;
}

/* Comparison chart */
.co2-chart-card {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.co2-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.co2-chart-title i { color: var(--teal); }

.co2-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.co2-bar-label {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.co2-bar-track {
  flex: 1;
  height: 28px;
  background: #f0f4f8;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.co2-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  min-width: 40px;
}
.co2-bar-fill.road { background: linear-gradient(90deg, #3498db, #2980b9); }
.co2-bar-fill.sea { background: linear-gradient(90deg, var(--teal), #008a80); }
.co2-bar-fill.air { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.co2-bar-fill.rail { background: linear-gradient(90deg, #9b59b6, #8e44ad); }
.co2-bar-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--dark);
  min-width: 80px;
  text-align: right;
}

/* Equivalences */
.co2-equiv-card {
  background: linear-gradient(135deg, #fffbea 0%, #fef3c7 100%);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.co2-equiv-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.co2-equiv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.co2-equiv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px 12px;
  border-radius: 8px;
}
.co2-equiv-icon {
  width: 36px; height: 36px;
  background: var(--dark);
  color: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.co2-equiv-text { flex: 1; }
.co2-equiv-value {
  font-weight: 700;
  color: var(--dark);
  font-family: 'Courier New', monospace;
  font-size: 14px;
}
.co2-equiv-desc {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

/* Methodology */
.co2-method {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
}
.co2-method-toggle {
  background: transparent;
  border: none;
  color: var(--teal);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.co2-method-toggle:hover { text-decoration: underline; }
.co2-method-content { display: none; margin-top: 12px; }
.co2-method-content.show { display: block; }
.co2-method-content table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}
.co2-method-content th,
.co2-method-content td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #f0f4f8;
}
.co2-method-content th {
  background: #f0f4f8;
  font-weight: 600;
  color: var(--dark);
}
.co2-method-content td.num {
  font-family: 'Courier New', monospace;
  text-align: right;
}

/* Actions */
.co2-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.co2-btn {
  padding: 10px 18px;
  border: 1px solid #d8dde5;
  background: #fff;
  color: var(--dark);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.co2-btn:hover { border-color: var(--teal); color: var(--teal); background: #f0fdfa; }
.co2-btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.co2-btn.primary:hover { background: #008a80; color: #fff; }

/* Loading */
.co2-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: co2-spin 0.7s linear infinite;
}
@keyframes co2-spin { to { transform: rotate(360deg); } }

/* RTL */
[dir="rtl"] .co2-best-card { flex-direction: row-reverse; }
[dir="rtl"] .co2-mode-card.best::before { right: auto; left: 10px; }

/* Responsive */
@media (max-width: 600px) {
  .co2-hero { padding: 30px 20px; }
  .co2-hero h1 { font-size: 1.5rem; }
  .co2-form-section, .co2-results { padding: 20px; }
  .co2-form-card { padding: 18px; }
  .co2-best-card { flex-direction: column; text-align: center; }
}
