/* ============================================================
   DESIGN SYSTEM - GALERIE PRIVÉE DE SÉLECTION PHOTOS
   ============================================================ */

:root {
  --bg-main: #0b0f19;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-hover: rgba(28, 36, 56, 0.85);
  --bg-card: #131b2e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.6);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-glow);
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.1) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ============================================================
   TYPOGRAPHY & UTILITIES
   ============================================================ */

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

p {
  color: var(--text-muted);
  line-height: 1.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge.demo {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}

/* ============================================================
   HEADER & NAVBAR
   ============================================================ */

.app-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(11, 15, 25, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
}

.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-info h1 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.brand-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-main);
}

.user-tag .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
}

/* ============================================================
   MAIN CONTAINER & STEPS
   ============================================================ */

.main-content {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
}

.step-view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.step-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   STEP 1: WELCOME & PSEUDO CARD
   ============================================================ */

.welcome-card-wrapper {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.welcome-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.welcome-header {
  text-align: center;
  margin-bottom: 2rem;
}

.welcome-header .icon-circle {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.welcome-header h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

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

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-group label .required {
  color: var(--primary);
}

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

.input-with-icon svg {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 13px 14px 13px 44px;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(11, 15, 25, 0.85);
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 0.4rem;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ============================================================
   STEP 2: GALLERY CONTROLS & GRID
   ============================================================ */

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  background: var(--bg-surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.filter-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.gallery-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* ============================================================
   PHOTO GRID & CARD
   ============================================================ */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.photo-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  transition: var(--transition-smooth);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  aspect-ratio: 4 / 3;
}

.photo-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.6);
}

.photo-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), 0 10px 25px var(--primary-glow);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.photo-card:hover img {
  transform: scale(1.04);
}

.photo-card .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 45%, rgba(0,0,0,0.4) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  pointer-events: none;
}

.photo-card .top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-btn {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(11, 15, 25, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.photo-card.selected .checkbox-btn {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.photo-card:hover .checkbox-btn {
  border-color: white;
}

.view-btn {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  opacity: 0.8;
}

.view-btn:hover {
  background: white;
  color: black;
  opacity: 1;
  transform: scale(1.1);
}

.photo-card .bottom-bar {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ============================================================
   STICKY BOTTOM BAR
   ============================================================ */

.sticky-bottom-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 40;
  background: rgba(18, 24, 38, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticky-bottom-bar.visible {
  transform: translateX(-50%) translateY(0);
}

.selection-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selection-count-bubble {
  background: var(--primary);
  color: white;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.selection-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn-submit-bar {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-submit-bar:hover {
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: scale(1.03);
}

/* ============================================================
   LIGHTBOX MODAL
   ============================================================ */

.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 9, 15, 0.95);
  backdrop-filter: blur(25px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev { left: 30px; }
.lightbox-next { right: 30px; }

.lightbox-toolbar {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.lightbox-select-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: white;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.lightbox-select-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
}

/* ============================================================
   STEP 3: SUCCESS / CONFIRMATION
   ============================================================ */

.success-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 600px;
  margin: 4rem auto;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.success-icon-anim {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 30px var(--success-glow);
  animation: pulseSuccess 2s infinite;
}

@keyframes pulseSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.success-details {
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.75rem 0;
  text-align: left;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.detail-row:last-child {
  border-bottom: none;
}

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

.detail-val {
  font-weight: 600;
  color: var(--text-main);
}

/* ============================================================
   ERROR / ACCESS DENIED STATE
   ============================================================ */

.access-denied-view {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.access-card {
  max-width: 480px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.1);
}

.access-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

/* ============================================================
   MODAL CONFIRMATION & LOADING OVERLAY
   ============================================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(12px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

@media (max-width: 768px) {
  .main-content {
    padding: 1rem 1rem 6rem;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .sticky-bottom-bar {
    width: calc(100% - 2rem);
    justify-content: space-between;
  }

  .lightbox-nav {
    display: none;
  }
}
