/* ==========================================================================
   PNDSLab Components CSS - Buttons, Badges, Modals, Forms, Audio, Quiz
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, hsl(238, 85%, 70%), var(--primary-500));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--bg-glass-border);
}
.btn-secondary:hover {
  background: var(--bg-glass-border);
  border-color: rgba(99, 102, 241, 0.4);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.25);
  position: relative;
  overflow: hidden;
}
.btn-ai::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  transform: rotate(30deg);
  pointer-events: none;
  transition: transform 0.5s;
}
.btn-ai:hover::after {
  transform: rotate(30deg) translate(20%, 20%);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald-500), hsl(160, 84%, 30%));
  color: white;
  box-shadow: 0 4px 15px var(--emerald-glow);
}
.btn-emerald:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-brouillon {
  background: rgba(148, 163, 184, 0.15);
  color: var(--badge-draft-color);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-cadrage {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-enredaction {
  background: var(--amber-glow);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-enrelecture {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-valide {
  background: var(--emerald-glow);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-diffuse {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
  color: #db2777;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

/* Progress Bar & Stepper */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--progress-track);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary-500), var(--emerald-500));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 110px;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--bg-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.75rem;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--bg-glass-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Audio Player Component */
.audio-player-card {
  background: var(--audio-bg);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.waveform-visualizer {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.waveform-bar {
  width: 4px;
  height: 20%;
  background: var(--primary-500);
  border-radius: 4px;
  transition: height 0.2s ease;
}

.audio-player-card.playing .waveform-bar {
  animation: wave 1.2s infinite ease-in-out alternate;
}

@keyframes wave {
  0% { height: 15%; }
  100% { height: 95%; background: var(--cyan-500); }
}

/* Quiz Card & Options */
.quiz-option-card {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* ==========================================================================
   Document Preview System (Formal HAS PNDS Paper Layout)
   ========================================================================== */
.document-preview-modal {
  max-width: 900px !important;
  width: 95% !important;
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.document-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem;
  background: #f8fafc;
  color: #0f172a;
  font-family: 'Inter', Georgia, serif;
  line-height: 1.7;
}

[data-theme="dark"] .document-preview-body {
  background: #0f172a;
  color: #f8fafc;
}

.pnds-paper {
  background: white;
  color: #1e293b;
  border-radius: var(--radius-md);
  padding: 3.5rem 4rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  max-width: 800px;
  margin: 0 auto;
}

.pnds-paper-header {
  border-bottom: 3px solid #6366f1;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.pnds-paper-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.pnds-paper-toc {
  background: #f1f5f9;
  border-left: 4px solid #6366f1;
  padding: 1.25rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 2.5rem;
}

.pnds-paper-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 2rem;
}

.pnds-paper-section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e1b4b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.pnds-paper-content {
  font-size: 0.95rem;
  color: #334155;
  white-space: pre-line;
}

.pnds-paper-biblio-item {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .pnds-paper, .pnds-paper * {
    visibility: visible;
  }
  .pnds-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    padding: 0;
  }
}
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quiz-option-card:hover {
  border-color: var(--primary-500);
  background: var(--bg-card-hover);
}

.quiz-option-card.selected {
  border-color: var(--primary-500);
  background: rgba(99, 102, 241, 0.15);
}

.quiz-option-card.correct {
  border-color: var(--emerald-500);
  background: var(--emerald-glow);
}

.quiz-option-card.incorrect {
  border-color: var(--rose-500);
  background: var(--rose-glow);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-left: 4px solid var(--primary-500);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 300px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
