/* Reset et styles de base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  background-color: #f5f5f5;
  color: #333;
  padding-top: 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1;
}

/* Barre fixe en haut */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Bouton hamburger */
.menu-toggle {
  position: absolute;
  left: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1002;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: #2c3e50;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle:hover span {
  background: #22c55e;
}

/* Menu sidebar */
.menu-sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  z-index: 1001;
  padding-top: 80px;
}

.menu-sidebar.open {
  left: 0;
}

.menu-header {
  padding: 1rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.25rem;
}

.menu-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.menu-close:hover {
  color: #22c55e;
}

.menu-nav {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.menu-link {
  padding: 1rem;
  text-decoration: none;
  color: #495057;
  background: #f8f9fa;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: block;
}

.menu-link:hover {
  background: #e9ecef;
  border-color: #22c55e;
  color: #22c55e;
}

.menu-link.active {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
  font-weight: 600;
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.menu-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Page d'accueil */
.home-header {
  text-align: center;
  margin-bottom: 3rem;
}

.home-header h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.2rem;
  color: #6c757d;
  margin: 0;
}

.company-info {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(34, 197, 94, 0.05);
  border-radius: 8px;
  border-left: 4px solid #22c55e;
}

.company-info p {
  margin: 0;
  color: #495057;
  font-size: 0.95rem;
}

.company-info a {
  color: #22c55e;
  text-decoration: none;
}

.company-info a:hover {
  text-decoration: underline;
}

.company-info strong {
  color: #2c3e50;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.calculator-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calculator-card:hover {
  border-color: #22c55e;
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.15);
}

.card-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
}

.calculator-card h2 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  text-align: center;
}

.calculator-card p {
  color: #6c757d;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: center;
}

.card-features {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.card-features span {
  color: #22c55e;
  font-size: 0.9rem;
  font-weight: 500;
}

.card-button {
  background: #22c55e;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  margin-top: auto;
}

.calculator-card:hover .card-button {
  background: #16a34a;
}

@media (max-width: 768px) {
  .home-header h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .calculator-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .calculator-card {
    padding: 1.5rem;
  }
}

.top-bar a {
  display: block;
  text-decoration: none;
}

.logo {
  margin-top: 5px;
  height: 70px;
  max-width: 200px;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.8;
}

/* Conteneur principal - Mobile first */
.container {
  max-width: 100%;
  padding: 1rem;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

/* Formulaire */
.calculator-form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
}

.input-with-unit {
  display: flex;
  gap: 0.5rem;
}

input[type="tel"] {
  flex: 0 1 120px;
  max-width: 150px;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

input[type="tel"]:focus {
  outline: none;
  /*border-color: #22c55e;*/
  border-color: #22c55e;
}

select {
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.input-with-unit select {
  min-width: 80px;
}

/* Styles pour les interrupteurs kg/T */
.unit-toggle {
  display: flex;
  border: 2px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background: white;
}

.unit-toggle input[type="radio"] {
  display: none;
}

.unit-toggle label {
  flex: 1;
  padding: 0.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background: #f8f9fa;
  color: #495057;
  border: none;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.9rem;
  margin: 0;
}

.unit-toggle label:first-of-type {
  border-right: 1px solid #ddd;
}

.unit-toggle input[type="radio"]:checked + label {
  background: #22c55e;
  color: white;
  font-weight: 600;
}

.unit-toggle:focus-within {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(0, 201, 80, 0.2);
}

#soilResistance {
  width: 100%;
}

select:focus {
  outline: none;
  border-color: #22c55e;
}

.calculate-btn {
  width: 100%;
  padding: 1rem;
  background-color: #22c55e;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 1rem;
}

.calculate-btn:hover {
  background-color: #00a043;
}

.calculate-btn:active {
  transform: translateY(1px);
}

/* Résultats */
.results {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #22c55e;
}

.results.hidden {
  display: none;
}

.results h2 {
  font-size: 1.25rem;
  color: #22c55e;
  margin-bottom: 1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.result-item:last-child {
  border-bottom: none;
}

.result-label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
}

.result-value {
  font-weight: 700;
  color: #22c55e;
  font-size: 1rem;
}

/* Résultat secondaire plus discret */
.result-item.secondary {
  opacity: 0.8;
  font-size: 0.9em;
  border-top: 1px dashed #ddd;
  padding-top: 0.5rem;
}

.result-item.secondary .result-label {
  font-size: 0.8rem;
  color: #6c757d;
}

.result-item.secondary .result-value {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 600;
}

/* Tablette */
@media (min-width: 768px) {
  .container {
    max-width: 600px;
    padding: 2rem;
  }

  h1 {
    font-size: 2rem;
  }

  .calculator-form {
    padding: 2rem;
  }

  .results {
    padding: 2rem;
  }

  .result-item {
    padding: 1rem 0;
  }

  .result-label,
  .result-value {
    font-size: 1.1rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    max-width: 800px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .input-group {
    margin-bottom: 2rem;
  }

  .unit-toggle label {
    font-size: 1rem;
    padding: 1rem 1.25rem;
  }

  input[type="number"],
  select {
    font-size: 1.1rem;
    padding: 1rem;
  }

  .calculate-btn {
    font-size: 1.1rem;
    padding: 1.25rem;
  }
}

/* États d'erreur */
input:invalid {
  border-color: #e74c3c;
}

.error {
  color: #e74c3c;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

/* Champ personnalisé pour résistance du sol */
.custom-soil-group {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.custom-soil-group.hidden {
  display: none;
}

.custom-soil-group label {
  font-size: 0.85rem;
  color: #495057;
}

.custom-soil-group input[type="number"] {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 16px;
}

/* Sections de calcul (gauche/droite) */
.weight-sections {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.weight-section {
  flex: 1;
  padding: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.weight-section.disabled {
  opacity: 0.5;
  background: #f1f1f1;
  cursor: pointer;
}

.weight-section.disabled input {
  background: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.weight-section.active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.weight-section h3 {
  font-size: 1rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
}

.input-group.compact {
  margin-bottom: 1rem;
}

.input-group.compact label {
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.input-group.compact input[type="tel"] {
  flex: 0 1 100px;
  max-width: 120px;
  font-size: 16px;
  padding: 0.5rem;
}

.input-group.compact .unit-toggle label {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.unit-label {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #e9ecef;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #495057;
  font-weight: 500;
}

@media (max-width: 768px) {
  .weight-sections {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Footer */
.footer {
  background: white;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  border-top: 1px solid #eee;
  margin-top: auto;
}

.footer p {
  margin: 0.25rem 0;
}

.footer a {
  color: #22c55e;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer strong {
  color: #2c3e50;
}

