/* ============================================================
   AdressClass — Stylesheet
   ============================================================ */

:root {
  --primary:    #1a2a6c;
  --secondary:  #2c5364;
  --accent:     #00d2ff;
  --collectif:  #2980b9;
  --individuel: #27ae60;
  --inconnu:    #e67e22;
  --bg:         #f0f4f8;
  --card-bg:    #ffffff;
  --text:       #2d3748;
  --muted:      #718096;
  --border:     #e2e8f0;
  --shadow:     0 4px 24px rgba(26,42,108,.12);
  --radius:     14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ───────────────────────────────────────────────── */
.ac-hero {
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  padding: 28px 40px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.ac-hero-brand { display: flex; align-items: center; gap: 16px; }
.ac-hero-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: 0 4px 12px rgba(0,210,255,.35);
}
.ac-hero-title { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.ac-hero-sub   { color: rgba(255,255,255,.65); font-size: 13px; margin-top: 3px; }
.ac-hero-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ac-badge {
  padding: 5px 14px; border-radius: 20px; font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}
.ac-badge-api  { background: rgba(0,210,255,.15); color: #00d2ff; border: 1px solid rgba(0,210,255,.3); }
.ac-badge-free { background: rgba(39,174,96,.15); color: #2ecc71; border: 1px solid rgba(39,174,96,.3); }
.ac-badge-ver  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.2); }

/* ── LAYOUT ───────────────────────────────────────────────── */
.ac-wrap { max-width: 1400px; margin: 0 auto; padding: 30px 24px 60px; }

/* ── CARDS ────────────────────────────────────────────────── */
.ac-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.ac-card-header {
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--border);
}
.ac-card-header-gradient {
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
  color: #fff;
  border-bottom: none;
}
.ac-card-header-gradient .ac-card-title { color: #fff; }
.ac-card-title {
  font-size: 16px; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.ac-card-body { padding: 24px; }

/* ── UPLOAD ZONE ──────────────────────────────────────────── */
.ac-upload-zone {
  border: 3px dashed #c0cfe8;
  border-radius: 12px;
  padding: 50px 30px;
  text-align: center;
  cursor: pointer;
  transition: all .25s ease;
  background: #f7faff;
  position: relative;
}
.ac-upload-zone:hover,
.ac-upload-zone.dragover {
  border-color: var(--accent);
  background: #eef6ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,210,255,.15);
}
.ac-upload-icon { font-size: 56px; margin-bottom: 14px; display: block; }
.ac-upload-title { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.ac-upload-sub   { color: var(--muted); font-size: 13px; line-height: 1.6; }
.ac-upload-input { display: none; }
.ac-upload-btn   {
  display: inline-block; margin-top: 18px;
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
  color: #fff !important; padding: 12px 28px; border-radius: 30px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  border: none; transition: all .2s;
  box-shadow: 0 4px 12px rgba(26,42,108,.3);
}
.ac-upload-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(26,42,108,.4); }

/* ── OPTIONS ──────────────────────────────────────────────── */
.ac-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.ac-opt-group label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px;
}
.ac-opt-select, .ac-opt-input {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text);
  background: #fff; transition: border-color .2s;
  appearance: none;
}
.ac-opt-select:focus, .ac-opt-input:focus { border-color: var(--accent); outline: none; }

/* ── TOGGLE SWITCH ────────────────────────────────────────── */
.ac-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ac-toggle input { display: none; }
.ac-toggle-track {
  width: 46px; height: 24px; background: #cbd5e0; border-radius: 12px;
  position: relative; transition: background .2s;
}
.ac-toggle-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ac-toggle input:checked + .ac-toggle-track { background: var(--accent); }
.ac-toggle input:checked + .ac-toggle-track::after { left: 25px; }
.ac-toggle-label { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── FORMAT GUIDE ─────────────────────────────────────────── */
.ac-format-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.ac-format-table th {
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
  color: #fff; padding: 10px 14px; text-align: left; font-weight: 600;
}
.ac-format-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.ac-format-table tr:nth-child(even) td { background: #f7faff; }
.ac-format-table tr:last-child td { border-bottom: none; }
.ac-format-badge {
  padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700;
  text-transform: uppercase;
}
.ac-format-badge-req { background: #fde8e8; color: #c0392b; }
.ac-format-badge-opt { background: #e8f5e9; color: #1e8449; }

/* ── PREVIEW ──────────────────────────────────────────────── */
.ac-preview-scroll { overflow-x: auto; }
.ac-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ac-preview-table th {
  background: #f0f4f8; padding: 8px 12px;
  font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700;
  border-bottom: 2px solid var(--border);
}
.ac-preview-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.ac-preview-table tr:hover td { background: #f7faff; }

.ac-col-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ac-col-map-group label {
  display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px;
}
.ac-col-map-select {
  width: 100%; padding: 9px 12px; border: 2px solid var(--border);
  border-radius: 8px; font-size: 13px; background: #fff;
}
.ac-col-map-select:focus { border-color: var(--accent); outline: none; }

/* ── PROGRESS ─────────────────────────────────────────────── */
.ac-progress-wrap {
  background: #f0f4f8; border-radius: 30px; height: 12px;
  overflow: hidden; margin: 16px 0;
}
.ac-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00d2ff, #3a7bd5);
  border-radius: 30px;
  transition: width .3s ease;
  width: 0%;
}
.ac-progress-info {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 6px;
}
.ac-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 3px solid rgba(0,210,255,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── STATS CARDS ──────────────────────────────────────────── */
.ac-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.ac-stat-card {
  background: #fff; border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  border-left: 5px solid var(--border);
  transition: transform .2s;
}
.ac-stat-card:hover { transform: translateY(-2px); }
.ac-stat-card.total    { border-left-color: #8e44ad; }
.ac-stat-card.collectif{ border-left-color: var(--collectif); }
.ac-stat-card.individuel{ border-left-color: var(--individuel); }
.ac-stat-card.inconnu  { border-left-color: var(--inconnu); }
.ac-stat-num   { font-size: 32px; font-weight: 800; line-height: 1; }
.ac-stat-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }
.ac-stat-pct   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── TABS ─────────────────────────────────────────────────── */
.ac-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.ac-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 700;
  color: var(--muted); border: none; background: none;
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; border-radius: 8px 8px 0 0;
  transition: all .2s;
}
.ac-tab:hover { background: #f0f4f8; color: var(--primary); }
.ac-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #f0f4f8; }
.ac-tab-pane { display: none; }
.ac-tab-pane.active { display: block; }

/* ── RESULTS TABLE ────────────────────────────────────────── */
.ac-filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  align-items: center; margin-bottom: 16px;
}
.ac-search {
  flex: 1; min-width: 200px; padding: 10px 14px 10px 38px;
  border: 2px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23718096' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.85-3.85zm-5.242 1.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
  background-size: 16px;
}
.ac-search:focus { border-color: var(--accent); outline: none; }
.ac-filter-btn {
  padding: 10px 16px; border: 2px solid var(--border); border-radius: 8px;
  background: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .2s; color: var(--text);
}
.ac-filter-btn:hover  { border-color: var(--primary); color: var(--primary); }
.ac-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.ac-table-wrap { overflow-x: auto; }
.ac-result-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.ac-result-table thead tr {
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
}
.ac-result-table th {
  color: rgba(255,255,255,.9); padding: 12px 14px;
  font-weight: 700; font-size: 12px; text-align: left;
  text-transform: uppercase; letter-spacing: .5px;
  cursor: pointer; white-space: nowrap;
  user-select: none;
}
.ac-result-table th:hover { color: #fff; background: rgba(255,255,255,.1); }
.ac-result-table th .sort-arrow { opacity: .5; font-size: 10px; margin-left: 4px; }
.ac-result-table tbody tr { transition: background .15s; }
.ac-result-table tbody tr:nth-child(even) { background: #f7faff; }
.ac-result-table tbody tr:hover { background: #eef3fb; }
.ac-result-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ac-result-table tbody tr.row-collectif { border-left: 4px solid var(--collectif); }
.ac-result-table tbody tr.row-individuel{ border-left: 4px solid var(--individuel); }
.ac-result-table tbody tr.row-inconnu   { border-left: 4px solid var(--inconnu); }

/* ── TYPE BADGES ──────────────────────────────────────────── */
.ac-type-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ac-type-collectif  { background: #dbeafe; color: #1d4ed8; }
.ac-type-individuel { background: #dcfce7; color: #166534; }
.ac-type-inconnu    { background: #fef3c7; color: #92400e; }

/* ── CONFIDENCE BAR ───────────────────────────────────────── */
.ac-conf-wrap { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.ac-conf-bar-bg { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.ac-conf-bar-fill { height: 100%; border-radius: 3px; }
.fill-collectif  { background: var(--collectif); }
.fill-individuel { background: var(--individuel); }
.fill-inconnu    { background: var(--inconnu); }
.ac-conf-num { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 32px; text-align: right; }

/* ── INDICATORS TOOLTIP ───────────────────────────────────── */
.ac-ind-btn {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 7px; font-size: 11px; cursor: pointer;
  color: var(--muted); transition: all .15s;
}
.ac-ind-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── ACTION BUTTONS ───────────────────────────────────────── */
.ac-action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ac-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 22px; border-radius: 8px; font-size: 13px;
  font-weight: 700; cursor: pointer; border: none;
  transition: all .2s; text-decoration: none;
}
.ac-btn-primary {
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(26,42,108,.3);
}
.ac-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(26,42,108,.4); }
.ac-btn-success {
  background: linear-gradient(135deg, #1e8449, #27ae60);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(39,174,96,.3);
}
.ac-btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(39,174,96,.4); }
.ac-btn-outline {
  background: #fff; border: 2px solid var(--border);
  color: var(--text) !important;
}
.ac-btn-outline:hover { border-color: var(--primary); color: var(--primary) !important; }
.ac-btn-danger {
  background: linear-gradient(135deg, #922b21, #e74c3c);
  color: #fff !important;
}

/* ── MAP ──────────────────────────────────────────────────── */
#ac-map { height: 480px; border-radius: 12px; overflow: hidden; z-index: 1; }

/* ── CHARTS ───────────────────────────────────────────────── */
.ac-charts-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}
.ac-chart-card {
  background: #fff; border-radius: 12px;
  padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.ac-chart-title {
  font-size: 14px; font-weight: 700; color: var(--primary);
  margin-bottom: 16px; display: flex; align-items: center; gap: 6px;
}

/* ── HISTORY ──────────────────────────────────────────────── */
.ac-history-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .15s; cursor: pointer;
}
.ac-history-item:last-child { border-bottom: none; }
.ac-history-item:hover { background: #f7faff; }
.ac-history-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, #1a2a6c, #2c5364);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.ac-history-info { flex: 1; min-width: 0; }
.ac-history-name { font-weight: 700; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-history-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ac-history-stats { display: flex; gap: 10px; font-size: 11px; font-weight: 700; }
.ac-history-stats .c { color: var(--collectif); }
.ac-history-stats .i { color: var(--individuel); }
.ac-history-stats .u { color: var(--inconnu); }

/* ── MODAL ────────────────────────────────────────────────── */
.ac-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 9000;
  align-items: center; justify-content: center;
}
.ac-modal-overlay.active { display: flex; }
.ac-modal {
  background: #fff; border-radius: 16px;
  padding: 28px 32px; max-width: 520px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ac-modal-title { font-size: 18px; font-weight: 800; color: var(--primary); margin-bottom: 14px; }
.ac-modal-body  { font-size: 14px; color: var(--text); line-height: 1.6; margin-bottom: 20px; }
.ac-modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ── INDICATORS PANEL ─────────────────────────────────────── */
.ac-ind-panel {
  background: #f7faff; border-radius: 8px; padding: 12px;
  font-size: 12px; margin-top: 8px;
}
.ac-ind-tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  margin: 2px; font-size: 11px; font-weight: 700;
}
.ac-ind-tag.c { background: #dbeafe; color: #1d4ed8; }
.ac-ind-tag.i { background: #dcfce7; color: #166534; }

/* ── SAMPLE SECTION ───────────────────────────────────────── */
.ac-sample-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; background: #eaf7f4;
  border: 1.5px solid #27ae60; border-radius: 20px;
  color: #1e8449 !important; font-size: 12px; font-weight: 700;
  text-decoration: none; transition: all .2s;
}
.ac-sample-btn:hover { background: #27ae60; color: #fff !important; }

/* ── ALERTS ───────────────────────────────────────────────── */
.ac-alert {
  padding: 12px 18px; border-radius: 8px; font-size: 13px;
  font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.ac-alert-error  { background: #fde8e8; color: #922b21; border: 1px solid #f5c6c6; }
.ac-alert-info   { background: #e8f4fd; color: #1a5276; border: 1px solid #aed6f1; }
.ac-alert-success{ background: #e8f8f0; color: #1e8449; border: 1px solid #a9dfbf; }

/* ── SECTION HIDDEN ───────────────────────────────────────── */
.ac-hidden { display: none !important; }

/* ── PAGINATION ───────────────────────────────────────────── */
.ac-pagination {
  display: flex; gap: 6px; align-items: center;
  justify-content: center; margin-top: 20px; flex-wrap: wrap;
}
.ac-page-btn {
  width: 36px; height: 36px; border: 2px solid var(--border);
  border-radius: 8px; background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 700; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.ac-page-btn:hover   { border-color: var(--primary); color: var(--primary); }
.ac-page-btn.active  { background: var(--primary); color: #fff; border-color: var(--primary); }
.ac-page-btn.wide    { width: auto; padding: 0 12px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .ac-hero { padding: 18px 20px; }
  .ac-hero-title { font-size: 20px; }
  .ac-wrap { padding: 16px 14px 40px; }
  .ac-charts-grid { grid-template-columns: 1fr; }
  .ac-stats-row { grid-template-columns: repeat(2, 1fr); }
  .ac-result-table { font-size: 11px; }
  .ac-result-table th, .ac-result-table td { padding: 8px 10px; }
}
@media (max-width: 480px) {
  .ac-stats-row { grid-template-columns: 1fr; }
  .ac-col-map-grid { grid-template-columns: 1fr 1fr; }
}
