/* ==========================================================================
   SnapVid API - Design System & Modern Glassmorphism Styling
   ========================================================================== */

/* --- Variables Globales (Thème Sombre & Vibrant) --- */
:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Nuancier de couleurs HSL */
  --bg-main: #06060c;
  --bg-card: rgba(13, 13, 25, 0.55);
  --bg-card-hover: rgba(20, 20, 38, 0.7);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(138, 92, 246, 0.3);
  
  --primary-glow: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
  --primary-hover: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --success: #10b981;
  --error: #f43f5e;
  --error-bg: rgba(244, 63, 94, 0.1);
  --error-border: rgba(244, 63, 94, 0.25);
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.20s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* --- Arrière-plan Lumineux Subtil (Ambient Glow) --- */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.bg-glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #8b5cf6 0%, rgba(139, 92, 246, 0) 70%);
  top: -10%;
  left: -5%;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
  bottom: 10%;
  right: -5%;
}

.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #ec4899 0%, rgba(236, 72, 153, 0) 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.15;
}

/* --- Conteneur Général --- */
.container {
  width: 100%;
  max-width: 960px;
  padding: 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* --- Animations de Base --- */
.animate-fade-in {
  animation: fadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-up {
  animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

/* --- Header Section --- */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #a78bfa;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.1);
}

.title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.title span {
  background: linear-gradient(to right, #8b5cf6, #3b82f6, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 580px;
  font-weight: 400;
}

/* --- Styles Glassmorphism (Cartes Réutilisables) --- */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: var(--transition-smooth);
}

.glass:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.05);
}

/* --- Section Principale : Générateur --- */
.main-card {
  padding: 2.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
}

.icon-circle-purple {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.icon-circle svg {
  width: 24px;
  height: 24px;
}

.card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Formulaire & Éléments de Saisie --- */
.generator-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

input[type="url"],
input[type="password"] {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-light);
  padding: 1.1rem 1.4rem;
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  width: 100%;
}

input[type="url"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Bouton principal brillant */
button[type="submit"] {
  background: var(--primary-glow);
  color: white;
  border: none;
  padding: 0 2.2rem;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
  position: relative;
  overflow: hidden;
}

button[type="submit"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
}

button[type="submit"]:hover::before {
  left: 100%;
}

button[type="submit"]:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
}

button[type="submit"]:active {
  transform: translateY(0);
}

button[type="submit"]:disabled {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

/* Spinner & États de chargement */
.btn-loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  animation: rotate 2s linear infinite;
  width: 18px;
  height: 18px;
}

.spinner .path {
  stroke: currentColor;
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

@keyframes dash {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

.hidden {
  display: none !important;
}

/* --- Cartes d'Erreur --- */
.error-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #fda4af;
  border-radius: 14px;
}

.error-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* --- Résultats Section --- */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-secondary svg {
  width: 18px;
  height: 18px;
}

/* --- Grille de Captures d'Écran --- */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* Carte Image Premium */
.screenshot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.screenshot-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--border-hover);
  box-shadow: 0 16px 36px rgba(139, 92, 246, 0.12);
}

.image-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
  background: #000;
  overflow: hidden;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.screenshot-card:hover .image-wrapper img {
  transform: scale(1.08);
}

/* Tag de Timestamp */
.timestamp-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(13, 13, 25, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-info h3 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
}

.card-info p {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.btn-icon {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #c084fc;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background: var(--primary-glow);
  color: white;
  border-color: transparent;
  transform: scale(1.1);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* --- Section Documentation --- */
.docs-section {
  padding: 2.5rem;
}

.tabs-container {
  margin-top: 1.75rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.tabs-header {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-light);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.9rem 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

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

.tab-btn.active {
  color: #c084fc;
  border-bottom-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
}

.tabs-content {
  padding: 1.5rem;
  position: relative;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

pre {
  margin: 0;
  overflow-x: auto;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e5e7eb;
}

/* Coloration Syntaxique Basique dans le CSS */
code .comment { color: var(--text-muted); font-style: italic; }
code .string { color: #f472b6; }
code .keyword { color: #818cf8; font-weight: 600; }

.copy-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.copy-icon {
  width: 14px;
  height: 14px;
}

.copy-btn.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* --- Footer --- */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

/* Custom Scrollbar pour un look de pointe */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.2);
  border-radius: 10px;
  transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.45);
}

/* --- Options & Aspect Ratios --- */
.options-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.options-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.aspect-ratio-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ratio-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ratio-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ratio-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.ratio-chip.active,
.ratio-chip:has(input:checked) {
  background: rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
  color: #c084fc;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

/* --- Adaptabilité Mobile (Media Queries) --- */
@media (max-width: 640px) {
  .container {
    padding: 2.5rem 1rem;
    gap: 1.75rem;
  }
  
  .main-card, .docs-section {
    padding: 1.5rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  button[type="submit"] {
    padding: 1rem;
    width: 100%;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  #download-zip-btn {
    width: 100%;
    justify-content: center;
  }
}
