/* ═══════════════════════════════════════════════
   REGISTRE LEI — styles.css
   ═══════════════════════════════════════════════ */

/* ─── RESET & GLOBAL ─────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1f2937;
  background: #f8f9fa;
}

/* ─── HONEYPOT ────────────────────────────────── */
#hp_field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ─── HEADER ─────────────────────────────────── */
header {
  background: white;
  padding: 16px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

header nav a {
  margin-right: 22px;
  text-decoration: none;
  color: #374151;
  font-weight: 600;
  font-size: 14px;
}
header nav a:hover { color: #b91c1c; }

.btn-lei {
  background: #b91c1c;
  color: white;
  padding: 10px 18px;
  border: none;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-lei:hover { background: #991b1b; }

/* ─── SEARCH SECTION ─────────────────────────── */
.search-section {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.search-section h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.search-section p {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 14px;
}

.search-box {
  display: inline-flex;
  gap: 6px;
  margin-top: 4px;
  max-width: 100%;
}

.search-box input[type="text"]:not(#hp_field) {
  width: 340px;
  max-width: 100%;
  padding: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
  outline: none;
}
.search-box input[type="text"]:not(#hp_field):focus {
  border-color: #1f2937;
}

.search-box button {
  background: #1f2937;
  color: white;
  padding: 14px 22px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.search-box button:hover { background: #111827; }

#searchMessage {
  margin-top: 14px;
  color: #b91c1c;
  font-size: 15px;
  min-height: 20px;
}

#rateLimitMsg {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
}

/* ─── TABLE SECTION ──────────────────────────── */
.table-section {
  padding: 24px;
}

/* Wrapper scrollable — c'est lui qui gère le scroll horizontal */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

table {
  width: 100%;
  min-width: 700px; /* force le scroll plutôt que de compresser */
  border-collapse: collapse;
  background: white;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  color: #1f2937;
  text-align: left;
}

thead th {
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* Largeurs des colonnes */
.col-country     { width: 80px; }
.col-name        { min-width: 200px; }
.col-lei         { min-width: 220px; font-size: 14px; }
.col-status      { width: 140px; }
.col-status-cert { width: 140px; }
.col-action      { width: 100px; text-align: right; }

/* Pays + drapeau */
.flag-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.flag-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}

/* Statut dot */
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.status-active, .status-issued   { background: #22c55e; }
.status-inactive                  { background: #ef4444; }
.status-lapsed                    { background: #f59e0b; }

/* Bouton fiche */
.btn-detail {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-detail:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* ─── PAGINATION ──────────────────────────────── */
.pagination {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
}
.pagination button {
  margin: 0 6px;
  padding: 8px 12px;
  background: #1f2937;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.pagination button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.pagination span { font-weight: 600; }

/* ─── FAQ ────────────────────────────────────── */
.faq-section {
  padding: 36px 30px;
  background: white;
  margin-top: 8px;
}
.faq-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.faq-item {
  margin-bottom: 16px;
}
.faq-item h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.faq-item p {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
}

/* ─── FOOTER ─────────────────────────────────── */
footer {
  background: #1f2937;
  color: #cbd5e1;
  padding: 36px 30px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 8px;
}
footer .footer-col h4 {
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
  font-size: 13px;
  letter-spacing: 0.5px;
}
footer .footer-col a {
  display: block;
  text-decoration: none;
  color: #cbd5e1;
  margin-bottom: 8px;
  font-size: 14px;
}
footer .footer-col a:hover { color: white; }

/* ═══════════════════════════════════════════════
   PAGE RÉSULTAT (resultat.html)
   ═══════════════════════════════════════════════ */

/* Fil d'ariane */
.breadcrumb {
  padding: 14px 30px;
  font-size: 13px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}
.breadcrumb a {
  color: #b91c1c;
  text-decoration: none;
  font-weight: 600;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span {
  font-family: monospace;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #374151;
}

/* Section résultat */
.result-section {
  max-width: 860px;
  margin: 32px auto 60px;
  padding: 0 20px;
}

/* Onglets */
.detail-tabs {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.detail-tab.active {
  color: #b91c1c;
  border-bottom-color: #b91c1c;
}

.detail-tab-icon {
  width: 15px;
  height: 15px;
}

/* Cards */
.detail-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.detail-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #b91c1c;
  padding: 16px 22px 14px;
  border-bottom: 1px solid #f3f4f6;
}

/* Lignes label / valeur */
.detail-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 13px 22px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }

.detail-row-label {
  min-width: 220px;
  color: #374151;
  font-weight: 600;
  flex-shrink: 0;
}

.detail-row-value {
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  word-break: break-all;
}

/* Dot dans la fiche */
.detail-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green  { background: #22c55e; }
.dot-red    { background: #ef4444; }
.dot-yellow { background: #f59e0b; }

/* Bouton copier */
.btn-copy-lei {
  padding: 3px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: 6px;
  white-space: nowrap;
}
.btn-copy-lei:hover { background: #f3f4f6; }

/* Loading / erreur */
.detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 0;
  color: #6b7280;
  font-size: 14px;
}
.detail-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #b91c1c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.detail-error {
  padding: 60px 20px;
  text-align: center;
  color: #b91c1c;
  font-size: 15px;
}
.detail-error a { color: #b91c1c; }

/* ═══════════════════════════════════════════════
   RESPONSIVE MOBILE
   ═══════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Header : logo + bouton sur une ligne, nav en dessous */
  header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }

  header nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 2px;
    /* cache la scrollbar tout en gardant le scroll */
    scrollbar-width: none;
  }
  header nav::-webkit-scrollbar { display: none; }

  header nav a {
    margin-right: 16px;
    font-size: 13px;
  }

  .logo-img { height: 32px; }

  .btn-lei {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Search */
  .search-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
  }

  .search-box input[type="text"]:not(#hp_field) {
    width: 100%;
  }

  .search-box button {
    width: 100%;
  }

  /* Table section : padding réduit */
  .table-section {
    padding: 16px 12px;
  }

  /* FAQ & footer */
  .faq-section {
    padding: 24px 16px;
  }

  footer {
    gap: 24px;
    padding: 28px 16px;
  }

  /* Page résultat */
  .breadcrumb {
    padding: 10px 16px;
    font-size: 12px;
  }

  .result-section {
    padding: 0 12px;
    margin: 20px auto 40px;
  }

  /* Detail rows : label au-dessus de la valeur */
  .detail-row {
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
  }

  .detail-row-label {
    min-width: unset;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .detail-row-value {
    font-size: 14px;
  }

  .detail-card-title {
    padding: 12px 16px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  footer {
    flex-direction: column;
  }
}