/* ═══════════════════════════════════════════════════════════════════════
   CertMaker Lite v2.0 — Design System
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --cm-primary: #2563eb;
  --cm-primary-hover: #1d4ed8;
  --cm-success: #16a34a;
  --cm-success-hover: #15803d;
  --cm-danger: #dc2626;
  --cm-danger-hover: #b91c1c;
  --cm-warning: #d97706;
  --cm-bg: #f8fafc;
  --cm-surface: #ffffff;
  --cm-border: #e2e8f0;
  --cm-text: #1e293b;
  --cm-text-muted: #64748b;
  --cm-radius: 10px;
  --cm-radius-sm: 6px;
  --cm-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --cm-shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --cm-transition: 0.2s ease;
}

/* ─── WordPress Admin Menu ─────────────────────────────────────────── */
#adminmenu #toplevel_page_certmaker-lite > a {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important; font-weight: 600 !important;
}
#adminmenu #toplevel_page_certmaker-lite > a .wp-menu-name,
#adminmenu #toplevel_page_certmaker-lite > a .dashicons,
#adminmenu #toplevel_page_certmaker-lite .wp-menu-image:before { color: #fff !important; }
#adminmenu #toplevel_page_certmaker-lite:hover > a { background: linear-gradient(135deg, #1d4ed8, #1e40af) !important; }

