/* ============================================================
   DiscKey — Sistema de diseño admin
   Base: blanco. Acento: #5b2d8e (Prelace). Minimalista.
   ============================================================ */

:root {
	--dk-accent: #5b2d8e;
	--dk-accent-dark: #47216f;
	--dk-accent-soft: #f3edfa;
	--dk-ink: #1a1523;
	--dk-ink-2: #6b6577;
	--dk-ink-3: #9b95a6;
	--dk-line: #e9e6ef;
	--dk-line-2: #f1eff5;
	--dk-bg-soft: #faf9fc;
	--dk-white: #ffffff;
	--dk-radius: 14px;
	--dk-radius-sm: 10px;
	--dk-shadow: 0 1px 2px rgba(26,21,35,.04), 0 4px 16px rgba(26,21,35,.04);
	--dk-shadow-lg: 0 10px 40px rgba(26,21,35,.12);
	--dk-d: #d64545;
	--dk-i: #e59a1a;
	--dk-s: #2e9e4f;
	--dk-c: #3b6fd6;
}

/* Reset suave dentro de nuestras pantallas */
.disckey-app, .disckey-app * { box-sizing: border-box; }
.disckey-app {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--dk-ink);
	max-width: 1180px;
	margin: 0;
	padding: 8px 20px 60px 0;
	-webkit-font-smoothing: antialiased;
}
.disckey-app h1, .disckey-app h2, .disckey-app h3, .disckey-app p { margin: 0; }

/* Oculta el título nativo de WP cuando montamos nuestra propia cabecera */
.disckey-app .wp-heading-inline { display: none; }

