/* =====================================================================
   ArcardsPay - Componentes: Cards, Badges, Botões
   ===================================================================== */

/* --- Card base --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

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

.card-header h3 { font-size: 15.5px; }
.card-header p { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* --- Grid de métricas do dashboard --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 1200px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .metrics-grid { grid-template-columns: 1fr; } }

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

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

.metric-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.metric-card__icon svg { width: 18px; height: 18px; }

.metric-card__icon--success { background: var(--success-bg); color: var(--success-500); }
.metric-card__icon--warning { background: var(--warning-bg); color: var(--warning-500); }
.metric-card__icon--danger  { background: var(--danger-bg); color: var(--danger-500); }
.metric-card__icon--info    { background: var(--info-bg); color: var(--info-500); }

.metric-card__label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-card__value {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  margin-top: var(--space-1);
  letter-spacing: -0.01em;
}

.metric-card__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: var(--space-2);
}
.metric-card__delta--up { color: var(--success-500); }
.metric-card__delta--down { color: var(--danger-500); }
.metric-card__delta svg { width: 12px; height: 12px; }

/* --- Badges de status --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success { background: var(--success-bg); color: var(--success-500); }
.badge-warning { background: var(--warning-bg); color: var(--warning-500); }
.badge-danger  { background: var(--danger-bg); color: var(--danger-500); }
.badge-info    { background: var(--info-bg); color: var(--info-500); }
.badge-neutral { background: var(--bg-elevated-2); color: var(--text-secondary); }

/* --- Botões --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-600); }

.btn-secondary {
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-500);
  border-color: transparent;
}
.btn-danger:hover { background: rgba(224, 71, 47, 0.2); }

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

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--text-secondary);
}
.empty-state__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  color: var(--text-tertiary);
}
.empty-state__icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: 15px; color: var(--text-primary); margin-bottom: var(--space-1); }
.empty-state p { font-size: 13.5px; }

/* =====================================================================
   Modal de Comprovante
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal-overlay .modal-box {
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-base);
}
.modal-overlay.is-open .modal-box {
  transform: translateY(0) scale(1);
}

.receipt-modal {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.receipt-modal__header {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  padding: var(--space-6) var(--space-6) var(--space-8);
  text-align: center;
  color: #fff;
  position: relative;
}
.receipt-modal__header .receipt-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.receipt-modal__header .receipt-modal__close svg { width: 16px; height: 16px; }
.receipt-modal__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: var(--space-4);
}
.receipt-modal__status-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
}
.receipt-modal__status-icon svg { width: 28px; height: 28px; }
.receipt-modal__title { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.receipt-modal__amount { font-family: var(--font-display); font-size: 30px; font-weight: 800; margin-top: var(--space-2); }

.receipt-modal__body {
  padding: var(--space-6);
  margin-top: -20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: relative;
}

.receipt-modal__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px dashed var(--border-subtle);
  gap: var(--space-4);
}
.receipt-modal__row:last-child { border-bottom: none; }
.receipt-modal__row-label { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.receipt-modal__row-value { font-size: 13px; color: var(--text-primary); font-weight: 600; text-align: right; word-break: break-word; }
.receipt-modal__row-value.is-mono { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; }

.receipt-modal__ticket-edge {
  height: 14px;
  background:
    radial-gradient(circle at 10px 0, transparent 8px, var(--bg-elevated) 8px) top left,
    radial-gradient(circle at calc(100% - 10px) 0, transparent 8px, var(--bg-elevated) 8px) top right;
  background-size: 20px 20px, 20px 20px;
  background-repeat: repeat-x;
  margin-top: -1px;
}

.receipt-modal__footer {
  padding: var(--space-4) var(--space-6) var(--space-6);
  text-align: center;
}
.receipt-modal__footer p { font-size: 11.5px; color: var(--text-tertiary); }

.receipt-modal__loading {
  padding: var(--space-16) var(--space-6);
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* =====================================================================
   Documentação da API
   ===================================================================== */
.doc-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-6);
  align-items: start;
  min-width: 0; /* evita que o grid estoure a largura do container pai */
}
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
}

