/* === COULEURS ET GRADIENTS MODERNES === */
:root {
  /* Gradient primary */
  --gradient-primary: linear-gradient(135deg, #3498db 0%, #2ecc71 100%);
  --gradient-secondary: linear-gradient(135deg, #9b59b6 0%, #e74c3c 100%);
  --gradient-dark: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.3);
  
  /* Couleurs de texte */
  --text-primary: #2c3e50;
  --bg-primary: #ecf0f1;
  --primary-color: #3498db;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #ecf0f1 100%);
  color: var(--text-primary);
  transition: all 0.3s ease;
  position: relative;
  overflow-x: hidden;
}

/* Animated background effect - optimisé avec will-change */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 50%, rgba(52, 152, 219, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(46, 204, 113, 0.1) 0%, transparent 50%);
  animation: bgShift 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

@keyframes bgShift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-50px, -50px); }
}

/* === SKIP LINK (Accessibilité) === */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

/* === CONNECTION STATUS === */
#connection-status {
  position: fixed !important;
  top: 20px !important;
  left: 20px !important;
  width: max-content !important;
  max-width: fit-content !important;
  padding: 0.6rem 1rem !important;
  border-radius: 20px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.5rem !important;
  z-index: 50 !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  margin: 0 !important;
  white-space: nowrap !important;
  right: auto !important;
  bottom: auto !important;
}

#status-indicator {
  animation: statusPulse 2s ease-in-out infinite;
  display: inline-block;
  font-size: 1.2rem;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === HEADER === */
.header {
  padding: 0;
  text-align: center;
  border-bottom: none;
  display: none;
}

.header h1 {
  margin: 0;
  flex: 1;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.header h1 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === LOGO === */
.logo {
  max-width: 160px;
  height: auto;
  margin: 3rem auto 1rem;
  display: block;
  animation: floatIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === CONTAINER === */
.container {
  flex: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

.title {
  text-align: center;
  margin: 1.5rem 0 2rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* Gradient uniquement sur le texte, pas les emojis */
.title .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === MODES GRID === */
.modes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

/* === MODE CARDS === */
.mode-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  will-change: transform;
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  border-radius: 16px;
}

.mode-card:hover::before {
  opacity: 0.08;
}

.mode-card:hover {
  border-color: rgba(52, 152, 219, 0.5);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(52, 152, 219, 0.25);
}

.mode-card:active {
  transform: translateY(-4px) scale(0.98);
}

.mode-card:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

/* === MODE ICON === */
.mode-icon {
  font-size: 2.5rem;
  min-width: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: iconPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-card:hover .mode-icon {
  transform: scale(1.2) rotate(10deg);
}

@keyframes iconPop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* === MODE INFO === */
.mode-info {
  flex: 1;
  text-align: left;
}

.mode-title {
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.mode-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.mode-card:hover .mode-title {
  color: var(--primary-color);
}

/* === EXTERNAL SECTION === */
.external-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.external-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-align: center;
  opacity: 0.7;
}

/* === SETTINGS BUTTON === */
.settings-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(135deg, var(--primary-color, #3498db) 0%, var(--accent-secondary, #2ecc71) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(52, 152, 219, 0.4), 
              0 4px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  overflow: visible;
  z-index: 100;
}

/* Tooltip au survol */
.settings-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: 1px solid var(--glass-border);
}

/* Afficher le tooltip sur hover pour desktop */
@media (hover: hover) and (pointer: fine) {
  .settings-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
  }
}

/* Afficher le tooltip avec la classe show-tooltip (pour mobile) */
.settings-btn.show-tooltip::after {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

.settings-btn:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 12px 32px rgba(52, 152, 219, 0.5), 
              0 6px 12px rgba(0, 0, 0, 0.15);
}

.settings-btn:active {
  transform: translateY(-1px) scale(0.95);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.settings-btn:focus {
  outline: none;
  box-shadow: 0 8px 24px rgba(52, 152, 219, 0.4), 
              0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* === FOOTER === */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.footer p {
  margin: 0;
}

/* === AUTH MODAL === */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.auth-modal {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-modal h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  text-align: center;
  color: var(--text-primary);
}

.auth-modal h2 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-modal-input {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.auth-modal-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.auth-modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-modal-btn {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.auth-modal-btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.auth-modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.auth-modal-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.auth-modal-btn-secondary:hover {
  background: var(--border-color);
}

.auth-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === IOS INSTALL MODAL === */
.ios-install-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
}

.ios-install-modal {
  background: white;
  border-radius: 24px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-install-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  text-align: center;
  color: var(--text-primary);
}

.ios-install-modal h2 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ios-install-modal p.subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin: 0 0 2rem;
  font-size: 0.95rem;
}

.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.ios-install-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.ios-install-step-number {
  min-width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ios-install-step-content {
  flex: 1;
  padding-top: 0.3rem;
}

.ios-install-step-content strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.ios-install-step-content span {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ios-install-icon {
  font-size: 1.8rem;
  margin: 0 0.25rem;
  vertical-align: middle;
}

.ios-install-note {
  background: rgba(52, 152, 219, 0.1);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.ios-install-note p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.ios-install-close {
  width: 100%;
  padding: 1rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ios-install-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.ios-install-close:active {
  transform: translateY(0);
}

/* === LOADER === */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.loader {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .modes-grid {
    gap: 1rem;
  }

  .title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 1rem 0.75rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .container {
    padding: 1rem;
  }

  .logo {
    max-width: 140px;
    margin: 1.5rem auto 0.5rem;
  }

  .title {
    font-size: 1.3rem;
    margin: 1rem 0 1.5rem;
  }

  .mode-card {
    padding: 1.2rem;
    gap: 0.75rem;
  }

  .mode-icon {
    font-size: 2rem;
    min-width: 2.5rem;
  }

  .mode-title {
    font-size: 1rem;
  }

  .mode-description {
    font-size: 0.85rem;
  }

  .settings-btn {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
    bottom: 20px;
    right: 20px;
  }

  .footer {
    font-size: 0.8rem;
    padding: 1rem;
  }

  .auth-modal {
    padding: 1.5rem;
  }

  .auth-modal h2 {
    font-size: 1.3rem;
  }

  #connection-status {
    top: 10px !important;
    left: 10px !important;
    font-size: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
  }
}

/* === PRINT === */
@media print {
  body::before,
  .settings-btn,
  #connection-status {
    display: none;
  }
}
