/*
Theme Name: Artisan RDV
Description: Thème WordPress pour la prise de rendez-vous d'un artisan. Calendrier de disponibilités + formulaire sécurisé connecté à n8n.
Version: 1.0.0
Author: QualiSec - Onja
Text Domain: artisan-rdv
*/

/* ============================================
   VARIABLES
   ============================================ */
:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #ebf5ff;
  --accent: #e3a008;
  --green: #057a55;
  --red: #c81e1e;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--white);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--gray-900);
  font-weight: 700;
}

/* ============================================
   SKIP LINKS (RGAA 12.8)
   ============================================ */
.skip-links {
  position: absolute;
  top: 0; left: 0;
  z-index: 9999;
}
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--primary);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 8px;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   SR-ONLY (WCAG)
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  background: var(--gray-900);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  gap: 1rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
  flex-shrink: 0;
}
.site-logo .logo-icon {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.site-logo .logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
}
.site-logo .logo-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--gray-400);
}

.site-nav { display: flex; gap: 0.25rem; align-items: center; }
.site-nav a {
  color: var(--gray-300);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover, .site-nav a:focus {
  background: rgba(255,255,255,0.1);
  color: white;
  outline: none;
}
.site-nav a:focus-visible { outline: 2px solid var(--accent); }

.btn-header-rdv {
  background: var(--primary) !important;
  color: white !important;
  padding: 0.55rem 1.1rem !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
}
.btn-header-rdv:hover { background: var(--primary-dark) !important; }

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--gray-900) 0%, #1e3a5f 100%);
  color: white;
  padding: 5rem 1.25rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: white;
  margin-bottom: 1rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p {
  font-size: 1.15rem;
  color: var(--gray-300);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: all 0.2s;
  line-height: 1;
}
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.4);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); border-color: white; text-decoration: none; color: white; }

.btn-large { padding: 0.9rem 2rem; font-size: 1.05rem; }

.btn-green {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.btn-green:hover { background: #046c4e; color: white; text-decoration: none; }

/* ============================================
   SECTIONS COMMUNES
   ============================================ */
section { padding: 4rem 1.25rem; }
.section-alt { background: var(--gray-50); }

.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.5rem; }
.section-header p { color: var(--gray-500); font-size: 1.05rem; }

/* ============================================
   SERVICES GRID
   ============================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.service-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.service-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.service-card .icon {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  display: block;
}
.service-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.service-card p { font-size: 0.9rem; color: var(--gray-500); }

/* ============================================
   ABOUT SECTION
   ============================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 700px) { .about-grid { grid-template-columns: 1fr; } }
.about-text h2 { font-size: 1.8rem; margin-bottom: 1rem; }
.about-text p { color: var(--gray-600); margin-bottom: 1rem; }
.about-text ul { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.about-text ul li {
  display: flex; align-items: flex-start; gap: 0.7rem;
  font-size: 0.95rem; color: var(--gray-700);
}
.about-text ul li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.about-card {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.about-stat { text-align: center; }
.about-stat .num { font-size: 2rem; font-weight: 800; display: block; }
.about-stat .lbl { font-size: 0.8rem; opacity: 0.8; }

/* ============================================
   CTA BANNER
   ============================================ */
.cta-banner {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 3.5rem 1.25rem;
}
.cta-banner h2 { color: white; font-size: 1.8rem; margin-bottom: 0.75rem; }
.cta-banner p { color: rgba(255,255,255,0.8); margin-bottom: 1.75rem; }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 2rem 1.25rem;
  font-size: 0.875rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-inner a { color: var(--gray-400); }
.footer-inner a:hover { color: white; }

/* ============================================
   PAGE: PRISE DE RDV
   ============================================ */

/* Hero RDV */
.rdv-hero {
  background: var(--primary);
  color: white;
  padding: 3rem 1.25rem;
  text-align: center;
}
.rdv-hero h1 { color: white; font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 0.5rem; }
.rdv-hero p { color: rgba(255,255,255,0.85); max-width: 540px; margin: 0 auto; }

/* Stepper */
.rdv-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 1.25rem;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.rdv-step-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-400);
}
.rdv-step-indicator.active { color: var(--primary); }
.rdv-step-indicator.done { color: var(--green); }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.rdv-step-indicator.active .step-num { background: var(--primary); color: white; border-color: var(--primary); }
.rdv-step-indicator.done .step-num { background: var(--green); color: white; border-color: var(--green); }
.step-sep {
  width: 40px; height: 2px;
  background: var(--gray-200);
  margin: 0 0.5rem;
}

