/* Reset et base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  touch-action: pan-y;
}

/* Layout principal */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
}

.app-header h1 {
  font-size: 2rem;
  color: #2d3748;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.app-header p {
  font-size: 1rem;
  color: #718096;
  font-weight: 400;
}

/* Main content */
.app-main {
  flex: 1;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Swipeable container */
.swipeable {
  position: relative;
  transition: transform 0.3s ease-out;
  width: 100%;
  height: 100%;
}

.swipe-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1000;
}

.swipe-indicator.active {
  opacity: 0.5;
}

/* Page accueil (Page 1) */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  animation: slideInFromRight 1s ease-out;
}

.welcome-screen img {
  max-width: min(18rem, 70vw);
  margin-bottom: 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.welcome-screen h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-screen p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  line-height: 1.6;
}

/* Page orientation (Page 2) */
.orientation-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, 1fr);
  height: 80vh;
  gap: 1rem;
  position: relative;
}

.orientation-card {
  background: white;
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.orientation-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.orientation-card .icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.orientation-card h2 {
  font-size: 2rem;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.orientation-card p {
  font-size: 1rem;
  color: #718096;
}

.swipe-hint {
  position: absolute;
  bottom: 1rem;
  font-size: 0.8rem;
  color: #a0aec0;
  font-style: italic;
}

/* Menu */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.menu-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.menu-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.menu-card h3 {
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.menu-card p {
  color: #718096;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.menu-features {
  color: #4a5568;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Bouton retour */
.back-button {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.back-button:hover {
  background: #5568d3;
  transform: translateY(-50%) scale(1.05);
}

/* Boutons d'action */
.action-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  text-decoration: none;
  display: inline-block;
  margin: 0.5rem;
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.action-button.secondary {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.action-button.secondary:hover {
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

/* Conteneur graphique */
.chart-container {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-container h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #2d3748;
  font-size: 1.8rem;
  font-weight: 600;
}

/* Placeholder */
.placeholder-chart {
  background: white;
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.placeholder-content h2 {
  color: #4a5568;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.placeholder-content p {
  color: #718096;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.coming-soon {
  margin-top: 2rem;
  text-align: center;
}

.coming-soon h3 {
  color: #4a5568;
  margin-bottom: 1rem;
}

/* Formulaires */
.form-container {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  margin: 2rem auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

/* Contrôles */
.controls {
  text-align: center;
  margin-bottom: 2rem;
}

.stats-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.stats-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Panneaux */
.stats-panel, .pilot-details {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hidden {
  display: none;
}

/* Footer */
.app-footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  margin-top: auto;
}

.app-footer p {
  color: #718096;
  font-size: 0.9rem;
}

/* Animations */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Tablettes et petits écrans (max 1024px) */
@media (max-width: 1024px) {
  .app-main {
    max-width: 100%;
    padding: 1rem;
  }
  
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Smartphones et tablettes portrait (max 768px) */
@media (max-width: 768px) {
  /* Header adaptatif */
  .app-header {
    padding: 1rem;
  }
  
  .app-header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
  }
  
  .app-header p {
    font-size: 0.85rem;
  }
  
  /* Bouton retour plus petit */
  .back-button {
    padding: 6px 12px;
    font-size: 0.75rem;
    left: 0.5rem;
  }
  
  /* Main content */
  .app-main {
    padding: 0.75rem;
  }
  
  /* Menu grid en colonne unique */
  .menu-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
  }
  
  .menu-card {
    padding: 1.5rem;
  }
  
  .menu-icon {
    font-size: 2.5rem;
  }
  
  .menu-card h3 {
    font-size: 1.2rem;
  }
  
  .menu-card p {
    font-size: 0.9rem;
  }
  
  /* Welcome screen */
  .welcome-screen {
    min-height: 70vh;
    padding: 1rem;
  }
  
  .welcome-screen h1 {
    font-size: 2rem;
  }
  
  .welcome-screen p {
    font-size: 1rem;
  }
  
  .welcome-screen img {
    max-width: min(14rem, 70vw);
  }
  
  /* Orientation grid */
  .orientation-grid {
    height: auto;
    min-height: 70vh;
    gap: 0.75rem;
  }
  
  .orientation-card {
    padding: 1.5rem 1rem;
    min-height: 120px;
  }
  
  .orientation-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
  }
  
  .orientation-card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
  }
  
  .orientation-card p {
    font-size: 0.85rem;
  }
  
  /* Formulaires */
  .form-container {
    padding: 1.5rem;
    margin: 1rem auto;
    max-width: 100%;
  }
  
  .form-container h2 {
    font-size: 1.4rem;
  }
  
  .form-group input {
    padding: 10px;
    font-size: 16px; /* Évite le zoom automatique sur iOS */
  }
  
  /* Boutons d'action */
  .action-button {
    padding: 12px 24px;
    font-size: 1rem;
    margin: 0.3rem;
  }
  
  /* Chart container */
  .chart-container {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .chart-container h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }
  
  .placeholder-chart {
    padding: 1.5rem;
    min-height: 300px;
  }
  
  .placeholder-content h2 {
    font-size: 1.4rem;
  }
  
  .placeholder-content p {
    font-size: 0.9rem;
  }
  
  /* Footer */
  .app-footer {
    padding: 1rem;
  }
  
  .app-footer p {
    font-size: 0.8rem;
  }
  
  /* Swipe indicator */
  .swipe-indicator {
    font-size: 3rem;
  }
}

/* Petits smartphones (max 480px) */
@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1.2rem;
  }
  
  .app-header p {
    font-size: 0.8rem;
  }
  
  .app-main {
    padding: 0.5rem;
  }
  
  .welcome-screen h1 {
    font-size: 1.6rem;
  }
  
  .welcome-screen p {
    font-size: 0.9rem;
  }
  
  .orientation-card {
    padding: 1rem;
    min-height: 100px;
  }
  
  .orientation-card .icon {
    font-size: 2rem;
  }
  
  .orientation-card h2 {
    font-size: 1rem;
  }
  
  .orientation-card p {
    font-size: 0.75rem;
  }
  
  .menu-card {
    padding: 1rem;
  }
  
  .menu-icon {
    font-size: 2rem;
  }
  
  .menu-card h3 {
    font-size: 1rem;
  }
  
  .menu-card p {
    font-size: 0.85rem;
  }
  
  .form-container {
    padding: 1rem;
  }
  
  .action-button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .back-button {
    padding: 5px 10px;
    font-size: 0.7rem;
  }
}

/* Très petits smartphones (max 360px) */
@media (max-width: 360px) {
  .app-header {
    padding: 0.75rem;
  }
  
  .app-header h1 {
    font-size: 1.1rem;
  }
  
  .orientation-card .icon {
    font-size: 1.8rem;
  }
  
  .orientation-card h2 {
    font-size: 0.95rem;
  }
  
  .form-container {
    padding: 0.75rem;
  }
}

/* ========================================
   ORIENTATION - PAYSAGE (Landscape)
   ======================================== */

/* Paysage sur mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .app-header h1 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
  }
  
  .app-header p {
    font-size: 0.75rem;
  }
  
  .app-main {
    padding: 0.5rem;
  }
  
  .welcome-screen {
    min-height: 50vh;
    flex-direction: row;
    gap: 2rem;
  }
  
  .welcome-screen h1 {
    font-size: 1.5rem;
  }
  
  .welcome-screen p {
    font-size: 0.9rem;
  }
  
  .welcome-screen img {
    max-width: min(12rem, 60vw);
  }
  
  /* Orientation grid en mode paysage */
  .orientation-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    height: auto;
    min-height: 60vh;
    gap: 0.5rem;
  }
  
  .orientation-card {
    padding: 1rem;
    min-height: auto;
  }
  
  .orientation-card .icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
  }
  
  .orientation-card h2 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }
  
  .orientation-card p {
    font-size: 0.7rem;
  }
  
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .menu-card {
    padding: 1rem;
  }
  
  .menu-icon {
    font-size: 2rem;
  }
  
  .form-container {
    max-width: 600px;
    padding: 1rem 1.5rem;
  }
  
  .app-footer {
    padding: 0.75rem;
  }
  
  .app-footer p {
    font-size: 0.75rem;
  }
}

/* Paysage sur tablette */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .orientation-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    height: 70vh;
  }
  
  .menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   TOUCHES ET INTERACTIONS MOBILES
   ======================================== */

/* Zones tactiles minimum 44x44px (Apple HIG) */
@media (max-width: 768px) {
  button, a, .orientation-card, .menu-card, .action-button, .back-button {
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  /* Désactiver le hover sur tactile */
  .orientation-card:hover,
  .menu-card:hover,
  .action-button:hover,
  .back-button:hover {
    transform: none;
  }
  
  /* Effet au toucher */
  .orientation-card:active,
  .menu-card:active {
    opacity: 0.8;
    transform: scale(0.98);
  }
  
  .action-button:active,
  .back-button:active {
    opacity: 0.9;
    transform: scale(0.95);
  }
}

/* ========================================
   SAFE AREA (iPhone X et +)
   ======================================== */

@supports (padding: max(0px)) {
  .app-header {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-top: max(1.5rem, env(safe-area-inset-top));
  }
  
  .app-footer {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  
  .app-main {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

