/* ==============================================================================
   Escape Game A&L - Modern Web UI Stylesheet (Mobile-First & No Overflow)
   ============================================================================== */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-light: rgba(245, 158, 11, 0.15);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  
  --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  overflow-x: hidden;
}

/* En-tête */
.app-header {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  width: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 1.8rem;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Zone Principale d'affichage */
.app-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* Cartes et conteneurs standards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Boutons Réutilisables */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-clear {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Bouton Retour Principal */
.btn-back {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Titres de Section */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: #ffffff;
}

.section-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

/* Grille des Tables */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
  width: 100%;
}

.table-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  cursor: pointer;
  width: 100%;
}

.table-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}

.table-card.solved {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--success-bg);
}

.table-card.locked {
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--danger-bg);
}

.table-year {
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 20px;
  white-space: nowrap;
}

.status-badge.to-find {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.status-badge.solved {
  background: #10b981;
  color: #ffffff;
}

.status-badge.locked {
  background: #ef4444;
  color: #ffffff;
  animation: pulse-lock 1.5s infinite;
}

@keyframes pulse-lock {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Saisie Manuelle de l'année */
.manual-input-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
  width: 100%;
}

.input-field {
  width: 100%;
  flex: 1 1 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  text-transform: uppercase;
}

.input-field:focus {
  border-color: var(--primary);
}

.manual-input-box .btn {
  flex: 1;
}

/* Actions Formulaire */
.form-actions-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.75rem;
}

.form-actions-row .btn {
  flex: 1;
}

/* Saisie du Code */
.code-entry-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding: 0.25rem 0;
  width: 100%;
}

.code-slots-display {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.4rem 0;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
}

.slot-box {
  flex: 1;
  max-width: 44px;
  height: 50px;
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.95rem, 3.8vw, 1.4rem);
  font-weight: 800;
  color: var(--primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2) inset;
  min-width: 0;
}

.slot-box.filled {
  border-color: var(--primary);
  background: var(--primary-light);
}

.code-hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Banner Erreur / Message */
.alert-banner {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

.alert-banner.danger {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-banner.success {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Écran /martin-lost (Farce Martin) */
.prank-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
  width: 100%;
}

.prank-image {
  width: 100%;
  max-width: 340px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 2px solid var(--border-color);
  object-fit: cover;
}

.prank-text {
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  font-weight: 800;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  width: 100%;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

/* Écran 3 : Victoire / Félicitations */
.victory-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.victory-icon {
  font-size: 3rem;
  animation: heart-bounce 1.2s infinite ease-in-out alternate;
}

@keyframes heart-bounce {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.password-box {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-lg);
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
  margin: 0.4rem 0;
  word-break: break-all;
  max-width: 100%;
}

/* Menu Administrateur */
.admin-menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
  width: 100%;
}

.admin-btn {
  text-align: left;
  justify-content: flex-start;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #ffffff;
  width: 100%;
  font-size: 0.85rem;
}

.app-footer {
  margin-top: auto;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
