/* ============================================================
 * registre.css — Styles specifiques page registre public Veridy.ca
 * Version: 6-audit
 * ============================================================ */

/* ===================== REGISTRE HERO STATS ===================== */
.reg-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 960px;
  margin: 24px auto 0 auto;
}
.reg-stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.reg-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.reg-stat-value {
  display: block;
  font-size: 2.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}
.reg-stat-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ===================== FILTERS & TOOLBAR ===================== */
.reg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.reg-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.reg-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}
.reg-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reg-search-input:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}
.reg-select {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  color: #374151;
  min-width: 140px;
}

.reg-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.reg-sector-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.reg-sector-chip:hover {
  border-color: #1e40af;
  color: #1e40af;
}
.reg-sector-chip.active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}
.reg-sector-chip .count {
  opacity: 0.7;
  margin-left: 4px;
  font-size: 0.78rem;
}

/* Results count + active filter chips */
.reg-results-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.reg-results-count {
  color: var(--text-muted, #6b7280);
  font-size: 0.92rem;
  margin: 0;
}
.reg-results-count strong {
  color: #111827;
}
.reg-active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.reg-active-chip {
  background: #eff6ff;
  color: #1e40af;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reg-active-chip button {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
}

/* ===================== TABLE ===================== */
.reg-table-container {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.reg-table {
  width: 100%;
  border-collapse: collapse;
}
.reg-table thead {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.reg-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 600;
  white-space: nowrap;
}
.reg-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.reg-table th.sortable:hover {
  color: #1e40af;
}
.reg-table th.sortable .sort-arrow {
  color: #1e40af;
  margin-left: 4px;
}
.reg-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.92rem;
  vertical-align: top;
}
.reg-table tbody tr {
  transition: background 0.1s;
  cursor: pointer;
}
.reg-table tbody tr:hover {
  background: #f9fafb;
}
.reg-table tbody tr.expanded {
  background: #eff6ff;
}
.reg-table tbody tr:last-child td {
  border-bottom: none;
}

.reg-company-name {
  font-weight: 600;
  color: #111827;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reg-company-url {
  font-size: 0.78rem;
  color: #6b7280;
  display: block;
  margin-top: 2px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reg-sector-tag {
  background: #f3f4f6;
  color: #374151;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}
.reg-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
}
.reg-grade-a, .reg-grade-ap { background: #d1fae5; color: #065f46; }
.reg-grade-b { background: #dbeafe; color: #1e40af; }
.reg-grade-c { background: #fef3c7; color: #92400e; }
.reg-grade-d { background: #fed7aa; color: #9a3412; }
.reg-grade-f { background: #fee2e2; color: #991b1b; }
.reg-grade-e { background: #fecaca; color: #991b1b; }
.reg-grade-p { background: #e5e7eb; color: #4b5563; }

.reg-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.reg-status-success { background: #d1fae5; color: #065f46; }
.reg-status-warning { background: #fef3c7; color: #92400e; }
.reg-status-danger  { background: #fee2e2; color: #991b1b; }
.reg-status-unknown { background: #e5e7eb; color: #4b5563; }

.reg-violations {
  font-size: 0.92rem;
  color: #374151;
}
.reg-violations-zero {
  color: #9ca3af;
}

.reg-score-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reg-score-bar {
  height: 5px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
  width: 80px;
}
.reg-score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.reg-expand-icon {
  display: inline-block;
  transition: transform 0.2s;
  color: #9ca3af;
  margin-right: 6px;
}
.reg-table tbody tr.expanded .reg-expand-icon {
  transform: rotate(90deg);
  color: #1e40af;
}

.reg-row-detail td {
  padding: 24px 28px;
  background: #f9fafb;
}
.reg-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.reg-detail-section h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0 0 12px 0;
}
.reg-detail-section ul {
  margin: 0;
  padding-left: 18px;
}
.reg-detail-section li {
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #374151;
}
.reg-detail-section li strong {
  color: #111827;
}

.reg-priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 6px;
}
.reg-prio-critical { background: #fee2e2; color: #991b1b; }
.reg-prio-high     { background: #fed7aa; color: #9a3412; }
.reg-prio-medium   { background: #fef3c7; color: #92400e; }
.reg-prio-low      { background: #e5e7eb; color: #4b5563; }
.reg-detail-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Empty / Loading */
.reg-empty, .reg-loading {
  padding: 48px 24px;
  text-align: center;
  color: #6b7280;
}
.reg-empty h3 {
  color: #374151;
  margin: 0 0 8px 0;
  font-weight: 600;
  font-size: 1.1rem;
}
.reg-empty p {
  margin: 0;
  font-size: 0.92rem;
}
.reg-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.reg-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: reg-spin 0.8s linear infinite;
}
@keyframes reg-spin {
  to { transform: rotate(360deg); }
}

/* Pagination */
.reg-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.reg-pagination[hidden] { display: none; }
.reg-row-detail[hidden] { display: none; }

/* Visualization containers (sector bars + region tags) */
.reg-viz-container {
  margin-bottom: 24px;
}
.reg-sector-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.reg-sector-bar-label {
  min-width: 130px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}
.reg-sector-bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg-secondary, #f3f4f6);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.reg-sector-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  min-width: 3px;
}
.reg-sector-bar-count {
  min-width: 36px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.reg-pagination-info { font-size: 0.85rem; color: #6b7280; }
.reg-pagination-controls { display: flex; gap: 6px; align-items: center; }
.reg-page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.9rem;
  color: #374151;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.reg-page-btn:hover:not(:disabled) {
  border-color: #1e40af;
  color: #1e40af;
}
.reg-page-btn.active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}
.reg-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===================== MODAL CARTE ENTREPRISE ===================== */
.reg-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  animation: reg-fade-in 0.2s ease;
}
@keyframes reg-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.reg-modal-card {
  background: var(--bg-primary, #fff);
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: reg-slide-up 0.25s ease;
}
@keyframes reg-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.reg-modal-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.reg-modal-grade-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.reg-modal-title h2 {
  font-size: 1.4rem;
  margin: 0 0 4px;
}
.reg-modal-title .reg-modal-url {
  font-size: 0.88rem;
  color: var(--text-muted, #6b7280);
}
.reg-modal-title .reg-modal-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 6px;
}
.reg-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary, #f3f4f6);
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.reg-modal-close:hover {
  background: #e5e7eb;
}
.reg-modal-body {
  padding: 24px 28px;
}
.reg-modal-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.reg-modal-metric {
  text-align: center;
  padding: 16px 8px;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 12px;
}
.reg-modal-metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}
.reg-modal-metric-label {
  font-size: 0.72rem;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.reg-modal-section {
  margin-bottom: 20px;
}
.reg-modal-section h3 {
  font-size: 1rem;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reg-modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reg-tech-mini {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.reg-modal-articles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.reg-modal-article {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.reg-modal-interpretation {
  background: var(--bg-secondary, #f9fafb);
  border-left: 4px solid var(--primary, #1e40af);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary, #4b5563);
}
.reg-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 28px 24px;
}
.reg-modal-actions .btn {
  font-size: 0.88rem;
  padding: 10px 18px;
}

/* Modal loading spinner */
.reg-modal-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: reg-spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Lien fiche publique depuis la liste du registre */
.reg-fiche-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(22, 163, 74, 0.55);
  transition: color 0.15s, border-color 0.15s;
}
.reg-fiche-link:hover {
  color: #16a34a;
  border-bottom-color: #16a34a;
  border-bottom-style: solid;
}

/* ===================== RESPONSIVE BREAKPOINTS ===================== */
/* iOS Safari: fix 100vh avec barre d'adresse dynamique */
.hero { min-height: auto; }
@supports (padding: max(0px)) {
  .footer { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
  .nav-container {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
  }
  .nav-container > .btn {
    order: 3;
    font-size: 0.85rem;
    padding: 8px 16px;
  }
  .nav-toggle:hover {
    background: var(--bg-secondary, #f1f5f9);
  }
  .nav-links {
    order: 4;
    width: 100%;
  }
  .nav-links.open {
    display: flex;
  }
  .brand-logo {
    order: 1;
  }
}

@media (max-width: 768px) {
  .reg-hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 4px;
  }
  .reg-stat {
    padding: 12px 8px;
  }
  .reg-stat-value {
    font-size: 1.4rem;
  }
  .reg-stat-label {
    font-size: 0.7rem;
  }
  .reg-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
  }
  .reg-search-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .reg-toolbar select.reg-select {
    width: 100%;
    min-width: 0;
  }
  .reg-results-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .reg-table th, .reg-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  .reg-grade-badge {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .reg-modal-metrics {
    grid-template-columns: 1fr;
  }
  .reg-modal-header {
    flex-direction: column;
    text-align: center;
  }
  .reg-modal-close {
    top: 8px;
    right: 8px;
  }
  .reg-table {
    min-width: 680px;
  }
  .reg-company-name, .reg-company-url {
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .reg-hero-stats {
    grid-template-columns: 1fr;
  }
  .nav-container > .btn {
    display: none;
  }
}