/* ─── Layout Base ──────────────────────────────────────────────────── */
.certmaker-wrap { max-width: 1400px; }
.certmaker-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; padding: 16px 0; }
.certmaker-title { font-size: 22px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.certmaker-version { font-size: 11px; font-weight: 400; color: var(--cm-text-muted); background: var(--cm-bg); padding: 2px 8px; border-radius: 20px; }
.certmaker-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Botões ───────────────────────────────────────────────────────── */
.certmaker-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--cm-radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--cm-surface); color: var(--cm-text);
  border: 1px solid var(--cm-border);
  transition: all var(--cm-transition); white-space: nowrap;
}
.certmaker-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.certmaker-btn-primary { background: var(--cm-primary); color: #fff; border-color: var(--cm-primary); }
.certmaker-btn-primary:hover { background: var(--cm-primary-hover); }
.certmaker-btn-success { background: var(--cm-success); color: #fff; border-color: var(--cm-success); }
.certmaker-btn-success:hover { background: var(--cm-success-hover); }
.certmaker-btn-danger { background: var(--cm-danger); color: #fff; border-color: var(--cm-danger); }
.certmaker-btn-danger:hover { background: var(--cm-danger-hover); }
.certmaker-btn-ghost { background: transparent; border-color: transparent; color: var(--cm-text-muted); }
.certmaker-btn-ghost:hover { background: #f1f5f9; }
.certmaker-btn-small { padding: 4px 10px; font-size: 11px; }

/* ─── Busca rápida ─────────────────────────────────────────────────── */
.certmaker-search-bar { margin-bottom: 16px; }
.certmaker-search-input { width: 100%; max-width: 400px; padding: 10px 16px; border: 1px solid var(--cm-border); border-radius: var(--cm-radius); font-size: 14px; transition: border-color var(--cm-transition); }
.certmaker-search-input:focus { border-color: var(--cm-primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* ─── Tabela ───────────────────────────────────────────────────────── */
.certmaker-table-wrap { border: 1px solid var(--cm-border); border-radius: var(--cm-radius); overflow: hidden; background: var(--cm-surface); }
.certmaker-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.certmaker-table thead th { background: #f8fafc; color: var(--cm-text); padding: 12px 10px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--cm-border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.certmaker-table tbody td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.certmaker-table tbody tr:hover { background: #f0f7ff; }
.certmaker-table tbody tr.selected { background: #eff6ff; }
.certmaker-loading { text-align: center; padding: 40px !important; color: var(--cm-text-muted); }

/* Alias para cert-table usada em modais */
.certmaker-cert-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.certmaker-cert-table th { background: #f8fafc; padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--cm-border); font-weight: 600; font-size: 12px; }
.certmaker-cert-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.certmaker-cert-table tbody tr:nth-child(even) { background: #fafbfc; }

/* ─── Slide Modal ──────────────────────────────────────────────────── */
.certmaker-slide-modal {
  position: fixed; top: 32px; right: 0; bottom: 0;
  width: 680px; max-width: 92vw;
  background: var(--cm-surface);
  border-left: 3px solid var(--cm-primary);
  box-shadow: var(--cm-shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 10000; display: none;
}
.certmaker-slide-modal.open { transform: translateX(0); }
.certmaker-slide-wide { width: 820px; }
.certmaker-slide-content { padding: 24px; height: 100%; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; }
.slide-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--cm-border); }
.slide-header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.certmaker-slide-close { font-size: 22px; font-weight: 700; color: var(--cm-text-muted); cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all var(--cm-transition); }
.certmaker-slide-close:hover { background: #fee2e2; color: var(--cm-danger); }

/* ─── Formulários ──────────────────────────────────────────────────── */
.certmaker-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.certmaker-form-full { grid-column: 1 / -1; }
.certmaker-form-grid label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; color: var(--cm-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.certmaker-form-grid input[type="text"], .certmaker-form-grid input[type="date"],
.certmaker-form-grid input[type="number"], .certmaker-form-grid input[type="email"],
.certmaker-input, .certmaker-select { width: 100%; padding: 10px 12px; border: 1px solid var(--cm-border); border-radius: var(--cm-radius-sm); font-size: 14px; box-sizing: border-box; transition: border-color var(--cm-transition); }
.certmaker-form-grid input:focus, .certmaker-input:focus, .certmaker-select:focus { border-color: var(--cm-primary); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.certmaker-file-info { font-size: 12px; color: var(--cm-text-muted); margin-top: 4px; }
.certmaker-form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.certmaker-section-header { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 10px; flex-wrap: wrap; gap: 8px; }
.certmaker-section-header h3 { margin: 0; font-size: 15px; }
.certmaker-section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.certmaker-status-text { font-size: 12px; color: var(--cm-success); }
.certmaker-hint { font-size: 12px; color: var(--cm-text-muted); margin-top: 4px; display: block; }
.certmaker-iframe { width: 100%; height: 260px; border: 1px solid var(--cm-border); border-radius: var(--cm-radius-sm); background: #fafbfc; }

/* ─── Info boxes ───────────────────────────────────────────────────── */
.certmaker-info-box { padding: 12px 16px; border-radius: var(--cm-radius-sm); margin-bottom: 12px; font-size: 13px; }
.certmaker-info-blue { background: #eff6ff; border-left: 3px solid var(--cm-primary); color: #1e40af; }
.certmaker-info-yellow { background: #fffbeb; border-left: 3px solid var(--cm-warning); color: #92400e; }

/* ─── Tabs ─────────────────────────────────────────────────────────── */
.certmaker-tab-nav { display: flex; gap: 4px; border-bottom: 2px solid var(--cm-border); margin-bottom: 16px; }
.certmaker-tab { padding: 10px 16px; border: none; background: transparent; font-size: 13px; font-weight: 500; color: var(--cm-text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--cm-transition); border-radius: var(--cm-radius-sm) var(--cm-radius-sm) 0 0; }
.certmaker-tab:hover { color: var(--cm-text); background: #f1f5f9; }
.certmaker-tab.active { color: var(--cm-primary); border-bottom-color: var(--cm-primary); font-weight: 600; }
.certmaker-tab-panel { display: none; }
.certmaker-tab-panel.active { display: block; }

/* ─── Tags de shortcode ────────────────────────────────────────────── */
.certmaker-shortcode-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }
.certmaker-tag-btn { padding: 4px 10px; font-size: 11px; background: #f1f5f9; border: 1px solid var(--cm-border); border-radius: 20px; cursor: pointer; color: var(--cm-text); transition: all var(--cm-transition); }
.certmaker-tag-btn:hover { background: var(--cm-primary); color: #fff; border-color: var(--cm-primary); }

/* ─── Cards de aprovação ───────────────────────────────────────────── */
.certmaker-cards-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.certmaker-card-aprovacao { flex: 1 1 calc(20% - 12px); min-width: 240px; max-width: 280px; }
.certmaker-card-inner { border: 1px solid var(--cm-border); border-radius: var(--cm-radius); padding: 14px; background: var(--cm-surface); box-shadow: var(--cm-shadow); transition: box-shadow var(--cm-transition); }
.certmaker-card-inner:hover { box-shadow: var(--cm-shadow-lg); }
.certmaker-card-header { font-size: 11px; color: var(--cm-text-muted); margin-bottom: 8px; }
.certmaker-card-evento { font-weight: 700; color: var(--cm-text); font-size: 13px; }
.certmaker-card-edit-row { margin-bottom: 6px; }
.certmaker-card-edit-label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; cursor: pointer; }
.certmaker-card-text { display: flex; flex-direction: column; gap: 2px; }
.certmaker-card-line { font-size: 12px; color: var(--cm-text); }
.certmaker-card-label { font-weight: 600; color: var(--cm-text-muted); }
.certmaker-card-edit-data { font-size: 10px; color: #94a3b8; }
.certmaker-card-footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f5f9; }
.certmaker-sep { border: none; border-top: 1px solid #f1f5f9; margin: 4px 0; }

/* Pagination */
.certmaker-pagination { display: flex; justify-content: center; gap: 4px; margin-bottom: 16px; }
.certmaker-page-btn { padding: 4px 10px; border: 1px solid var(--cm-border); background: var(--cm-surface); border-radius: var(--cm-radius-sm); font-size: 12px; cursor: pointer; transition: all var(--cm-transition); }
.certmaker-page-btn.active { background: var(--cm-primary); border-color: var(--cm-primary); color: #fff; }
.certmaker-page-btn:hover:not(.active) { background: #f1f5f9; }

/* ─── Presença ─────────────────────────────────────────────────────── */
.presencaAcoes { white-space: nowrap; }
.presenca-btn { padding: 3px 8px; font-size: 11px; min-width: 26px; text-align: center; margin-right: 4px; border-radius: 4px; }
.presenca-btn-p { background: var(--cm-success); color: #fff; border: none; cursor: pointer; }
.presenca-btn-p:hover { background: var(--cm-success-hover); }
.presenca-btn-f { background: var(--cm-danger); color: #fff; border: none; cursor: pointer; }
.presenca-btn-f:hover { background: var(--cm-danger-hover); }

/* ─── Loader AJAX ──────────────────────────────────────────────────── */
.certmaker-ajax-loader {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(15,23,42,0.85); color: #fff; padding: 16px 24px;
  border-radius: 12px; z-index: 10050; text-align: center; min-width: 140px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3); backdrop-filter: blur(4px);
}
.certmaker-ajax-loader .spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; margin: 0 auto 8px; animation: cmSpin 0.8s linear infinite; }
@keyframes cmSpin { to { transform: rotate(360deg); } }
.certmaker-ajax-loader .txt { font-size: 13px; opacity: 0.9; }

/* ─── Área Pública ─────────────────────────────────────────────────── */
.certmaker-public-wrap { max-width: 700px; margin: 20px auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.certmaker-public-card { background: var(--cm-surface); border: 1px solid var(--cm-border); border-radius: 16px; padding: 32px; box-shadow: var(--cm-shadow); }
.certmaker-public-header { margin-bottom: 24px; }
.certmaker-public-header h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.certmaker-public-header p { margin: 0; color: var(--cm-text-muted); font-size: 14px; }
.certmaker-public-form { margin-bottom: 16px; }
.certmaker-public-input-group { display: flex; gap: 8px; }
.certmaker-public-input { flex: 1; padding: 12px 16px; border: 2px solid var(--cm-border); border-radius: var(--cm-radius); font-size: 15px; transition: border-color var(--cm-transition); box-sizing: border-box; width: 100%; }
.certmaker-public-input:focus { border-color: var(--cm-primary); outline: none; }
.certmaker-public-alert { padding: 12px 16px; border-radius: var(--cm-radius-sm); font-weight: 500; font-size: 14px; }
.certmaker-public-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--cm-border); }

/* Resultado de validação */
.certmaker-valid-result { padding: 20px; border-radius: var(--cm-radius); margin: 16px 0; }
.certmaker-valid-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.certmaker-valid-fail { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.certmaker-valid-result h3 { margin: 0 0 12px; }
.certmaker-valid-result p { margin: 4px 0; }

/* Check-in */
.certmaker-checkin-evento { background: #f8fafc; padding: 16px; border-radius: var(--cm-radius); border-left: 4px solid var(--cm-primary); margin-bottom: 20px; }
.certmaker-checkin-evento h3 { margin: 0 0 8px; }
.certmaker-checkin-evento p { margin: 4px 0; color: var(--cm-text-muted); }
.certmaker-checkin-nome { background: #f8fafc; padding: 16px; border-radius: var(--cm-radius); margin-bottom: 16px; }

/* ─── Dashboard (controle) ─────────────────────────────────────────── */
.certmaker-dashboard { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 16px; }
.certmaker-dash-card { border: 1px solid var(--cm-border); border-radius: var(--cm-radius); padding: 16px; background: var(--cm-surface); }
.certmaker-dash-card .label { font-weight: 600; font-size: 12px; color: var(--cm-text-muted); text-transform: uppercase; }
.certmaker-dash-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--cm-text); }

/* ─── Responsivo ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .certmaker-slide-modal { width: 100vw; max-width: 100vw; top: 46px; border-left: none; border-radius: 16px 16px 0 0; }
  .certmaker-slide-content { padding: 16px; }
  .certmaker-form-grid { grid-template-columns: 1fr; }
  .certmaker-header { flex-direction: column; align-items: flex-start; }
  .certmaker-dashboard { grid-template-columns: 1fr; }
  .certmaker-cards-grid { flex-direction: column; }
  .certmaker-card-aprovacao { max-width: 100%; }
  .certmaker-public-input-group { flex-direction: column; }
}
