/* ============================================================
   main.css — Styles globaux Waylyn
   Variables, reset, typographie, composants réutilisables
   ============================================================ */

/* ---- Palette & variables ---- */
:root {
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary:     #7C3AED;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;

  --bg:            #F8FAFC;
  --bg-card:       #FFFFFF;
  --bg-muted:      #F1F5F9;
  --border:        #E2E8F0;
  --border-strong: #CBD5E1;

  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.16);

  --radius-sm:   6px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-full: 9999px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --trans: 150ms ease;
  --nav-h: 60px;
  --panel-w: 340px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; min-height: 100vh; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--primary-dark); }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
svg { fill: currentColor; }

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; border: 2px solid transparent;
  transition: all var(--trans); white-space: nowrap; cursor: pointer;
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover  { background: var(--bg-muted); }
.btn-danger   { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm  { padding: 6px 12px; font-size: .8rem; }
.btn-xs  { padding: 4px 10px; font-size: .75rem; }
.btn-lg  { padding: 12px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Formulaires ---- */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.form-label { font-weight: 600; font-size: .85rem; color: var(--text); }
.form-input {
  padding: 10px 14px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  color: var(--text); transition: border-color var(--trans), box-shadow var(--trans); width: 100%;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-input.is-invalid { border-color: var(--danger); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: .78rem; }
.form-hint  { color: var(--text-muted); font-size: .78rem; }
.form-row   { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.required   { color: var(--danger); }
.form-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.form-section-title { font-size: 1rem; font-weight: 700; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.form-submit-bar { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.input-password-wrapper { position: relative; }
.input-password-wrapper .form-input { padding-right: 46px; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 1rem; opacity: .55; padding: 4px; }
.toggle-password:hover { opacity: 1; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; }

/* ---- Alertes ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .875rem; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

/* ---- Cartes événements ---- */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.events-grid--small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.event-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.event-card-img  { position: relative; height: 170px; overflow: hidden; background: var(--bg-muted); }
.event-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.event-card:hover .event-card-img img { transform: scale(1.04); }
.event-placeholder-img { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; }
.event-category-badge { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: var(--radius-full); font-size: .72rem; font-weight: 700; color: #fff; letter-spacing: .02em; }
.event-card-body { padding: 14px 16px; }
.event-title { font-size: .95rem; font-weight: 700; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.event-date, .event-location { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
.event-price { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: var(--radius-full); font-size: .72rem; font-weight: 700; }
.event-price.free { background: #DCFCE7; color: #166534; }
.event-price.paid { background: #FEE2E2; color: #991B1B; }
.event-price.donation { background: #FEF3C7; color: #92400E; }

/* ---- Badge statut ---- */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-full); font-size: .72rem; font-weight: 700; }
.status-pending  { background: #FEF3C7; color: #92400E; }
.status-approved { background: #DCFCE7; color: #166534; }
.status-rejected { background: #FEE2E2; color: #991B1B; }
.status-expired  { background: var(--bg-muted); color: var(--text-muted); }
.status-draft    { background: #EDE9FE; color: #6D28D9; }

/* ---- Auth pages ---- */
.page-auth { display: flex; flex-direction: column; min-height: 100vh; background: linear-gradient(135deg, #EFF6FF 0%, #EDE9FE 100%); }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); padding: 40px 36px; width: 100%; max-width: 420px; }
.auth-card--wide { max-width: 540px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 24px; }
.auth-alt  { text-align: center; margin-top: 18px; font-size: .875rem; color: var(--text-muted); }
.captcha-box { background: var(--bg-muted); border-radius: var(--radius-sm); padding: 16px; border: 1px solid var(--border); }
.captcha-image { max-width: 100%; border-radius: var(--radius-sm); margin-bottom: 10px; }
.captcha-question { font-size: 1.3rem; font-weight: 800; text-align: center; padding: 16px; color: var(--primary); }

/* ---- Toast notification ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 3000;
  background: #1E293B; color: #fff; padding: 12px 20px;
  border-radius: var(--radius-sm); font-size: .875rem;
  box-shadow: var(--shadow-xl); animation: slideUp .2s ease;
  max-width: 340px;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--primary); }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(2px); }
.modal-box { background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px 32px; width: 100%; max-width: 520px; position: relative; box-shadow: var(--shadow-xl); max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--bg-muted); border: none; border-radius: 50%; width: 30px; height: 30px; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; line-height: 1; transition: background var(--trans); }
.modal-close:hover { background: var(--border-strong); }

/* ---- Page événement (show) ---- */
.event-show-page { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }
.breadcrumb { font-size: .78rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.event-category-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: var(--radius-full); color: #fff; font-size: .8rem; font-weight: 700; margin-bottom: 10px; }
.event-show-title { font-size: 1.9rem; font-weight: 900; line-height: 1.25; margin-bottom: 14px; }
.event-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.event-meta-item { font-size: .85rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.event-price-badge { padding: 4px 12px; border-radius: var(--radius-full); font-size: .8rem; font-weight: 700; }
.event-price-badge.free { background: #DCFCE7; color: #166534; }
.event-price-badge.paid { background: #FEE2E2; color: #991B1B; }
.event-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.event-show-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; }
.gallery-main { width: 100%; height: 380px; object-fit: cover; border-radius: var(--radius); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery-thumb { width: 76px; height: 58px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; opacity: .7; flex-shrink: 0; transition: opacity var(--trans); }
.gallery-thumb:hover { opacity: 1; }
.event-description { margin-top: 20px; }
.event-description h2 { font-size: 1.1rem; margin-bottom: 10px; }
.description-content { line-height: 1.85; color: var(--text); }
.event-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tag-chip { padding: 4px 12px; background: var(--bg-muted); border-radius: var(--radius-full); font-size: .78rem; color: var(--primary); border: 1px solid var(--border); transition: all var(--trans); }
.tag-chip:hover { background: var(--primary-light); }
.event-info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.event-info-card h2 { font-size: 1rem; margin-bottom: 14px; }
.info-list dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 10px; }
.info-list dd { font-weight: 600; font-size: .9rem; margin-top: 2px; }
.is-favorite { color: var(--danger); }
.mini-map { border: 1px solid var(--border); border-radius: var(--radius); }
.similar-events { margin-top: 44px; }
.similar-events h2 { font-size: 1.2rem; margin-bottom: 14px; }

/* ---- Création événement ---- */
.create-event-page { max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; }
.create-container > h1 { font-size: 1.8rem; font-weight: 900; margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); margin-bottom: 28px; }
.image-preview-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview-thumb { position: relative; }
.preview-thumb img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.preview-thumb--main img { border: 3px solid var(--primary); }
.tags-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-checkbox input { display: none; }
.tag-checkbox input:checked + .tag-chip { background: var(--primary); color: #fff; border-color: var(--primary); }
.char-counter { text-align: right; }
.form-input-file { padding: 8px; border: 2px dashed var(--border); background: var(--bg-muted); cursor: pointer; }
.form-input-file:hover { border-color: var(--primary); }

/* ---- Page user ---- */
.user-page { max-width: 900px; margin: 0 auto; padding: 32px 20px 60px; }
.user-page > h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 20px; }

/* ---- Section stats accueil ---- */
.stats-section { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); padding: 36px 20px; }
.stats-grid { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; max-width: 700px; margin: 0 auto; }
.stat-card { text-align: center; color: #fff; }
.stat-num { display: block; font-size: 2.2rem; font-weight: 900; line-height: 1.1; }
.stat-label { font-size: .82rem; opacity: .8; margin-top: 4px; }
.featured-section { padding: 52px 20px; }
.section-container { max-width: 1200px; margin: 0 auto; }
.section-container h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 22px; }

/* ---- Pages erreur ---- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--nav-h)); padding: 40px 20px; }
.error-container { text-align: center; max-width: 480px; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--primary); line-height: 1; }
.error-map-pin { font-size: 2.8rem; margin: 12px 0; }
.error-container h1 { font-size: 1.6rem; margin-bottom: 10px; }
.error-container p { color: var(--text-muted); margin-bottom: 24px; }
.error-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ---- Cookie banner ---- */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #1E293B; color: #E2E8F0; z-index: 999; padding: 14px 24px; box-shadow: 0 -4px 20px rgba(0,0,0,.2); }
.cookie-content { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cookie-content p { flex: 1; font-size: .85rem; min-width: 200px; }
.cookie-content a { color: #93C5FD; }
.cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- Footer ---- */
.footer { background: #0F172A; color: #94A3B8; padding: 48px 24px 28px; margin-top: 60px; }
.footer-container { max-width: 1200px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
.footer-brand p { font-size: .85rem; opacity: .7; margin-top: 10px; line-height: 1.6; }
.footer-links h3 { color: #E2E8F0; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }
.footer-links ul li { margin-bottom: 8px; }
.footer-links a { color: #64748B; font-size: .85rem; transition: color var(--trans); }
.footer-links a:hover { color: #E2E8F0; }
.footer-bottom { border-top: 1px solid #1E293B; padding-top: 20px; font-size: .78rem; opacity: .5; }

/* ---- Spinner ---- */
.loading-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; color: var(--text-muted); gap: 12px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Leaflet marker customs ---- */
.waylyn-marker {
  width: 34px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.5);
  transition: transform .15s ease;
}
.waylyn-marker:hover { transform: rotate(-45deg) scale(1.15); }
.waylyn-marker .marker-emoji { transform: rotate(45deg); font-size: .95rem; line-height: 1; }

/* ---- Popup Leaflet ---- */
.leaflet-popup-content-wrapper { border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; border: none !important; padding: 0 !important; }
.leaflet-popup-content { margin: 0 !important; }
.custom-popup { padding: 14px 16px; min-width: 200px; max-width: 260px; }
.custom-popup h3 { font-size: .9rem; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.custom-popup p { font-size: .78rem; color: var(--text-muted); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.custom-popup .popup-link { display: inline-block; margin-top: 10px; padding: 7px 14px; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700; transition: background var(--trans); }
.custom-popup .popup-link:hover { background: var(--primary-dark); color: #fff; }

/* ---- Responsive global ---- */
@media (max-width: 768px) {
  .event-show-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .form-row { flex-direction: column; gap: 0; }
  .stats-grid { gap: 24px; }
  .auth-card { padding: 28px 20px; }
  .gallery-main { height: 230px; }
  .event-show-title { font-size: 1.4rem; }
  .modal-box { padding: 24px 20px; }
}
@media (max-width: 480px) {
  .events-grid { grid-template-columns: 1fr; }
  .error-code { font-size: 4.5rem; }
  .btn-full-mobile { width: 100%; justify-content: center; }
}
