@import "global.css";
/* --- Vyra Global Text Selection (#ffbe8e) --- */
::selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}
::-moz-selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}

/* =========================================================================
   VYRA — PAGE "GÉNÉRER"
   Ce fichier ne redéfinit AUCUN token : il s'appuie entièrement sur les
   variables, la sidebar, la navbar et les composants déjà définis dans
   assets/css/dashboard.css (chargé avant celui-ci). Il n'ajoute que les
   composants propres à cette page : prompt, options, bouton de génération,
   carte résultat (avec squelette de chargement) et historique rapide.
   ========================================================================= */

/* =========================================================================
   EN-TÊTE DE PAGE
   ========================================================================= */
.generate-page-header { margin-bottom: 1.75rem; }
.generate-page-header h1 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.5rem;
}
.generate-page-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.6;
}

/* =========================================================================
   GRILLE PRINCIPALE — colonne de travail + colonne latérale
   ========================================================================= */
.generate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.5rem;
  align-items: start;
}
.generate-main { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.generate-aside { display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: calc(var(--navbar-h) + 1.5rem); }

/* =========================================================================
   CARTE VERRE GÉNÉRIQUE — base commune Prompt / Options / Résultat
   (même langage glassmorphism que les cartes du Dashboard)
   ========================================================================= */
.glass-card {
  background: linear-gradient(160deg, var(--bg-glass-1), var(--bg-glass-2));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.glass-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem;
  gap: 0.75rem;
}
.glass-card-header h2 {
  font-size: 1.02rem; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* =========================================================================
   PROMPT
   ========================================================================= */
.prompt-counter { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; }

.prompt-field { position: relative; border-radius: var(--radius-md); }
.prompt-textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  outline: none;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}
.prompt-textarea::placeholder { color: var(--text-muted); }
/* Glow subtil à la sélection, cohérent avec le violet de marque */
.prompt-textarea:focus {
  border-color: var(--violet);
  background: var(--bg-glass-2);
  box-shadow: 0 0 0 4px var(--violet-glow), 0 12px 34px rgba(91,58,232,0.14);
}

/* =========================================================================
   OPTIONS DE GÉNÉRATION — menus déroulants modernes
   ========================================================================= */
.options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.option-field { display: flex; flex-direction: column; gap: 0.5rem; }
.option-field label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
}

.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.65rem 2.2rem 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.select-wrap select:hover { background: var(--bg-glass-2); }
.select-wrap select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
}
/* Le <select> natif ne peut pas hériter le thème sombre pour son menu déroulant
   dans tous les navigateurs : on force au moins un fond lisible pour les <option>. */
.select-wrap select option { background: var(--bg-surface); color: var(--text-primary); }

.select-chevron {
  position: absolute;
  top: 50%; right: 0.75rem;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
.select-wrap select:focus ~ .select-chevron { color: var(--violet); transform: translateY(-50%) rotate(180deg); }

/* =========================================================================
   BOUTON GÉNÉRER — grand bouton premium avec glow + loader
   ========================================================================= */
.generate-btn {
  position: relative;
  width: 100%;
  padding: 1.15rem;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-size: 1.02rem; font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 12px 34px rgba(91,58,232,0.4);
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease), filter 0.2s var(--ease);
}
.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 46px rgba(91,58,232,0.55);
  filter: brightness(1.06);
}
.generate-btn:active:not(:disabled) { transform: translateY(0) scale(0.99); }
.generate-btn:disabled { cursor: progress; opacity: 0.92; }

/* halo animé qui pulse doucement derrière le bouton (glow) */
.generate-btn::before {
  content: '';
  position: absolute; inset: -40%;
  background: radial-gradient(circle, rgba(255,255,255,0.35), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  z-index: -1;
  animation: generateGlow 3s ease-in-out infinite;
}
.generate-btn:hover::before { opacity: 1; }
@keyframes generateGlow {
  0%, 100% { transform: scale(0.9) rotate(0deg); }
  50% { transform: scale(1.1) rotate(20deg); }
}

.generate-btn-content,
.generate-btn-loader {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
}
.generate-btn-content svg { width: 19px; height: 19px; }
.generate-btn-loader { display: none; }
.generate-btn.is-loading .generate-btn-content { display: none; }
.generate-btn.is-loading .generate-btn-loader { display: flex; }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   RÉSULTAT — vide / squelette / contenu généré
   ========================================================================= */
.result-meta {
  font-size: 0.76rem; font-weight: 600;
  color: var(--violet);
  background: rgba(91,58,232,0.12);
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
}

.result-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.result-empty-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}
.result-empty-icon svg { width: 24px; height: 24px; }
.result-empty p { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; }
.result-empty span { font-size: 0.82rem; max-width: 360px; line-height: 1.6; }

/* Squelette de chargement (shimmer) */
.result-skeleton { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.4rem 0; }
.skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--bg-glass-1) 25%, var(--border-strong) 50%, var(--bg-glass-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Contenu généré */
.result-output { animation: resultReveal 0.5s var(--ease); }
@keyframes resultReveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-output h3 {
  font-size: 1.05rem; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}
.result-output p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.75;
  white-space: pre-line;
}
.result-stats-row {
  display: flex; gap: 1.2rem;
  margin: 1.1rem 0 1.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.result-stats-row span::before { content: '•'; margin-right: 0.4rem; color: var(--violet); }

.result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.result-action-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 100px;
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 0.83rem; font-weight: 600;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.result-action-btn:hover { background: var(--violet); color: #fff; border-color: var(--violet); transform: translateY(-1px); }
.result-action-btn svg { width: 15px; height: 15px; }
.result-action-btn.is-confirmed { background: #34d399; color: #06281c; border-color: #34d399; }

/* =========================================================================
   COLONNE LATÉRALE — statistiques + historique rapide
   ========================================================================= */
.aside-heading { margin: 0 0 0.9rem; }
.aside-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.aside-stats-grid .stat-card { padding: 1.1rem 1.15rem; }
.aside-stats-grid .stat-card-value { font-size: 1.3rem; }

.history-mini-list { display: flex; flex-direction: column; gap: 0.7rem; }
.history-mini-card {
  display: flex; align-items: center; gap: 0.85rem;
  background: linear-gradient(160deg, var(--bg-glass-1), var(--bg-glass-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.history-mini-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}
.history-mini-card .activity-icon { width: 36px; height: 36px; border-radius: 10px; }
.history-mini-card .activity-icon svg { width: 17px; height: 17px; }
.history-mini-card .activity-name { font-size: 0.82rem; }
.history-mini-card .activity-date { font-size: 0.72rem; }
.history-mini-card .activity-open { width: 30px; height: 30px; }
.history-mini-card .activity-open svg { width: 13px; height: 13px; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1180px) {
  .generate-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .options-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .generate-grid { grid-template-columns: 1fr; }
  .generate-aside { position: static; }
  .aside-stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .options-grid { grid-template-columns: repeat(2, 1fr); }
  .aside-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .glass-card { padding: 1.3rem 1.15rem; }
  .result-actions { gap: 0.5rem; }
  .result-action-btn { flex: 1 1 calc(50% - 0.5rem); justify-content: center; }
}

@media (max-width: 480px) {
  .options-grid { grid-template-columns: 1fr; }
  .aside-stats-grid { grid-template-columns: 1fr 1fr; }
  .generate-btn { font-size: 0.94rem; padding: 1rem; }
}