/* ===== VARIABLES GLOBALES ===== */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ET BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TYPOGRAPHIE ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--text-primary);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  color: var(--text-primary);
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* ===== LAYOUT PRINCIPAL ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 2vw, 1rem);
  flex: 1;
}

.centered {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2rem);
}

.hp {
  display: none;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo i {
  font-size: 1.75rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-menu a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: clamp(0.875rem, 2vw, 1rem);
}

.nav-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 3px;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: white;
  transition: var(--transition);
}

/* ===== CARTES ET FORMULAIRES ===== */
.card {
  background: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  animation: slideUp 0.6s ease-out;
  width: 100%;
  max-width: 100%;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.form-card {
  max-width: min(450px, 95vw);
  width: 100%;
  margin: 0 auto;
}

/* ===== FIELDSETS ET LÉGENDES ===== */
fieldset {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 2rem);
  margin: 1rem 0;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  transition: var(--transition);
}

fieldset:hover {
  border-color: var(--primary-color);
}

legend {
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--card-background);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: clamp(0.875rem, 2vw, 1rem);
}

/* ===== INPUTS ===== */
.input-group {
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
  position: relative;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: clamp(0.875rem, 2vw, 1rem);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: clamp(0.75rem, 2vw, 1rem);
  color: var(--text-muted);
  z-index: 10;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: clamp(0.75rem, 2vw, 0.875rem) clamp(0.75rem, 2vw, 1rem) clamp(0.75rem, 2vw, 0.875rem) clamp(2.5rem, 5vw, 2.75rem);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: clamp(0.875rem, 2vw, 1rem);
  transition: var(--transition);
  background: white;
  min-height: 48px; /* Minimum touch target pour mobile */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

/* ===== BOUTONS ===== */
.btn {
  padding: clamp(0.75rem, 2vw, 0.875rem) clamp(1.5rem, 4vw, 2rem);
  border: none;
  border-radius: var(--radius-md);
  font-size: clamp(0.875rem, 2vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 120px;
  min-height: 48px; /* Minimum touch target */
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #475569;
  transform: translateY(-2px);
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
}

/* ===== LIENS ===== */
.link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  font-size: clamp(0.875rem, 2vw, 1rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  min-height: 44px; /* Touch target */
}

.link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ===== MESSAGES ===== */
.message, .error-message {
  padding: clamp(0.75rem, 2vw, 1rem);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border-left: 4px solid;
  animation: fadeIn 0.5s ease-out;
  font-size: clamp(0.875rem, 2vw, 1rem);
}

.message-success {
  background: #dcfce7;
  border-color: var(--success-color);
  color: #166534;
}

.message-error, .error-message {
  background: #fef2f2;
  border-color: var(--error-color);
  color: #991b1b;
}

.message-warning {
  background: #fefbeb;
  border-color: var(--warning-color);
  color: #92400e;
}

.info-text {
  color: #666;
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ===== CAPTCHA ===== */
.captcha-container {
  margin: 1.5rem 0;
  padding: clamp(0.75rem, 2vw, 1rem);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #f8fafc;
  text-align: center;
}

.captcha-icons {
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 2vw, 1rem);
  margin-top: 1rem;
  flex-wrap: wrap;
}

.captcha-icon {
  width: clamp(40px, 8vw, 50px);
  height: clamp(40px, 8vw, 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background: white;
  min-width: 44px; /* Touch target */
  min-height: 44px;
}

.captcha-icon:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.captcha-icon.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

/* ===== FOOTER ET FORM FOOTER ===== */
.form-footer {
  margin-top: clamp(1rem, 3vw, 2rem);
  text-align: center;
}

.form-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

#menu {
  text-align: center;
  margin: 20px 0;
}

#menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 20px);
  flex-wrap: wrap;
}

#menu li {
  display: inline;
}

#menu a {
  text-decoration: none;
  color: #2c3e50;
  font-weight: bold;
  transition: color 0.3s ease;
  font-size: clamp(0.875rem, 2vw, 1rem);
  padding: 0.5rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

#menu a:hover {
  color: #e74c3c;
}

footer {
  background-color: rgba(0, 0, 0, 0.2);
  padding: clamp(20px, 4vw, 30px) 0;
  font-family: Arial, sans-serif;
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  color: #2c3e50;
  text-align: center;
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablettes */
@media (max-width: 1024px) {
  .container {
    padding: 0 1rem;
  }
  
  .form-card {
    max-width: 500px;
  }
}

/* Tablettes petites et mobiles larges */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    width: 100%;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    padding: 2rem 0;
    gap: 1rem;
    z-index: 1000;
  }

  .nav-menu.active {
    left: 0;
  }

  .centered {
    min-height: 100vh;
    padding: 1rem;
  }

  .form-card {
    max-width: 100%;
    margin: 0;
  }

  .card {
    margin-bottom: 1rem;
  }

  .input-group {
    margin-bottom: 1.25rem;
  }

  .btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .captcha-icons {
    gap: 0.75rem;
  }

  .form-links {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
}

/* Mobiles */
@media (max-width: 480px) {
  .centered {
    padding: 0.75rem;
    align-items: stretch;
  }

  .form-card {
    max-width: 100%;
    margin: 0;
  }

  .card {
    padding: 1.25rem;
    margin-bottom: 0;
    border-radius: var(--radius-md);
  }

  fieldset {
    padding: 1rem;
    margin: 0.75rem 0;
  }

  .input-group {
    margin-bottom: 1rem;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"] {
    padding: 1rem 0.75rem 1rem 2.5rem;
    font-size: 16px; /* Évite le zoom sur iOS */
    min-height: 50px;
  }

  .btn {
    padding: 1rem;
    font-size: 1rem;
    min-height: 50px;
  }

  .captcha-icons {
    gap: 0.5rem;
    justify-content: space-around;
  }

  .captcha-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .link {
    padding: 0.75rem;
    min-height: 48px;
    justify-content: center;
  }

  /* Amélioration de l'espacement vertical sur mobile */
  .form-footer {
    margin-top: 1.5rem;
  }

  .message, .error-message {
    padding: 1rem;
    font-size: 0.9rem;
  }
}

/* Très petits écrans */
@media (max-width: 320px) {
  .centered {
    padding: 0.5rem;
  }

  .card {
    padding: 1rem;
  }

  .captcha-icons {
    gap: 0.25rem;
  }

  .captcha-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
}

/* Orientation paysage sur mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .centered {
    min-height: auto;
    padding: 1rem;
  }

  .card {
    margin: 0;
  }
}

/* ===== UTILITAIRES ===== */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.hidden {
  display: none;
}

/* ===== STYLES SPÉCIFIQUES AUX PAGES ===== */
.welcome-section {
  text-align: center;
  padding: clamp(2rem, 6vw, 4rem) 0;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: var(--radius-lg);
  margin: 2rem 0;
}

.welcome-section h1 {
  margin-bottom: 1.5rem;
}

.welcome-section p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.logout-message {
  text-align: center;
  padding: clamp(2rem, 5vw, 3rem);
  background: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

.logout-message h2 {
  color: var(--success-color);
  margin-bottom: 1rem;
}

.logout-message p {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: var(--text-secondary);
}