/* ========== VARIABLES GLOBALES ========== */
:root {
  --color-bg: #fefefe;
  --color-text: #333;
  --color-primary: #ff7eb9;
  --color-primary-hover: #f74394;
  --color-nav: #353535;
  --color-tile-bg: #fff;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-border: #ffb9d2;
}

/* ========== RESET ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  padding-top: 60px;
}

body {
  transition: opacity 0.4s ease, transform 0.4s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

body.animating-in {
    opacity: 0;
  transform: translateY(20px);
  overflow-y: hidden;
}

body:not(.animating-in) {
  overflow-y: auto;
}
/* ========== NAVIGATION ========== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--color-nav);
  color: #fff;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}
nav .logo {
  font-weight: bold;
  font-size: 1.2rem;
}
nav ul {
  display: flex;
  list-style: none;
  gap: 1rem;
}
nav ul li a {
  color: #fff;
  text-decoration: none;
}
nav .menu-toggle {
  display: none;
}
@media (max-width: 768px) {
  nav ul {
    display: none;
    flex-direction: column;
    background: #333;
    position: absolute;
    top: 60px;
    right: 0;
    padding: 1rem;
    width: 200px;
  }
  nav ul.active {
    display: flex;
  }
  nav .menu-toggle {
    display: block;
    cursor: pointer;
  }
}

/* ========== SECTIONS PAR TYPE ========== */
section {
  padding: 2rem;
  margin: 1rem 0;
  border-radius: 12px;
}
section.profile { background-color: #f0f9ff; }
section.auth { background-color: #e9f5ff; }
section.events { background-color: #fff7f0; }
section.cars { background-color: #f0fff7; }
section.teams { background-color: #fff0f8; }

/* ========== BOUTONS ========== */
button, .btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background-color: var(--color-primary);
  color: white;
  font-weight: bold;
  transition: background 0.3s ease, transform 0.2s;
}
button:hover, .btn:hover {
  background-color: var(--color-primary-hover);
  transform: scale(1.03);
}
.btn-emoji:where(a) {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background-color: var(--color-primary);
  color: white;
  border-radius: 0.8rem;
  font-weight: bold;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s ease;
}
.btn-emoji:hover {
  background-color: var(--color-primary-hover);
}

/* ==== Boutons avec effet d'ombre et élévation ==== */
button, .btn, .btn-emoji {
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
button:hover, .btn:hover, .btn-emoji:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

li {
  list-style: none;
}

/* ========== Switch ========== */

.switch-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.8rem 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-primary, #ff7eb9);
}

input:checked + .slider::before {
  transform: translateX(22px);
}
/* ========== TUILES ========== */
.tile {
  cursor: pointer;
  background: var(--color-tile-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px var(--color-shadow);
}
.tile-header {
  position: relative;
  background-size: cover;
  background-position: center;
  height: 160px;
  color: white;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  font-weight: bold;
}
.tile-content {
  padding: 1rem;
}
.tile-footer {
  display: flex;
  justify-content: space-around;
  background: #eee;
  padding: 0.5rem;
}
.tile.past {
  filter: grayscale(100%) brightness(0.8);
  opacity: 0.7;
}

/* ========== FORMULAIRES ========== */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
label {
  font-weight: bold;
}
input, textarea {
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 100%;
  font-size: 1rem;
}
input:focus, textarea:focus {
  outline: 2px solid var(--color-primary);
}

/* ========== MODALE CENTRALE ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.modal-box {
  background: white;
  padding: 1.5rem 2rem;
  border-radius: 10px;
  max-width: 90%;
  width: 400px;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  animation: fadeInScale 0.3s ease-in-out;
  text-align: center;
  font-size: 1rem;
}
.modal-box.success { border-left: 6px solid #2e7d32; }
.modal-box.error   { border-left: 6px solid #c62828; }
#modal-text { padding: 0.5rem 0; }
.hidden { display: none; }
@keyframes fadeInScale {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== CONTAINERS ========== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

/* === Entrée douce de la page === */
.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}
@keyframes fadeInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* === displaysuer() === */
.user-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.user-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ccc;
}

.user-name {
  display: inline-block;
}

.user-name small {
  font-size: 0.75rem;
  color: #888;
  margin-left: 0.3rem;
}



/* === Sortie fluide de la page === */
.fade-out-down {
  animation: fadeOutDown 0.4s ease-in forwards;
}
@keyframes fadeOutDown {
  to {
    transform: translateY(40px);
    opacity: 0;
  }
}

/* === Modale zoom + fade === */
@keyframes fadeInScale {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* === Shake en cas d’erreur === */
.shake {
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* ==== Fond animé léger ==== */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(-45deg, #ffdde1, #ee9ca7, #a1c4fd, #c2e9fb);
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
  z-index: -1;
  opacity: 0.2;
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}