/* RDV Main layout */
.rdv-page { background: var(--gray-50); min-height: 60vh; }
.rdv-main { max-width: 800px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }

/* Steps */
.rdv-panel { display: none; }
.rdv-panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.rdv-panel h2 {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
  color: var(--gray-900);
}
.rdv-panel .panel-sub {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* Calendar grid */
.calendar-loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}
.calendar-loading .spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.calendar-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.slot-card {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}
.slot-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.slot-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.slot-card[aria-checked="true"] {
  border-color: var(--primary);
  background: var(--primary-light);
}
.slot-card .slot-date {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 0.35rem;
}
.slot-card .slot-time {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}
.slot-card[aria-checked="true"] .slot-time { color: var(--primary); }

.no-slots {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

/* Recap créneau sélectionné */
.slot-recap {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.slot-recap-info { font-size: 0.95rem; color: var(--primary-dark); font-weight: 600; }
.slot-recap-info span { font-weight: 400; color: var(--gray-700); }
.slot-recap button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem;
  text-decoration: underline;
}

/* RDV Form */
.rdv-form { background: white; border-radius: var(--radius-lg); padding: 1.75rem; border: 1px solid var(--gray-200); }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}
.form-group label .required {
  color: var(--red);
  margin-left: 3px;
  font-weight: 700;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"] {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  color: var(--gray-900);
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.form-group input[aria-invalid="true"] {
  border-color: var(--red);
}
.form-group input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(200,30,30,0.12);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
}
.field-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 0.3rem;
  display: block;
  min-height: 1em;
}

/* Honeypot */
.honeypot {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Consentement */
.consent-block {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.consent-block label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--gray-700);
  font-weight: 500;
}
.consent-block input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary);
}
.consent-block input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.consent-block a { color: var(--primary); }

/* Form actions */
.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.btn-back {
  background: white;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-back:hover { border-color: var(--gray-500); background: var(--gray-50); }
.btn-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.btn-submit {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.7rem 1.75rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex; align-items: center; gap: 0.5rem;
}
.btn-submit:hover { background: var(--primary-dark); }
.btn-submit:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-submit .spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Form status message */
.form-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  display: none;
}
.form-status.error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; display: block; }
.form-status.success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; display: block; }

/* Panel: Success */
.rdv-success {
  text-align: center;
  background: white;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  border: 1px solid var(--gray-200);
}
.rdv-success .success-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.rdv-success h2 { font-size: 1.6rem; color: var(--green); margin-bottom: 0.5rem; }
.rdv-success p { color: var(--gray-500); margin-bottom: 1.5rem; max-width: 440px; margin-left: auto; margin-right: auto; }
.success-details {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem auto;
  max-width: 360px;
  text-align: left;
}
.success-details dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-top: 0.75rem;
}
.success-details dt:first-child { margin-top: 0; }
.success-details dd { font-weight: 600; color: var(--gray-800); }

/* Step navigation bottom */
.step-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Global message */
.rdv-message {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.rdv-message.error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.rdv-message.info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .site-nav { display: none; }
  .hero { padding: 3rem 1.25rem; }
  .hero h1 { font-size: 1.8rem; }
  .rdv-form { padding: 1.25rem; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn-submit, .form-actions .btn-back { width: 100%; justify-content: center; }
  .rdv-stepper { gap: 0; }
  .step-sep { width: 20px; }
}
