/* ============================================================
   AutoDataServices - CSS Unifié & Responsive
   ============================================================ */

:root {
  --primary: #007bff;
  --dark: #111;
  --bg: #f4f7f9;
  --card-bg: #15191d;
  --border: #2d3439;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

html {
  line-height: 1.6;
  color: #111;
}

body {
  line-height: 1.6;
  color: #111;
  /* NE PAS mettre overflow-x:hidden ici : ça casse position:fixed sur Safari mobile */
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
  padding: 0 15px;
}

/* HEADER */
header {
  background: #000;
  padding: 15px 0;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 2000;
  border-bottom: 1px solid #222;
  /* position:sticky crée déjà un contexte de positionnement */
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.3s;
}

.nav-links a:hover { color: var(--primary); }

.nav-links .btn-connexion {
  background: var(--primary);
  color: white !important;
  padding: 9px 20px !important;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  border: 2px solid var(--primary);
  transition: 0.3s;
}

.nav-links .btn-connexion:hover {
  background: transparent;
  color: var(--primary) !important;
}

.nav-links a[href="base-ori.php"] { color: #ffc107 !important; font-weight: bold; }

/* BURGER */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 5px;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  display: block;
  transition: 0.3s;
}

/* HERO */
.hero {
  height: 100vh;
  background: url('images/hero.jpg') center/cover no-repeat;
  position: relative;
}

.hero-overlay {
  background: rgba(0,0,0,0.65);
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
  padding: 20px;
}

.hero-content h2 { font-size: 2.8rem; margin-bottom: 20px; line-height: 1.2; }
.hero-content p { font-size: 1.1rem; margin-bottom: 30px; opacity: 0.85; }

/* BOUTONS */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid #fff;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.3s;
}
.btn:hover { background: #fff; color: #000; }

/* SECTIONS */
.section { padding: 80px 0; }
.section.dark { background: #000; color: #fff; }
.section.light { background: #fff; color: #000; }
.section h2 { text-align: center; margin-bottom: 40px; text-transform: uppercase; font-weight: 700; }

/* GRID / CARDS */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 40px;
}

.card {
  background: #111;
  border: 1px solid #222;
  padding: 25px;
  border-radius: 15px;
  transition: 0.3s;
  color: #fff;
}

.section.light .card { background: #f9f9f9; border-color: #eee; color: #000; }
.section.light .card h3 { color: #000; }
.section.light .card p { color: #444; }
.section.dark .card { color: #fff; }
.section.dark .card h3 { color: #fff; }
.section.dark .card p { color: #ccc; }
.section.dark .card strong { color: #fff; }
.card:hover { transform: translateY(-5px); border-color: var(--primary); }

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 15px;
  display: block;
  background: #222;
}

.card img[src="images/"], .card img:not([src]), .card img[src=""] {
  display: none;
}

.price-tag { color: var(--primary); font-weight: 700; font-size: 1.3rem; margin: 10px 0; display: block; }

.select-service {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0,123,255,0.1);
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  border: 1px solid transparent;
  transition: 0.2s;
}
.select-service:hover { background: rgba(0,123,255,0.2); }

/* CONTACT FORM */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-form input,
.contact-form textarea {
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #111;
  color: #fff;
  font-size: 16px;
}

/* TOTAL BAR */
#total-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 12px 30px;
  border-radius: 50px;
  display: none;
  z-index: 9999;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  white-space: nowrap;
  /* Sécurité iPhone notch/home bar */
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
}

#total-bar button {
  background: white;
  color: var(--primary);
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95rem;
}

/* FOOTER */
footer { padding: 40px 20px; text-align: center; background: #000; color: #fff; border-top: 1px solid #222; }
footer a { color: #fff; text-decoration: none; }
footer a:hover { color: var(--primary); }

/* SIDEBAR (admin/compte) */
.sidebar {
  width: 230px;
  background: var(--card-bg);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  padding: 20px;
  border-right: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
}

.main {
  margin-left: 250px;
  padding: 30px;
  width: calc(100% - 250px);
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */

@media (max-width: 992px) {
  .menu-toggle { display: flex; }

  header { position: sticky; }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #000;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 70px 0 20px; /* 70px pour passer sous le header */
    border-bottom: 2px solid #222;
    z-index: 1500;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    max-height: 100vh;
    overflow-y: auto;
  }

  .nav-links.active { display: flex; }

  .nav-links li { width: 100%; text-align: center; }
  .nav-links a { display: block; padding: 14px 20px; font-size: 1rem; }
  .nav-links .btn-connexion { margin: 10px auto; display: inline-block; width: auto; }

  /* Hero */
  .hero { height: auto; min-height: 60vh; }
  .hero-content h2 { font-size: 1.7rem; }

  /* Grid */
  .grid { grid-template-columns: 1fr 1fr; gap: 15px; }

  /* Sidebar admin responsive */
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
  }

  .main { margin-left: 0; width: 100%; padding: 15px; }
}

@media (max-width: 600px) {
  .hero-content h2 { font-size: 1.2rem; }
  .hero-content p { font-size: 0.85rem; }

  .section { padding: 50px 0; }
  .section h2 { font-size: 1.3rem; }

  .grid { grid-template-columns: 1fr; }

  .card { padding: 18px; }

  #total-bar {
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    left: 10px;
    right: 10px;
    transform: none;
    border-radius: 14px;
    padding: 14px 16px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 8px;
    white-space: normal;
    width: auto;
  }

  #total-bar button { width: 100%; padding: 12px; font-size: 1rem; font-weight: 700; }

  .contact-form { padding: 0 5px; }

  .logo { font-size: 1.1rem; }
}
