/* ── 1. RESET & CONFIGURATION GLOBALE ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root { 
  --accent: #3D6B9E; 
  --text: #111;
  --text-2: #666;
  --text-3: #999;
  --text-4: #bbb;
  --border: #e0e0e0;
  --border-light: #ebebeb;
  --bg: #fff;
  --bg-2: #f8f8f8;
  --gutter: 48px;
  --max: 1400px;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ── 2. STRUCTURES DE PAGES (INDEX & FILLES) ── */
.ap-root {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.ap-body {
  display: flex;
  flex: 1;
}

.page-body { padding: 32px 0 64px; }

/* ── 3. HEADERS (Index & Pages secondaires) ── */
/* Header type 1 (index.html) */
.ap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 48px;
  border-bottom: 1px solid #111;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  gap: 20px;
  background: #fff;
}

/* Header type 2 (events / venues) */
.ap-hdr { border-bottom: 1px solid var(--text); position: sticky; top: 0; background: var(--bg); z-index: 100; }
.ap-hdr-inner { display: flex; justify-content: space-between; align-items: center; height: 60px; }

/* Composants partagés du header */
.ap-header-left { display: flex; align-items: center; gap: 40px; }
.ap-logo { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase; color: #111; text-decoration: none; }
.ap-nav { display: flex; gap: 24px; }
.ap-nav-link { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #666; text-decoration: none; transition: color 0.2s; }
.ap-nav-link:hover, .ap-nav-link.active { color: #111; }

.ap-hdr-right { display: flex; align-items: center; gap: 20px; }
.ap-status { display: flex; align-items: center; gap: 7px; font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; }
.ap-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s ease-in-out infinite; flex-shrink: 0; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.city-trigger { display: flex; align-items: center; gap: 7px; font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; padding: 7px 14px; border: 0.5px solid var(--border); background: none; color: var(--text); }
.city-trigger:hover { background: var(--bg-2); }
.city-trigger svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Bloc d'authentification (index.html) */
.ap-auth-form { display: flex; align-items: center; gap: 8px; }
.ap-auth-input { background: #fff; border: 1px solid #ddd; color: #111; font-family: 'DM Sans', sans-serif; font-size: 11px; padding: 6px 10px; outline: none; border-radius: 0; width: 110px; transition: border-color 0.2s; -webkit-appearance: none; }
.ap-auth-input::placeholder { color: #bbb; }
.ap-auth-input:focus { border-color: #111; }
.ap-auth-btn { background: #111; border: 1px solid #111; color: #fff; font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 12px; cursor: pointer; border-radius: 0; transition: background 0.15s; }
.ap-auth-btn:hover { background: #333; border-color: #333; }

/* ── 4. COMPOSANTS DE L'INDEX (Hero & Scanner) ── */
.ap-scanner { position: absolute; left: 0; right: 0; height: 1px; background: var(--accent); opacity: 0; animation: scan 3s cubic-bezier(0.4,0,0.6,1) 0.3s forwards; z-index: 10; }
@keyframes scan { 0% { top: 0; opacity: 0; } 4% { opacity: 0.7; } 92% { opacity: 0.7; } 100% { top: 100%; opacity: 0; } }

.ap-hero { flex: 1; padding: 72px 48px 100px; position: relative; z-index: 2; min-width: 0; }
.ap-eyebrow { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: #999; margin-bottom: 32px; opacity: 0; animation: fadeIn 0.5s ease 1s forwards; }
.ap-title { font-family: 'Cormorant Garamond', serif; font-size: clamp(56px, 7vw, 100px); font-weight: 300; line-height: 0.9; letter-spacing: -0.02em; color: #111; }
.ap-title-line { display: block; opacity: 0; transform: translateY(36px); }
.ap-title-line:nth-child(1) { animation: slideUp 0.7s cubic-bezier(0.16,1,0.3,1) 1.1s forwards; }
.ap-title-line:nth-child(2) { animation: slideUp 0.7s cubic-bezier(0.16,1,0.3,1) 1.28s forwards; }
.ap-title-line:nth-child(3) { animation: slideUp 0.7s cubic-bezier(0.16,1,0.3,1) 1.46s forwards; }
.ap-title-line em { font-style: italic; color: var(--accent); }
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { to { opacity: 1; } }

.ap-divider { width: 32px; height: 1px; background: var(--accent); margin: 40px 0; opacity: 0; transform: scaleX(0); transform-origin: left; animation: grow 0.4s ease 2s forwards; }
@keyframes grow { to { opacity: 1; transform: scaleX(1); } }
.ap-desc { font-size: 14px; font-weight: 300; line-height: 1.75; color: #666; max-width: 400px; opacity: 0; animation: fadeIn 0.5s ease 2.2s forwards; }

/* Grille latérale index */
.ap-grid { width: 36%; flex-shrink: 0; border-left: 1px solid #111; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); opacity: 0; animation: fadeIn 0.8s ease 1.8s forwards; }
.ap-cell { padding: 22px 18px; border-bottom: 1px solid #e8e8e8; border-right: 1px solid #e8e8e8; overflow: hidden; transition: background 0.2s; }
.ap-cell:nth-child(even) { border-right: none; }
.ap-cell:nth-child(5), .ap-cell:nth-child(6) { border-bottom: none; }
.ap-cell:hover { background: #f5f8fc; }
.ap-cell-tag { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.ap-cell-city { font-family: 'Cormorant Garamond', serif; font-size: 19px; font-weight: 400; color: #111; line-height: 1.1; margin-bottom: 5px; }
.ap-cell-event { font-size: 10.5px; color: #999; line-height: 1.45; margin-bottom: 14px; }
.ap-cell-date { font-family: 'DM Mono', monospace; font-size: 9.5px; color: #bbb; letter-spacing: 0.06em; }

/* Footers */
.ap-footer { padding: 18px 48px; border-top: 1px solid #e8e8e8; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background: #fff; opacity: 0; animation: fadeIn 0.5s ease 2.8s forwards; position: relative; z-index: 2; }
.ap-footer-copy { font-family: 'DM Mono', monospace; font-size: 10px; color: #ccc; letter-spacing: 0.1em; text-transform: uppercase; }
.ap-ftr { border-top: 0.5px solid var(--border-light); }
.ap-ftr-inner { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; }
.ftr-txt { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-4); letter-spacing: .1em; text-transform: uppercase; }
.ftr-live { display: flex; align-items: center; gap: 6px; }

/* ── 5. COMPOSANTS SITES FILLES (Barre Filtres, Cartes, Modals) ── */
.filters-bar { border-bottom: 1px solid var(--border-light); background: var(--bg); }
.filters-inner { display: flex; gap: 10px; align-items: center; padding: 12px 0; flex-wrap: wrap; }
.flabel { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-4); margin-right: 2px; }
.fpill { padding: 5px 13px; border: 0.5px solid var(--border); background: none; font-family: 'DM Sans', sans-serif; font-size: 11px; cursor: pointer; color: var(--text-2); letter-spacing: .03em; transition: all .15s; }
.fpill:hover { border-color: var(--text); color: var(--text); }
.fpill.on { background: var(--text); border-color: var(--text); color: #fff; }
.fsep { width: 0.5px; height: 16px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.dsel-wrap { position: relative; display: inline-flex; align-items: center; }
.dsel-wrap svg { position: absolute; right: 8px; pointer-events: none; color: var(--text-4); }
.dsel { padding: 5px 28px 5px 13px; border: 0.5px solid var(--border); background: var(--bg); font-family: 'DM Sans', sans-serif; font-size: 11px; color: var(--text-2); cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; }

.rmeta { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 24px; }
.rmeta b { color: var(--accent); font-weight: 400; }

/* Grille événements */
.evgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.evcard { display: flex; flex-direction: column; cursor: pointer; border: 0.5px solid var(--border-light); }
.evcard:hover .ev-img img { transform: scale(1.025); }
.ev-img { aspect-ratio: 4/3; overflow: hidden; position: relative; }
.ev-img img { width: 100%; height: 100%; display: block; transition: transform .4s cubic-bezier(.25,.46,.45,.94); }
.ev-tag { position: absolute; top: 10px; left: 10px; font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; background: #111; color: #fff; padding: 3px 8px; }
.ev-live { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 5px; background: #fff; padding: 3px 8px; border: 0.5px solid var(--border-light); }
.ev-live span { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.ev-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.ev-title { font-family: 'Cormorant Garamond', serif; font-size: 19px; font-weight: 400; line-height: 1.15; color: var(--text); margin-bottom: 5px; }
.ev-venue { font-size: 11.5px; color: var(--text-2); line-height: 1.4; }
.ev-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 12px; }
.ev-date { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-4); letter-spacing: .06em; }
.ev-dur { font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-4); letter-spacing: .04em; text-align: right; }
.empty { grid-column: 1/-1; padding: 60px 0; text-align: center; font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-4); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: flex-start; justify-content: center; padding-top: 80px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg); width: 500px; max-width: calc(100vw - 32px); border: 0.5px solid #ccc; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.modal-hdr { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 0.5px solid var(--border-light); flex-shrink: 0; }
.modal-title { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 400; letter-spacing: .06em; }
.modal-close { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-2); line-height: 1; font-size: 18px; }
.modal-close:hover { color: var(--text); }
.modal-search { padding: 14px 22px 10px; flex-shrink: 0; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-4); }
.search-wrap input { width: 100%; padding: 9px 12px 9px 34px; border: 0.5px solid var(--border); background: var(--bg-2); font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--text); outline: none; }
.search-wrap input:focus { border-color: var(--text); }
.search-wrap input::placeholder { color: var(--text-4); }
.modal-list { padding: 0 22px 20px; overflow-y: auto; flex: 1; }
.region-label { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-4); padding: 14px 0 6px; }
.city-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 0.5px solid var(--border-light); cursor: pointer; }
.city-row:last-child { border-bottom: none; }
.city-row:hover .cname { color: var(--accent); }
.cname { font-size: 13px; color: var(--text); transition: color .15s; }
.ccountry { font-size: 11px; color: var(--text-4); margin-left: 4px; }
.cright { display: flex; align-items: center; gap: 12px; }
.ccount { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-4); }
.ccheck { color: var(--text-4); font-size: 14px; opacity: 0; }
.city-row.active .cname { color: var(--accent); font-weight: 500; }
.city-row.active .ccheck { opacity: 1; color: var(--accent); }
.no-results { padding: 20px 0; font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-4); letter-spacing: .1em; text-transform: uppercase; }

/* ── 6. MEDIA QUERIES INDÉPENDANTES ── */
@media (max-width: 820px) {
  .ap-header { flex-direction: column; padding: 20px 24px; gap: 16px; align-items: flex-start; }
  .ap-header-left { width: 100%; justify-content: space-between; gap: 20px; }
  .ap-auth-form { width: 100%; justify-content: flex-start; }
  .ap-auth-input { flex: 1; max-width: 180px; }
}

@media (max-width: 1200px) { .evgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 780px) { .evgrid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (max-width: 480px) { .evgrid { grid-template-columns: 1fr; } }

/* Media Query Mobile Unifiée */
@media (max-width: 700px) {
  /* Index */
  .ap-body { flex-direction: column; }
  .ap-hero { padding: 48px 24px 40px; }
  .ap-grid { width: 100%; border-left: none; border-top: 1px solid #111; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); }
  .ap-cell:nth-child(5) { border-bottom: 1px solid #e8e8e8; }
  .ap-cell:nth-child(6) { border-bottom: none; }
  .ap-footer { padding: 16px 24px; flex-wrap: wrap; gap: 12px; }
  .ap-title { font-size: clamp(48px, 14vw, 72px); }

  /* Pages filles (Events/Venues) */
  :root { --gutter: 20px; }
  .ap-hdr-inner { flex-direction: column; height: auto; padding: 15px 0; gap: 12px; align-items: flex-start; }
  .ap-hdr-right { width: 100%; justify-content: space-between; }
  .city-trigger { margin-left: auto; } /* Aligne le sélecteur à droite */
  .ap-status { display: none; }
  .filters-inner { gap: 6px; }
  .fpill { font-size: 10px; padding: 4px 10px; }
}