.doc-content { min-width: 0; } /* crítico: sem isso, filhos com conteúdo largo (código/tabela) estouram o grid */

.doc-section { margin-bottom: var(--space-10); min-width: 0; }
.doc-section h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin-bottom: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  word-break: break-word;
}
.doc-section:first-child h2 { border-top: none; padding-top: 0; }
.doc-section p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: var(--space-3);
  overflow-wrap: break-word;
  word-break: break-word;
}
.doc-section p code, .doc-section li code { overflow-wrap: anywhere; }

.doc-endpoint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}
.doc-method {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  flex-shrink: 0;
}
.doc-method.get { background: rgba(59,130,246,0.15); color: #60a5fa; }
.doc-method.post { background: rgba(34,197,94,0.15); color: #4ade80; }
.doc-method.patch { background: rgba(168,85,247,0.15); color: #c084fc; }
.doc-method.delete { background: rgba(239,68,68,0.15); color: #f87171; }

.doc-code {
  background: #0b0d12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  color: #d4d8e0;
  margin-bottom: var(--space-3);
  white-space: pre;
  max-width: 100%;
}
.doc-code .k { color: #7dd3fc; }
.doc-code .s { color: #86efac; }
.doc-code .n { color: #fca5a5; }
.doc-code .c { color: #6b7280; }

/* Toda tabela de documentação fica dentro de um wrapper com scroll próprio,
   em vez de deixar a tabela espremer/quebrar o layout inteiro da página. */
.doc-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.doc-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 12.5px; }
.doc-table th, .doc-table td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.doc-table td:nth-child(2), .doc-table td:last-child { white-space: normal; }
.doc-table th { color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.doc-table td { color: var(--text-primary); }
.doc-table code { font-family: var(--font-mono); font-size: 11px; color: var(--brand-400); }

.doc-nav {
  position: sticky;
  top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.doc-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-nav a:hover { background: var(--bg-elevated-2); color: var(--text-primary); }
@media (max-width: 860px) {
  .doc-nav {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .doc-nav a {
    flex-shrink: 0;
    background: var(--bg-elevated-2);
    white-space: nowrap;
  }
}

.doc-badge-group { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-3); }

/* =====================================================================
   Custom Select (substitui o <select> nativo por um dropdown estilizado)
   ===================================================================== */
.cs-select-wrap { position: relative; }
.cs-select-wrap select.form-control { display: none; }

.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.cs-trigger:hover { border-color: var(--border-strong, var(--border-subtle)); }
.cs-trigger.is-open {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.cs-trigger__icon { width: 18px; height: 18px; flex-shrink: 0; display:flex; align-items:center; justify-content:center; font-size:15px; }
.cs-trigger__label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-trigger__label.is-placeholder { color: var(--text-tertiary); }
.cs-trigger__chevron { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-tertiary); transition: transform 150ms; }
.cs-trigger.is-open .cs-trigger__chevron { transform: rotate(180deg); }

.cs-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4,5,8,0.6);
  backdrop-filter: blur(3px);
  padding: 0;
}
.cs-panel-backdrop.is-open { display: flex; }

.cs-panel {
  width: 100%;
  max-width: 420px;
  max-height: 72vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}
.cs-panel-backdrop.is-open .cs-panel { transform: translateY(0); opacity: 1; }

@media (min-width: 640px) {
  .cs-panel-backdrop { align-items: center; }
  .cs-panel { border-radius: var(--radius-xl); max-width: 380px; }
}

.cs-panel__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.cs-panel__title { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; }
.cs-panel__close {
  width: 28px; height: 28px; border-radius: var(--radius-full); border: none;
  background: var(--bg-elevated-2); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.cs-panel__close svg { width: 15px; height: 15px; }

.cs-panel__search { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.cs-panel__search input {
  width: 100%; padding: 9px 12px; background: var(--bg-elevated-2); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); color: var(--text-primary); font-size: 13px;
}

.cs-panel__list { overflow-y: auto; padding: var(--space-2); }
.cs-option {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-md); cursor: pointer;
  font-size: 13.5px; color: var(--text-primary);
}
.cs-option:hover, .cs-option.is-active { background: var(--bg-elevated-2); }
.cs-option.is-selected { background: var(--brand-glow); color: var(--brand-400); font-weight: 600; }
.cs-option__icon { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.cs-option__label { flex: 1; }
.cs-option__check { width: 16px; height: 16px; flex-shrink: 0; color: var(--brand-400); }
.cs-panel__empty { padding: var(--space-8) var(--space-5); text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* =====================================================================
   Área de Membros (aluno)
   ===================================================================== */
.members-shell { max-width: 900px; margin: 0 auto; padding: 32px 20px 60px; }
.members-header { display:flex; align-items:center; gap:14px; margin-bottom: 24px; }
.members-header__cover {
  width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--brand-500);
}
.members-progress-bar {
  height: 8px; background: var(--bg-elevated-2); border-radius: 999px; overflow: hidden; margin-top: 6px;
}
.members-progress-bar__fill {
  height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-400)); border-radius: 999px; transition: width 300ms;
}

.lesson-row {
  display:flex; align-items:center; gap:12px; padding:14px; border-radius:10px; background:var(--bg-elevated);
  text-decoration:none; color:inherit; transition: background 150ms;
}
.lesson-row:hover { background: var(--bg-elevated-2); }
.lesson-row.is-locked { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.lesson-row__icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--info-bg); display:flex; align-items:center; justify-content:center;
  color: var(--brand-400); flex-shrink: 0;
}
.lesson-row__icon.is-completed { background: rgba(34,197,94,0.15); color: #4ade80; }
.lesson-row__title { flex: 1; font-size: 14px; font-weight: 500; }
.lesson-row__meta { font-size: 11.5px; color: var(--text-tertiary); }

.lesson-player { width: 100%; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 20px; }
.lesson-player video, .lesson-player iframe { width: 100%; height: 100%; border: none; }

.lesson-comment {
  display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle);
}
.lesson-comment__avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-500); color: #fff; font-weight: 700; font-size: 12px;
  display:flex; align-items:center; justify-content:center; flex-shrink: 0;
}
.lesson-comment__body { flex: 1; }
.lesson-comment__name { font-size: 13px; font-weight: 600; }
.lesson-comment__text { font-size: 13px; color: var(--text-secondary); margin-top: 2px; white-space: pre-wrap; }
.lesson-comment__date { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }

/* =====================================================================
   Bots (Telegram/WhatsApp) — apenas visual
   ===================================================================== */
.bots-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 640px) { .bots-stat-grid { grid-template-columns: 1fr; } }

.bots-cat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.bots-cat-btn {
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--bg-elevated-2); color: var(--text-secondary); border: 1px solid transparent; cursor: pointer;
}
.bots-cat-btn.is-active { background: var(--brand-500); color: #fff; }
.bots-cat-btn.is-hot.is-active { background: linear-gradient(135deg, #f97316, #ef4444); }

.bots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.bot-card { display: flex; flex-direction: column; }
.bot-card__header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bot-card__icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--bg-elevated-2); color: var(--brand-400);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bot-card__title { font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.bot-card__category { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.bot-card__desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; flex: 1; }

.bot-card__steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bot-card__step { font-size: 10.5px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--bg-elevated-2); color: var(--text-secondary); }
.bot-card__step .arrow { opacity: 0.4; margin-right: 3px; }

.bot-card__features { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.bot-card__feature { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.bot-card__feature svg { width: 13px; height: 13px; color: #22c55e; flex-shrink: 0; }

.bot-card__btn {
  width: 100%; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: var(--bg-elevated-2); color: var(--text-primary); border: 1px solid var(--border-subtle); cursor: pointer;
}
.bot-card__btn:hover { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

.bots-empty-mine { text-align: center; padding: 48px 20px; }

.bots-howto-step {
  display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border-subtle);
}
.bots-howto-step:last-child { border-bottom: none; }
.bots-howto-step__num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-500); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
  overflow: hidden;
}
.bots-howto-step__num svg { width: 20px; height: 20px; }
.bots-howto-step__num:has(svg) { background: #fff; }
