/* ===== MÉTALLERIE PWA - STYLES CSS ===== */
/* Fichier CSS principal pour l'application PWA Métallerie */
/* Auteur: Michel Grillon - 2025 */

/* ===== RESET ET BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #2d3748 0%, #374151 100%);
  color: #f8fafc;
  min-height: 100vh;
}

/* CSS link color */
a {
  color: #ffffff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HEADER ===== */
.header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #60a5fa;
}

.header p {
  opacity: 0.8;
}

/* ===== GESTION DES PAGES ===== */
.page {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== NAVIGATION ===== */
.nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.nav-btn,
.btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.nav-btn:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.back-btn {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  margin-bottom: 20px;
}

/* ===== SOMMAIRE ===== */
.sommaire-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.sommaire-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 25px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sommaire-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
}

.sommaire-card h3 {
  color: #60a5fa;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.sommaire-list {
  list-style: none;
}

.sommaire-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sommaire-list li:hover {
  color: #60a5fa;
  padding-left: 10px;
}

.sommaire-list li:last-child {
  border-bottom: none;
}

/* ===== FORMULAIRES ET INPUTS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #93c5fd;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* ===== RÉSULTATS ===== */
.result {
  margin-top: 20px;
  padding: 15px;
  background: rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  border-left: 4px solid #22c55e;
}

.result h4 {
  color: #22c55e;
  margin-bottom: 10px;
}

/* ===== TABLEAUX ===== */
.table-container {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

table {
  width: 90%;
  border-collapse: collapse;
  min-width: 366px;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-weight: 600;
}

tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ===== MODE ÉDITION ===== */
.edit-mode {
  border: 2px dashed #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.mode-toggle {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  margin-bottom: 20px;
}

/* ===== ÉTAPES (STEPS) POUR BARREAUDAGE ===== */
.step {
  display: none;
  margin-bottom: 20px;
}

.step.active {
  display: block;
}

.step-header {
  background: rgba(59, 130, 246, 0.2);
  padding: 15px;
  border-radius: 8px 8px 0 0;
  border-left: 4px solid #3b82f6;
}

.step-content {
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0 0 8px 8px;
}

/* ===== RECHERCHE ===== */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-size: 16px;
}

/* ===== IMAGES ===== */
.image-container {
  text-align: center;
  margin: 20px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

/* Styles pour les images dans le contenu */
.image-petite {
  width: 150px;
  height: auto;
  margin: 10px 0;
  border-radius: 8px;
}

.image-moyenne {
  width: 300px;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
}

.image-cliquable {
  cursor: pointer;
  border: 2px solid #ddd;
  transition: border-color 0.3s ease;
}

.image-cliquable:hover {
  border-color: #007bff;
}

/* Modal pour agrandir les images */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 20px;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal img {
  display: block;
  margin: auto;
  max-width: 90%;
  max-height: 90%;
  margin-top: 50px;
}

.fermer {
  position: absolute;
  top: 20px;
  right: 35px;
  color: white;
  font-size: 40px;
  cursor: pointer;
}

/* ===== PROJECTIONS EUROPÉENNES ===== */
.projection-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 10px;
  max-width: 400px;
  margin: 20px auto;
  text-align: center;
}

.projection-view {
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 2px solid #60a5fa;
}

.projection-view.center {
  background: rgba(59, 130, 246, 0.2);
  font-weight: bold;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 1rem 0;
  background: #333;
  color: #fff;
  position: fixed;
  width: 100%;
  bottom: 0;
}

/* ===== SECTIONS D'EXPORT ===== */
.export-section {
  margin-top: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

/* ===== CLASSES UTILITAIRES AJOUTÉES ===== */
/* Grilles pour formulaires */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

/* Grilles pour sections d'information */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.info-grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Grilles pour tableaux */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Sections avec arrière-plans colorés */
.section-warning {
  background: rgba(245, 158, 11, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.section-info {
  background: rgba(59, 130, 246, 0.2);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.section-success {
  background: rgba(34, 197, 94, 0.1);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.section-light {
  width: 96%;
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 8px;
}

.section-special {
  margin-top: 30px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

/* Marges pour listes */
.list-indented {
  margin-left: 20px;
}

.list-with-margin {
  margin-left: 20px;
  margin-top: 10px;
}

/* Utilitaires de centrage */
.text-center {
  text-align: center;
}

.margin-center {
  margin: 20px auto;
  max-width: 400px;
}

/* Sections avec bordures spéciales */
.section-border-left {
  border-left: 4px solid #f59e0b;
  padding: 20px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 8px;
  margin-top: 30px;
}

/* Grilles spécifiques */
.tolerance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* Styles pour les exemples de calculs */
.calc-example {
  display: inline-block;
  padding: 20px;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  margin: 10px;
}

.calc-max {
  text-align: center;
  padding: 15px;
  background: rgba(34, 197, 94, 0.2);
  border-radius: 8px;
}

.calc-min {
  text-align: center;
  padding: 15px;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 8px;
}

.calc-result {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: 8px;
}

/* Conteneurs SVG */
.svg-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .sommaire-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    flex-direction: column;
  }

  .projection-diagram {
    grid-template-columns: 1fr;
    max-width: 300px;
  }

  .form-grid-2,
  .form-grid-4,
  .info-grid,
  .table-grid {
    grid-template-columns: 1fr;
  }

  .tolerance-grid {
    grid-template-columns: 1fr;
  }
}
