/* DentiPedia — estilo compartido de las páginas de administración y de acceso
   (se carga después del <style> propio de cada página y lo sobrescribe). */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --brand-navy: #1a4e8f; --brand-sky: #53d3fa; --brand-sky-ink: #0a76b3; --brand-sky-soft: #e3f6fd; --brand-yellow: #ffe720;
  --primary: #1a4e8f; --accent: #0a85c7; --accent-hover: #086ea6; --danger: #d63c2f; --success: #1e8c4c;
  --bg: #f4f7fb; --surface: #fff; --surface2: #f8fafc; --border: #dde3ed; --text: #1e2a3a; --text-muted: #5f6e82;
  --shadow: 0 1px 3px rgba(26,78,143,0.06), 0 4px 14px rgba(26,78,143,0.06);
  --shadow-lg: 0 10px 30px rgba(26,78,143,0.14);
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background:
    radial-gradient(1000px 360px at 100% -10%, rgba(83,211,250,0.16), transparent 60%),
    radial-gradient(700px 280px at -10% 0%, rgba(255,231,32,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Barra superior con el logo */
.adm-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top));
}
.adm-top-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.adm-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-navy); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.3px; min-height: 44px; }
.adm-brand img { width: 42px; height: 42px; object-fit: contain; }
.adm-brand b { color: var(--brand-sky-ink); font-weight: 800; }
.adm-app-link { font-size: 0.88rem; font-weight: 600; color: var(--accent); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

.wrap { padding: 28px 16px 48px; }
h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
h2 { color: var(--text); font-weight: 700; }
p.subtitle, .subtitle { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }
a.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  color: var(--accent); font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
a.back:hover { text-decoration: underline; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
a.card:hover { border-color: var(--brand-sky); box-shadow: var(--shadow-lg); transform: none; }
.grid .card { display: flex; flex-direction: column; gap: 6px; padding: 20px; }
.card h2 { font-size: 1.02rem; color: var(--text); display: flex; align-items: center; gap: 10px; }
.card p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.45; }
.adm-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-sky-soft); color: var(--brand-sky-ink);
}
.adm-ico svg { width: 20px; height: 20px; }
.adm-ico.y { background: #fff7c2; color: #8a6d00; }
.adm-ico.n { background: #e6edf8; color: var(--brand-navy); }
.adm-ico.r { background: #ffe9e6; color: #c0392b; }
.adm-ico.g { background: #e3f6ec; color: #1e7e4a; }

/* Formularios */
input, select, textarea {
  font-family: inherit; font-size: 1rem; color: var(--text);
  min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(83,211,250,0.25); }
label, .form-group label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* Botones */
button, .btn {
  font-family: inherit; font-weight: 600; font-size: 0.9rem;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.btn-primary, .wrap .btn, form.card > button[type="submit"], .card > form > button[type="submit"] { background: var(--accent); color: #fff; }
.btn-primary:hover, .wrap .btn:hover { background: var(--accent-hover); }
.btn-danger, .btn-purge { background: transparent; color: var(--danger); border: 1px solid #f2c5c0; }
.btn-danger:hover, .btn-purge:hover { background: #fdecea; }
.btn-restore { background: var(--success); color: #fff; }
.btn-restore:hover { background: #18733e; }
.actions button { min-height: 40px; border-radius: 10px; }
button:focus-visible, a:focus-visible, .btn:focus-visible { outline: 3px solid var(--brand-sky); outline-offset: 2px; }

/* Mensajes */
.error { background: #fdecea; color: #b42318; border: 1px solid #f5c6c0; border-radius: 12px; }
.success { background: #e3f6ec; color: #1e6b3d; border: 1px solid #b9e4c9; border-radius: 12px; }

/* Tablas */
table { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th { color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
th, td { border-bottom-color: #edf1f6; }
.card table { width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Papelera y auditoría */
.item { border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.item .name { color: var(--text); overflow-wrap: anywhere; }
.tag { border-radius: 999px; }
.empty { border-radius: 16px; border: 1px dashed var(--border); background: var(--surface); }
.pager a { min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; box-shadow: none; color: var(--accent); font-weight: 600; }
code { font-family: 'JetBrains Mono', monospace; }

/* Diálogo de confirmación propio (reemplaza confirm() del navegador) */
.adm-dialog-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15,30,55,0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.adm-dialog-overlay[hidden] { display: none; }
.adm-dialog {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 24px; text-align: center;
}
.adm-dialog .adm-ico { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px; }
.adm-dialog h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--text); }
.adm-dialog p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; margin-bottom: 18px; text-align: left; }
.adm-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.adm-dialog-actions button { flex: 1 1 130px; }
.adm-dialog .adm-cancel { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.adm-dialog .adm-ok { background: var(--danger); color: #fff; }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .form-row { flex-direction: column; align-items: stretch !important; }
  .form-row .form-group input, .form-row .form-group select { width: 100%; }
  .adm-app-link span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.card { overflow-x: auto; }


/* ===== Modo oscuro (automático o elegido en el menú de usuario de la app) ===== */
:root[data-theme="dark"] { color-scheme: dark;
  --brand-navy: #8fc3ff; --brand-sky-ink: #6fd0f7; --brand-sky-soft: #143347; --primary: #4a86d4;
  --bg: #0f1722; --surface: #172231; --surface2: #1c2a3b; --border: #2b3b52; --text: #e6edf5; --text-muted: #9aabbf;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 14px rgba(0,0,0,0.25); --shadow-lg: 0 10px 30px rgba(0,0,0,0.45); }
:root[data-theme="dark"] .adm-top { background: rgba(23,34,49,0.94); }
:root[data-theme="dark"] body { background: radial-gradient(1000px 360px at 100% -10%, rgba(83,211,250,0.07), transparent 60%), var(--bg); }
:root[data-theme="dark"] table, :root[data-theme="dark"] th, :root[data-theme="dark"] code, :root[data-theme="dark"] .pager a, :root[data-theme="dark"] .audit-filter a { background: var(--surface); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] th { background: var(--surface2); color: var(--text-muted); }
:root[data-theme="dark"] .audit-filter a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .error { background: #3d1d1d; color: #ffb4ab; border-color: #6b2b2b; }
:root[data-theme="dark"] .success { background: #153626; color: #7ddba3; border-color: #275c3b; }
:root[data-theme="dark"] .tag { filter: saturate(0.9) brightness(0.9); }
:root[data-theme="dark"] .adm-ico.y { background: #3a3410; color: #ffe27a; }
:root[data-theme="dark"] .adm-ico.n { background: #1b2c47; color: #8fc3ff; }
:root[data-theme="dark"] .adm-ico.r { background: #3d1d1d; color: #ff9b8f; }
:root[data-theme="dark"] .adm-ico.g { background: #153626; color: #7ddba3; }
:root[data-theme="dark"] .btn-danger, :root[data-theme="dark"] .btn-purge { border-color: #6b2b2b; color: #ff9b8f; }
:root[data-theme="dark"] .btn-danger:hover, :root[data-theme="dark"] .btn-purge:hover { background: #3d1d1d; }
:root[data-theme="dark"] .adm-dialog .adm-cancel { background: var(--surface2); }
:root[data-theme="dark"] ul, :root[data-theme="dark"] .file-list { color: var(--text) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
  --brand-navy: #8fc3ff; --brand-sky-ink: #6fd0f7; --brand-sky-soft: #143347; --primary: #4a86d4;
  --bg: #0f1722; --surface: #172231; --surface2: #1c2a3b; --border: #2b3b52; --text: #e6edf5; --text-muted: #9aabbf;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 14px rgba(0,0,0,0.25); --shadow-lg: 0 10px 30px rgba(0,0,0,0.45); }
:root:not([data-theme="light"]) .adm-top { background: rgba(23,34,49,0.94); }
:root:not([data-theme="light"]) body { background: radial-gradient(1000px 360px at 100% -10%, rgba(83,211,250,0.07), transparent 60%), var(--bg); }
:root:not([data-theme="light"]) table, :root:not([data-theme="light"]) th, :root:not([data-theme="light"]) code, :root:not([data-theme="light"]) .pager a, :root:not([data-theme="light"]) .audit-filter a { background: var(--surface); color: var(--text); border-color: var(--border); }
:root:not([data-theme="light"]) th { background: var(--surface2); color: var(--text-muted); }
:root:not([data-theme="light"]) .audit-filter a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
:root:not([data-theme="light"]) .error { background: #3d1d1d; color: #ffb4ab; border-color: #6b2b2b; }
:root:not([data-theme="light"]) .success { background: #153626; color: #7ddba3; border-color: #275c3b; }
:root:not([data-theme="light"]) .tag { filter: saturate(0.9) brightness(0.9); }
:root:not([data-theme="light"]) .adm-ico.y { background: #3a3410; color: #ffe27a; }
:root:not([data-theme="light"]) .adm-ico.n { background: #1b2c47; color: #8fc3ff; }
:root:not([data-theme="light"]) .adm-ico.r { background: #3d1d1d; color: #ff9b8f; }
:root:not([data-theme="light"]) .adm-ico.g { background: #153626; color: #7ddba3; }
:root:not([data-theme="light"]) .btn-danger, :root:not([data-theme="light"]) .btn-purge { border-color: #6b2b2b; color: #ff9b8f; }
:root:not([data-theme="light"]) .btn-danger:hover, :root:not([data-theme="light"]) .btn-purge:hover { background: #3d1d1d; }
:root:not([data-theme="light"]) .adm-dialog .adm-cancel { background: var(--surface2); }
:root:not([data-theme="light"]) ul, :root:not([data-theme="light"]) .file-list { color: var(--text) !important; }
}
