/**
 * MenteUp - Components Library
 * Botões, cards, inputs, modais, abas e microinterações elegantes.
 */

/* ==========================================================================
   Botões
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  line-height: 1.35;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-subtle {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-subtle:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.btn-accent {
  background-color: var(--accent);
  color: var(--text-inverse);
}

.btn-accent:hover {
  background-color: var(--accent-700);
  color: var(--text-inverse);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.btn-icon.active {
  background-color: var(--primary-50);
  color: var(--primary);
}

/* ==========================================================================
   Inputs e Formulários
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.input, .textarea, .select {
  width: 100%;
  padding: 9px 13px;
  font-size: 0.875rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary-500);
  outline: none;
  box-shadow: var(--shadow-glow-primary);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-subtle);
}

.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* Input com Ícone Integrado */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

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

.input-with-icon input {
  padding-left: 38px;
}

/* ==========================================================================
   Superfícies & Cards
   ========================================================================== */
.surface-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal);
}

.surface-card-interactive {
  cursor: pointer;
}

.surface-card-interactive:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   Barra de Busca / Prompt Rápido de Estudo ("O que você quer aprender hoje?")
   ========================================================================== */
.study-prompt-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.study-prompt-box:focus-within {
  border-color: var(--primary-400);
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.1), 0 8px 10px -6px rgba(124, 58, 237, 0.05);
}

.study-prompt-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.study-prompt-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.study-prompt-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  color: var(--text-main);
  outline: none;
}

.study-prompt-input::placeholder {
  color: var(--text-subtle);
  font-size: 0.95rem;
}

.study-prompt-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.prompt-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 0.78125rem;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prompt-tag:hover {
  background-color: var(--primary-50);
  border-color: var(--primary-border);
  color: var(--primary-700);
}

/* ==========================================================================
   Modais e Dialogs
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal-container {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-body {
  padding: var(--space-6);
  flex: 1;
}

/* Modal Especial de Leitura Imersiva de PDFs (100% Branco Editorial) */
.modal-container:has(.academic-pdf-reader) {
  max-width: 960px;
  background: #ffffff !important;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
}

.modal-container:has(.academic-pdf-reader) .modal-header {
  display: none;
}

.modal-container:has(.academic-pdf-reader) .modal-body {
  padding: 0 !important;
  background: #ffffff !important;
  overflow: hidden;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  background-color: var(--bg-hover);
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--text-main);
  color: var(--text-inverse);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transform: translateY(12px);
  opacity: 0;
  transition: all var(--transition-normal);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background-color: #064e3b;
  border-left: 4px solid var(--success-500);
}

.toast-info {
  background-color: #0f172a;
  border-left: 4px solid var(--primary-500);
}

.toast-error {
  background-color: #7f1d1d;
  border-left: 4px solid var(--danger-500);
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background-color: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  max-width: 420px;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-smooth);
}

.progress-bar-fill.accent {
  background: var(--accent);
}

.progress-bar-fill.success {
  background: var(--success-500);
}

/* ==========================================================================
   Autenticação & Código de Confirmação
   ========================================================================== */
.auth-code-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.75rem;
  font-family: var(--font-family-mono);
  font-weight: 700;
  letter-spacing: 12px;
  text-align: center;
  background-color: var(--bg-surface);
  border: 2px solid var(--primary-300);
  border-radius: var(--radius-lg);
  color: var(--primary-800);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.auth-code-input:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

/* Alertas de Autenticação */
.auth-alert {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin: 14px 0 18px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeInAlert 0.25s ease-out;
}

@keyframes fadeInAlert {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.auth-alert-danger strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #7f1d1d;
  margin-bottom: 2px;
}

.auth-alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.auth-alert-info {
  background-color: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #5b21b6;
}

/* OTP 6-Digit Container & Inputs */
.otp-wrapper {
  margin: 20px 0;
  text-align: center;
}

.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 12px 0 8px 0;
}

.otp-box {
  width: 48px;
  height: 56px;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-family-mono);
  text-align: center;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.otp-box:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
  transform: translateY(-2px);
}

.otp-box.filled {
  border-color: var(--primary-400);
  background-color: var(--primary-50);
  color: var(--primary-900);
}

.otp-row.error .otp-box {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  color: #991b1b !important;
  animation: shakeOtp 0.4s ease-in-out;
}

@keyframes shakeOtp {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Card Chamativo de Acesso ao E-mail */
.email-preview-callout {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.email-preview-callout-text h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-900);
  margin-bottom: 2px;
}

.email-preview-callout-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Notificação Flutuante de E-mail Recebido */
.floating-email-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10005;
  max-width: 420px;
  width: calc(100% - 40px);
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px -5px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(124, 58, 237, 0.1);
  padding: 16px;
  animation: slideInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.floating-email-toast:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 45px -5px rgba(15, 23, 42, 0.22);
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Moldura do Leitor de E-mail (Webmail) */
.webmail-frame {
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.webmail-bar {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
}

.webmail-header-info {
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.webmail-subject {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.webmail-from-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8125rem;
  color: #475569;
}

.webmail-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.webmail-content-body {
  padding: 24px 20px;
  background: #f8fafc;
}

.email-styled-card {
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.email-card-hero {
  background: linear-gradient(135deg, #1e1145 0%, #2e1065 60%, #4c1d95 100%);
  color: #ffffff;
  padding: 24px 20px;
  text-align: center;
}

.email-card-body {
  padding: 24px 20px;
  color: #334155;
  font-size: 0.875rem;
  line-height: 1.55;
}

.email-code-box {
  background: #f5f3ff;
  border: 2px dashed #7c3aed;
  border-radius: 12px;
  padding: 16px;
  margin: 18px 0;
  text-align: center;
}

.email-code-digits {
  font-family: var(--font-family-mono);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 8px;
  color: #5b21b6;
  margin-bottom: 8px;
  display: block;
}

/* ==========================================================================
   Diagnóstico Interativo de Aprendizagem (Onboarding do Curso/Faculdade)
   ========================================================================== */
.diagnostic-container {
  max-width: 680px;
  margin: 0 auto;
}

.diagnostic-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary-700);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.diagnostic-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.diagnostic-option-card:hover {
  border-color: var(--primary-400);
  background-color: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.diagnostic-option-card.selected {
  border-color: var(--primary);
  background-color: var(--primary-50);
  box-shadow: 0 0 0 2px var(--primary);
}

.recommendation-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.recommendation-card:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
}

