@font-face {
  font-family: 'cerapro-black';
  src: url('../asset/font/cera-pro-black\ 2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'cerapro-medium';
  src: url('../asset/font/cera-pro-medium\ 2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
a {
  text-decoration: none;
  color: black;
}

html,
body {
  height: 100%;
  font-family: 'cerapro-black', sans-serif;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header,
footer {
  height: 10vh;
  background-color: #333;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

main {
  flex: 1;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.5rem;
}

main.center-form {
  justify-content: center;
}

main:not(.center-form) {
  justify-content: flex-start;
}

header {
  height: 8vh;
  background-color: #fff;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: #000 solid 1px;
}

.header-left {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  margin-right: 1rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: bold;
}

.header-right a {
  margin-right: 3vh;
  color: #000;
  text-decoration: none;
  margin-left: 2rem;
  font-size: 1rem;
  transition: color 0.2s;
}

.header-right .actual {
  color: #FFA600;
  text-decoration: underline;
}

.header-right a:hover {
  color: #FFA600;
}

footer {
  height: 8vh;
  background-color: #fff;
  color: #000;
  display: flex;
  align-items: center; /* Centre verticalement */
  justify-content: space-between;
  padding: 0 2rem;
  font-size: 1rem;
  border-top: #000 solid 1px;
  position: relative;
}

.footer-center {
  text-align: center;
  flex: 1;
}


.footer-left {
  text-align: left;
}

.footer-right {
  text-align: right;
}

.accueil-main {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 0;
}

.accueil-main h1 {
  text-align: center;
  margin-left: 0;
  font-size: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 600px) {
  .accueil-main h1 {
    margin-right: 4vw;
    font-size: 1.2rem;
  }
}

.recherche-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.select-row {
  display: flex;
  gap: 2rem;
  margin-bottom: 0.5rem;
  width: 100%;
  justify-content: center;
  max-width: 700px;
}

select {
  cursor: pointer;
}

.select-row select {
  flex: 1 1 0;
  min-width: 0;
  max-width: 220px;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  border: 1px solid #000;
  font-size: 1rem;
  background: #fff;
  transition: border 0.2s;
  box-sizing: border-box;
}

.cta-button {
  margin-top: 1.5rem;
  width: 100%;
  max-width: 212px;
  align-self: flex-end;
  background: #FFD602;
  color: #000;
  text-decoration: none;
  padding: 0.8rem 2.2rem;
  border-radius: 10px;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.cta-button:hover {
  background: #FFC400;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 214, 0, 0.4);
}

/* Responsive : sur mobile, on passe en colonne */
@media (max-width: 700px) {
  .select-row {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    max-width: 350px;
  }

  .cta-button {
    max-width: 100%;
    align-self: stretch;
  }
}

/* CORRIGÉ : Styles pour le tableau scrollable avec taille FIXE */
.table-container {
  height: 400px !important; /* HAUTEUR FIXE */
  width: 800px !important; /* LARGEUR FIXE */
  overflow-y: auto;
  overflow-x: auto;
  border: 2px solid #000;
  border-radius: 14px;
  margin: 2rem auto;
  background: white;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-family: 'cerapro-medium', sans-serif;
  table-layout: fixed; /* Force les colonnes à garder leur taille */
}

.table-container thead {
  position: sticky;
  top: 0;
  background-color: #010326;
  z-index: 10;
}

.table-container thead th {
  background-color: #010326 !important;
  color: white !important;
  padding: 15px 12px;
  text-align: left;
  border-bottom: 2px solid #000;
  border-right: 1px solid #333;
  font-weight: bold;
  font-size: 1rem;
  /* Largeurs fixes pour chaque colonne */
  width: 25%; 
  text-align: center;
}

.table-container thead th:nth-child(1) { width: 30%; } /* Installateur */
.table-container thead th:nth-child(2) { width: 25%; } /* Marque Onduleur */
.table-container thead th:nth-child(3) { width: 25%; } /* Marque Panneau */
.table-container thead th:nth-child(4) { width: 20%; } /* Département */

.table-container tbody td {
  padding: 12px;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #ddd;
  text-align: left;
  font-size: 0.9rem;
  background: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.table-container tbody tr:hover {
  background-color: #f0f0f0 !important;
}

.clickable-row {
  transition: background-color 0.2s ease;
  cursor: pointer !important;
}

.clickable-row:hover {
  background-color: #f0f0f0 !important;
}

/* Scrollbar personnalisée */
.table-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive pour les tableaux */
@media (max-width: 800px) {
  .table-container {
    width: 95% !important;
    height: 300px !important;
  }
  
  .table-container th,
  .table-container td {
    padding: 8px 6px;
    font-size: 0.8rem;
  }
}

/* Cacher les tableaux au chargement */
#result-tables {
  display: none;
  opacity: 0;
  animation: none;
  transition: opacity 0.3s;
}

/* Animation d'apparition */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#result-tables.show {
  display: block !important; /* Changé de flex à block */
  animation: fadeInUp 0.5s cubic-bezier(.42, 0, .58, 1) forwards;
}

/* Edit input styles */
.edit-input {
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Edit button styles */
.edit-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.edit-btn:hover {
  background-color: #45a049;
}

.notification {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 25px;
  border-radius: 5px;
  font-size: 16px;
  color: white;
  z-index: 1000;
  transition: top 0.3s ease-in-out;
}

.notification.show {
  top: 20px;
}

.notification.success {
  background-color: #4CAF50;
}

.notification.error {
  background-color: #f44336;
}


.table-container thead th:nth-child(1) { width: 15%; } /* Date installation */
.table-container thead th:nth-child(2) { width: 15%; } /* Nb panneaux */
.table-container thead th:nth-child(3) { width: 15%; } /* Surface */
.table-container thead th:nth-child(4) { width: 20%; } /* Puissance crête */
.table-container thead th:nth-child(5) { width: 35%; } /* Localisation */


/* Styles pour les en-têtes triables */
.table-container thead th {
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.table-container thead th:hover {
  background-color: #1a1f4a !important;
}

/* Indicateur de tri */
.sort-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 12px;
  color: #ccc;
}

.table-container thead th:hover .sort-indicator {
  opacity: 1;
}

/* Indicateur actif */
.sort-indicator.active {
  opacity: 1 !important;
  color: #FFD602;
}

.sort-indicator.asc::before {
  content: "▲";
}

.sort-indicator.desc::before {
  content: "▼";
}

.sort-indicator:not(.active):not(.asc):not(.desc)::before {
  content: "^";
}

/* Styles pour les boutons de téléchargement dans le tableau */
.download-row td {
  background-color: #f8f9fa !important;
  border-top: 2px solid #000 !important;
  padding: 15px !important;
  text-align: center;
}

.download-row:hover {
  background-color: #f8f9fa !important;
}

.download-btn-table {
  background: #FFD602;
  color: #000;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0 0.5rem;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.download-btn-table:hover {
  background: #d3b001;
}

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

/* Responsive pour les boutons dans le tableau */
@media (max-width: 600px) {
  .download-btn-table {
    display: block;
    margin: 0.3rem auto;
    width: 150px;
  }
}