/* ---------- Cabecera ---------- */
.dk-head {
	display: flex; align-items: flex-end; justify-content: space-between;
	gap: 20px; margin: 8px 0 28px;
}
.dk-head-title { display: flex; flex-direction: column; gap: 4px; }
.dk-head-title h1 { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.dk-head-title p { color: var(--dk-ink-2); font-size: 14px; }

/* ---------- Botones ---------- */
.dk-btn {
	display: inline-flex; align-items: center; gap: 8px;
	border: none; cursor: pointer; text-decoration: none;
	font-size: 14px; font-weight: 600; line-height: 1;
	padding: 11px 18px; border-radius: var(--dk-radius-sm);
	transition: background .15s, box-shadow .15s, transform .05s;
	white-space: nowrap;
}
.dk-btn:active { transform: translateY(1px); }
.dk-btn-primary { background: var(--dk-accent); color: #fff; }
.dk-btn-primary:hover { background: var(--dk-accent-dark); color: #fff; }
.dk-btn-primary .dashicons { font-size: 17px; width: 17px; height: 17px; }
.dk-btn-ghost { background: var(--dk-white); color: var(--dk-ink); border: 1px solid var(--dk-line); }
.dk-btn-ghost:hover { background: var(--dk-bg-soft); color: var(--dk-ink); border-color: var(--dk-ink-3); }
.dk-btn-block { width: 100%; justify-content: center; }
.dk-btn-lg { padding: 13px 22px; font-size: 15px; }

/* ---------- Tarjetas de métricas ---------- */
.dk-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 26px; }
.dk-metric {
	background: var(--dk-white); border: 1px solid var(--dk-line);
	border-radius: var(--dk-radius); padding: 18px 20px;
	display: flex; flex-direction: column; gap: 6px;
	box-shadow: var(--dk-shadow);
}
.dk-metric-top { display: flex; align-items: center; gap: 8px; }
.dk-metric-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dk-ink-3); flex: none; }
.dk-metric.is-pending  .dk-metric-dot { background: #b0aebb; }
.dk-metric.is-progress .dk-metric-dot { background: var(--dk-i); }
.dk-metric.is-done     .dk-metric-dot { background: var(--dk-s); }
.dk-metric.is-expired  .dk-metric-dot { background: var(--dk-d); }
.dk-metric-lbl { font-size: 12px; font-weight: 600; color: var(--dk-ink-2); text-transform: uppercase; letter-spacing: .04em; }
.dk-metric-num { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }

/* ---------- Barra de herramientas (filtros) ---------- */
.dk-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.disckey-app .dk-select {
	appearance: none !important; -webkit-appearance: none !important; -moz-appearance: none !important;
	background: var(--dk-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6577' d='M6 8L2 4h8z'/%3E%3C/svg%3E") no-repeat right 12px center !important;
	border: 1px solid var(--dk-line) !important; border-radius: var(--dk-radius-sm) !important;
	padding: 0 34px 0 14px !important; font-size: 14px !important; color: var(--dk-ink) !important; cursor: pointer;
	height: 42px !important; line-height: 42px !important; min-width: 160px; max-width: none;
	box-shadow: none !important; margin: 0; font-family: inherit;
}
.disckey-app .dk-select:focus { outline: none; border-color: var(--dk-accent) !important; box-shadow: 0 0 0 3px var(--dk-accent-soft) !important; }
.dk-search { display: flex; margin-left: auto; }
.dk-search input {
	border: 1px solid var(--dk-line); border-radius: var(--dk-radius-sm);
	padding: 10px 14px; font-size: 14px; min-width: 260px; color: var(--dk-ink);
}
.dk-search input:focus { outline: none; border-color: var(--dk-accent); box-shadow: 0 0 0 3px var(--dk-accent-soft); }

/* ---------- Tabla ---------- */
.dk-card {
	background: var(--dk-white); border: 1px solid var(--dk-line);
	border-radius: var(--dk-radius); box-shadow: var(--dk-shadow); overflow: hidden;
}
.dk-table { width: 100%; border-collapse: collapse; }
.dk-table thead th {
	text-align: left; padding: 13px 20px; background: var(--dk-bg-soft);
	font-size: 11px; font-weight: 700; color: var(--dk-ink-2);
	text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--dk-line);
}
.dk-table tbody td { padding: 16px 20px; border-bottom: 1px solid var(--dk-line-2); font-size: 14px; vertical-align: middle; }
.dk-table tbody tr:last-child td { border-bottom: none; }
.dk-table tbody tr { transition: background .12s; }
.dk-table tbody tr:hover { background: var(--dk-bg-soft); }
.dk-th-right { text-align: right; }

.dk-person { display: flex; flex-direction: column; gap: 2px; }
.dk-person-name { font-weight: 650; color: var(--dk-ink); }
.dk-person-mail { font-size: 12.5px; color: var(--dk-ink-3); }

.dk-test-name { color: var(--dk-ink-2); }
.dk-muted { color: var(--dk-ink-3); }
.dk-expiring { color: var(--dk-d); font-weight: 600; }

.dk-empty { text-align: center; padding: 56px 20px !important; color: var(--dk-ink-3); }
.dk-empty-strong { display: block; font-weight: 650; color: var(--dk-ink-2); font-size: 15px; margin-bottom: 4px; }

/* Pills de estado */
.dk-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.dk-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.dk-pill-pending     { background: #f2f1f5; color: #6b6577; }
.dk-pill-pending::before     { background: #b0aebb; }
.dk-pill-in_progress { background: #fdf3e0; color: #9a6a12; }
.dk-pill-in_progress::before { background: var(--dk-i); }
.dk-pill-completed   { background: #e6f5ec; color: #1f7a3d; }
.dk-pill-completed::before   { background: var(--dk-s); }
.dk-pill-expired     { background: #fdeaea; color: #b13636; }
.dk-pill-expired::before     { background: var(--dk-d); }

/* Letra de resultado DISC */
.dk-letter { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; font-weight: 750; color: #fff; font-size: 15px; }
.dk-letter-D { background: var(--dk-d); }
.dk-letter-I { background: var(--dk-i); }
.dk-letter-S { background: var(--dk-s); }
.dk-letter-C { background: var(--dk-c); }

/* Acciones por fila */
.dk-actions { text-align: right; white-space: nowrap; }
.dk-iform { display: inline-block; margin: 0; }
.dk-ico {
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--dk-line);
	background: var(--dk-white); cursor: pointer; color: var(--dk-ink-2);
	text-decoration: none; margin-left: 5px; padding: 0; transition: all .12s;
}
.dk-ico:hover { background: var(--dk-accent-soft); border-color: var(--dk-accent); color: var(--dk-accent); }
.dk-ico .dashicons { font-size: 17px; width: 17px; height: 17px; }
.dk-ico-danger:hover { background: #fdeaea; border-color: var(--dk-d); color: var(--dk-d); }

/* Paginación */
.dk-pagination { display: flex; gap: 6px; margin-top: 18px; }
.dk-page {
	display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px;
	padding: 0 10px; border-radius: 9px; border: 1px solid var(--dk-line);
	background: var(--dk-white); text-decoration: none; color: var(--dk-ink-2); font-weight: 600; font-size: 13px;
}
.dk-page:hover { border-color: var(--dk-accent); color: var(--dk-accent); }
.dk-page.is-active { background: var(--dk-accent); color: #fff; border-color: var(--dk-accent); }

/* ---------- Modal ---------- */
.dk-modal { position: fixed; inset: 0; background: rgba(26,21,35,.45); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 100000; padding: 20px; }
.dk-modal.is-open { display: flex; }
.dk-modal-box { background: var(--dk-white); border-radius: 18px; padding: 30px; width: 100%; max-width: 440px; position: relative; box-shadow: var(--dk-shadow-lg); animation: dkpop .18s ease; }
@keyframes dkpop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dk-modal-x { position: absolute; top: 16px; right: 18px; background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--dk-ink-3); }
.dk-modal-x:hover { color: var(--dk-ink); }
.dk-modal-box h2 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.dk-modal-desc { color: var(--dk-ink-2); font-size: 14px; margin-top: 6px !important; margin-bottom: 22px !important; }

/* ---------- Campos de formulario ---------- */
.dk-field { margin-bottom: 18px; }
.dk-field > label { display: block; font-weight: 650; font-size: 13px; margin-bottom: 7px; color: var(--dk-ink); }
.dk-field .dk-opt { font-weight: 400; color: var(--dk-ink-3); }
.disckey-app .dk-input, .disckey-app .dk-textarea, .disckey-app .dk-field select {
	width: 100% !important; padding: 0 13px !important; border: 1px solid var(--dk-line) !important; border-radius: var(--dk-radius-sm) !important;
	font-size: 14px !important; color: var(--dk-ink) !important; font-family: inherit; background: var(--dk-white) !important;
	height: 44px !important; line-height: 44px !important; box-shadow: none !important; margin: 0 !important; max-width: none;
	box-sizing: border-box !important;
}
.disckey-app .dk-field select {
	appearance: none !important; -webkit-appearance: none !important; -moz-appearance: none !important;
	padding: 0 36px 0 13px !important; cursor: pointer;
	background: var(--dk-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6577' d='M6 8L2 4h8z'/%3E%3C/svg%3E") no-repeat right 13px center !important;
}
.disckey-app .dk-textarea { height: auto !important; line-height: 1.5 !important; padding: 11px 13px !important; }
.dk-input:focus, .dk-textarea:focus, .dk-field select:focus { outline: none; border-color: var(--dk-accent) !important; box-shadow: 0 0 0 3px var(--dk-accent-soft) !important; }
.dk-textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.dk-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--dk-ink-2); margin: 6px 0 14px; cursor: pointer; line-height: 1.45; }
.dk-check input { margin-top: 2px; flex: none; }
.dk-help { font-size: 12.5px; color: var(--dk-ink-3); margin-top: 6px; line-height: 1.5; }

/* ---------- Página con secciones (Ajustes / editor) ---------- */
.dk-section {
	background: var(--dk-white); border: 1px solid var(--dk-line); border-radius: var(--dk-radius);
	box-shadow: var(--dk-shadow); padding: 26px 28px; margin-bottom: 20px;
}
.dk-section-head { margin-bottom: 20px; }
.dk-section-head h2 { font-size: 18px; font-weight: 700; }
.dk-section-head p { color: var(--dk-ink-2); font-size: 13.5px; margin-top: 4px; }
.dk-section-num {
	display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
	border-radius: 8px; background: var(--dk-accent-soft); color: var(--dk-accent);
	font-weight: 700; font-size: 13px; margin-right: 10px;
}

/* Caja de shortcode / copiar */
.dk-copy-row { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--dk-line); border-radius: var(--dk-radius-sm); overflow: hidden; background: var(--dk-bg-soft); }
.dk-copy-code { flex: 1; padding: 12px 16px; font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 14px; color: var(--dk-accent); font-weight: 600; display: flex; align-items: center; }
.dk-copy-go { border: none; border-left: 1px solid var(--dk-line); background: var(--dk-white); padding: 0 18px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--dk-ink-2); display: flex; align-items: center; gap: 6px; }
.dk-copy-go:hover { background: var(--dk-accent-soft); color: var(--dk-accent); }
.dk-copy-go.is-copied { color: var(--dk-s); }

/* Estado de página detectada */
.dk-detect { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 12px; padding: 10px 14px; border-radius: var(--dk-radius-sm); }
.dk-detect-ok { background: #e6f5ec; color: #1f7a3d; }
.dk-detect-no { background: #fdf3e0; color: #9a6a12; }
.dk-detect a { color: inherit; text-decoration: underline; }

/* Banner / avisos */
.dk-banner { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--dk-radius-sm); margin-bottom: 20px; font-size: 14px; }
.dk-banner-success { background: #e6f5ec; color: #1f7a3d; border: 1px solid #b8e4c7; }
.dk-banner-info { background: var(--dk-accent-soft); color: var(--dk-accent-dark); border: 1px solid #dbc9f0; }
.dk-banner-error { background: #fdeaea; border: 1px solid #f5c6c6; color: #b13636; }

/* Link generado (resultado) */
.dk-result-link { background: var(--dk-accent-soft); border: 1px solid #dbc9f0; border-radius: var(--dk-radius); padding: 18px 20px; margin-bottom: 20px; }
.dk-result-link label { font-weight: 650; font-size: 13px; color: var(--dk-accent-dark); }

/* ---------- Editor de test (meta box) ---------- */
.dk-builder-sec { padding: 22px 0; border-bottom: 1px solid var(--dk-line-2); }
.dk-builder-sec:first-child { padding-top: 4px; }
.dk-builder-sec:last-child { border-bottom: none; }
.dk-builder-sec > h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.dk-builder-sec > .dk-sec-desc { color: var(--dk-ink-2); font-size: 13px; margin-bottom: 14px; }

.dk-mini-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.dk-mini-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--dk-ink-2); padding: 6px 8px; font-weight: 700; }
.dk-mini-table td { padding: 6px 8px; vertical-align: middle; }
.dk-mini-table input[type=text], .dk-mini-table input[type=number], .dk-mini-table select {
	width: 100%; padding: 8px 10px; border: 1px solid var(--dk-line); border-radius: 8px; font-size: 13px; font-family: inherit;
}
.dk-mini-table input:focus, .dk-mini-table select:focus { outline: none; border-color: var(--dk-accent); box-shadow: 0 0 0 2px var(--dk-accent-soft); }
.dk-row-del { background: none; border: none; color: var(--dk-ink-3); cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 6px; }
.dk-row-del:hover { background: #fdeaea; color: var(--dk-d); }

.dk-import { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--dk-bg-soft); border: 1px dashed var(--dk-line); border-radius: var(--dk-radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.dk-import-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--dk-white); border: 1px solid var(--dk-line); border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--dk-ink); }
.dk-import-btn:hover { border-color: var(--dk-accent); color: var(--dk-accent); }
.dk-import-note { font-size: 12.5px; color: var(--dk-ink-3); }
#dk-import-status { font-size: 12.5px; font-weight: 600; }

.dk-add-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; background: var(--dk-accent-soft); border: none; color: var(--dk-accent); border-radius: 8px; padding: 9px 15px; font-size: 13px; font-weight: 650; cursor: pointer; }
.dk-add-btn:hover { background: #e9ddf7; }

.dk-msg-grid { display: grid; gap: 14px; }
.dk-msg-item label { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.dk-msg-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; color: #fff; font-weight: 700; font-size: 12px; }

.dk-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 5px; vertical-align: middle; border: 1px solid rgba(0,0,0,.1); }

/* barras de resultado (detalle) */
.dk-bars { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 4px; }
.dk-bar-row { display: flex; align-items: center; gap: 14px; }
.dk-bar-key { width: 130px; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.dk-bar-track { flex: 1; height: 12px; background: var(--dk-line-2); border-radius: 6px; overflow: hidden; }
.dk-bar-fill { height: 100%; border-radius: 6px; }
.dk-bar-pct { width: 48px; text-align: right; font-size: 13px; font-weight: 650; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .dk-metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 782px) {
	.dk-app { padding-right: 12px; }
	.dk-metrics { grid-template-columns: repeat(2, 1fr); }
	.dk-head { flex-direction: column; align-items: flex-start; }
	.dk-search { margin-left: 0; width: 100%; }
	.dk-search input { flex: 1; min-width: 0; width: 100%; }
	.dk-table thead { display: none; }
	.dk-table tbody td { display: block; padding: 8px 16px; border: none; }
	.dk-table tbody tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--dk-line); }
	.dk-actions { text-align: left; padding-top: 12px !important; }
	.dk-ico { margin-left: 0; margin-right: 6px; }
}

/* ==========================================================================
   Dashboard en frontend vía shortcode [disckey_dashboard]
   Reutiliza TODO el sistema de diseño del admin; solo ajusta el contenedor
   para que se centre y no dependa del menú lateral de wp-admin.
   ========================================================================== */
.disckey-frontend-wrap {
	background: #f0f0f1;
	padding: 32px 20px 60px;
	min-height: 100vh;
	box-sizing: border-box;
}
.disckey-frontend-wrap .disckey-app {
	margin: 0 auto;
	padding: 0;
	max-width: 1180px;
}
