/* =====================================================================
   Panel admin Kino Ranch — paleta navy + cobre del sitio Astro.
   ===================================================================== */

:root {
  --color-primary: #062233;          /* navy */
  --color-primary-dark: #03141f;
  --color-accent: #CE782B;            /* cobre / naranja Kino Ranch */
  --color-accent-dark: #b86620;
  --color-accent-light: #fcac54;
  --color-surface: #F0EFE6;           /* crema del sitio */
  --color-surface-alt: #F5F5F5;
  --color-white: #FFFFFF;
  --color-text: #3A3A3A;
  --color-text-soft: #7A7A7A;
  --color-border: #D8D8D8;
  --color-ok: #1c7c3a;
  --color-warn: #c98b00;
  --color-err: #c8462c;
  --radius: 0px;                      /* Kino Ranch usa esquinas rectas */
  --radius-sm: 0px;
  --shadow: 0 4px 24px rgba(6, 34, 51, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-surface);
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 60px;
  background: var(--color-primary); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar__brand { display: flex; align-items: center; line-height: 1; color: #fff; text-decoration: none; }
.topbar__logo { height: 36px; width: auto; display: block; }
.topbar__user { display: flex; align-items: center; gap: 16px; color: rgba(255,255,255,0.86); }
.topbar__logout { color: rgba(255,255,255,0.86); font-size: 0.9rem; }
.topbar__logout:hover { color: var(--color-accent); }

/* ===== Layout ===== */
.layout {
  display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px);
}
.layout--noaside {
  /* En páginas sin sidebar (login), una sola columna que ocupa todo */
  grid-template-columns: 1fr;
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
.sidebar {
  background: #fff; border-right: 1px solid var(--color-border);
  padding: 16px 0; display: flex; flex-direction: column; justify-content: space-between;
}
.sidebar nav { display: flex; flex-direction: column; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; color: var(--color-text); border-left: 3px solid transparent;
  font-weight: 500;
}
.nav-link:hover { background: var(--color-surface); text-decoration: none; }
.nav-link.is-active {
  background: var(--color-surface);
  border-left-color: var(--color-accent);
  color: var(--color-primary); font-weight: 600;
}
.badge {
  background: var(--color-accent); color: #fff; font-size: 0.75rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.badge--ok { background: var(--color-ok); }

/* Editor de promoción */
.promo-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 14px;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}
.checkbox-line input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.note { color: var(--color-text-soft); font-size: 0.9rem; margin-top: 16px; }

/* Dashboard del panel */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.dashboard-card {
  display: block;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(6, 34, 51, 0.12);
  text-decoration: none;
}
.dashboard-card h3 {
  font-size: 1.1rem;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.status { margin: 8px 0 4px; font-weight: 600; }
.status--ok { color: var(--color-ok); }
.status--off { color: var(--color-text-soft); }
.status--info { color: var(--color-accent); }
.status-sub { color: var(--color-text-soft); font-size: 0.9rem; margin: 0; }
.sidebar__foot { padding: 16px 20px; border-top: 1px solid var(--color-border); }

.content { padding: 32px 32px 64px; max-width: 1200px; width: 100%; }
@media (max-width: 600px) { .content { padding: 20px; } }

/* ===== Tipografía ===== */
h1 { font-size: 1.75rem; color: var(--color-primary); margin-bottom: 8px; }
h2 { font-size: 1.25rem; color: var(--color-primary); margin: 24px 0 12px; }
p  { margin-bottom: 12px; }
.lead { color: var(--color-text-soft); max-width: 70ch; margin-bottom: 24px; }

/* ===== Flash ===== */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; }
.flash--ok    { background: #e8f5ec; color: var(--color-ok); border-left: 4px solid var(--color-ok); }
.flash--warn  { background: #fff5e0; color: var(--color-warn); border-left: 4px solid var(--color-warn); }
.flash--error { background: #fde9e3; color: var(--color-err); border-left: 4px solid var(--color-err); }

/* ===== Cards / paneles ===== */
.card {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 24px;
}

/* ===== Formularios ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; color: var(--color-primary); font-size: 0.95rem; }
.field .hint { font-size: 0.85rem; color: var(--color-text-soft); }
.field input, .field textarea, .field select {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: #fff; color: var(--color-text); width: 100%; max-width: 480px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 91, 0.15);
}
.field textarea { min-height: 100px; max-width: 720px; }

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 200px; margin-bottom: 0; }

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; font-weight: 600; font-size: 0.95rem;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  cursor: pointer; transition: all 0.15s; min-height: 40px;
}
.btn--primary { background: var(--color-accent); color: #fff; }
.btn--primary:hover { background: var(--color-accent-dark); text-decoration: none; }
.btn--secondary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--secondary:hover { background: var(--color-primary); color: #fff; text-decoration: none; }
.btn--ghost { background: transparent; color: var(--color-text-soft); }
.btn--ghost:hover { color: var(--color-primary); text-decoration: none; }
.btn--danger { background: transparent; color: var(--color-err); border-color: var(--color-err); }
.btn--danger:hover { background: var(--color-err); color: #fff; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ===== Tabla bandeja ===== */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--color-border); }
th { background: var(--color-surface); font-weight: 600; color: var(--color-primary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
tr.is-unread td { font-weight: 600; }
tr.is-unread td:first-child::before { content: '●'; color: var(--color-accent); margin-right: 6px; }
tr:hover { background: var(--color-surface); cursor: pointer; }
td a { color: inherit; display: block; }
td a:hover { text-decoration: none; }

/* ===== Filtros ===== */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin-bottom: 0; }
.filters input, .filters select { min-width: 0; max-width: 240px; }

/* ===== Paginación ===== */
.pagination { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: #fff; color: var(--color-text);
}
.pagination a:hover { background: var(--color-surface); text-decoration: none; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination .disabled { color: var(--color-text-soft); }

/* ===== Vista detalle ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.meta-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.meta-list li { font-size: 0.9rem; }
.meta-list strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-soft); margin-bottom: 2px; }
.mensaje-box {
  background: var(--color-surface); padding: 16px; border-radius: var(--radius-sm);
  border-left: 4px solid var(--color-accent); white-space: pre-wrap; word-wrap: break-word;
}

/* ===== Login ===== */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 24px 20px;
  background:
    radial-gradient(ellipse at top, rgba(27, 58, 91, 0.06), transparent 60%),
    var(--color-surface);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(20, 44, 69, 0.12), 0 2px 6px rgba(20, 44, 69, 0.06);
  padding: 36px 32px 32px;
  max-width: 380px;
  width: 100%;
  border: 1px solid rgba(20, 44, 69, 0.05);
}
.login-card__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2025;
  margin: -36px -32px 24px;
  padding: 28px 24px;
  border-radius: 12px 12px 0 0;
}
.login-card__logo img {
  height: 56px;
  width: auto;
  display: block;
}
.login-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 6px;
}
.login-card .lead {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Inputs y botón específicos del login */
.login-card .field { margin-bottom: 16px; }
.login-card .field label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-soft);
  font-weight: 600;
}
.login-card .field input {
  max-width: none;
  padding: 12px 14px;
  font-size: 0.98rem;
  border-radius: 8px;
  border-color: #d8d4cc;
}
.login-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  font-size: 1rem;
  padding: 12px 18px;
  min-height: 46px;
}

/* ===== Code chips ===== */
code, .url-chip {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--color-surface); padding: 2px 8px; border-radius: 4px; font-size: 0.9em;
}
.url-chip { display: inline-block; word-break: break-all; }

/* ===== Estado SEO ===== */
.seo-ok    { color: var(--color-ok); font-weight: 600; }
.seo-warn  { color: var(--color-warn); font-weight: 600; }
.seo-err   { color: var(--color-err); font-weight: 600; }

/* ===== Auditor SEO: lista de cards ===== */
.seo-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.seo-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
}
.seo-item--ok   { border-left-color: var(--color-ok); }
.seo-item--warn { border-left-color: var(--color-warn); }
.seo-item--err  { border-left-color: var(--color-err); }

.seo-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.seo-item__url {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.seo-item__status { font-size: 1.2rem; line-height: 1; }
.seo-item__url code {
  font-size: 1rem;
  background: var(--color-surface);
  padding: 4px 10px;
  border-radius: 4px;
}
.seo-item__http {
  font-size: 0.8rem;
  color: var(--color-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.seo-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}
.seo-field {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 700px) {
  .seo-field { grid-template-columns: 1fr; gap: 4px; }
}
.seo-field dt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.seo-field__label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-soft);
  font-size: 0.75rem;
}
.seo-len {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--color-surface);
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}
.seo-len.seo-ok   { background: rgba(28, 124, 58, 0.12); }
.seo-len.seo-warn { background: rgba(201, 139, 0, 0.14); }
.seo-len.seo-err  { background: rgba(200, 70, 44, 0.12); }

.seo-field dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.seo-field dd em {
  color: var(--color-text-soft);
  font-style: italic;
}

/* ===== Pasos numerados (tutorial GSC) ===== */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
  counter-increment: step;
  display: flex; gap: 16px; padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step);
  flex: 0 0 32px; height: 32px; background: var(--color-accent); color: #fff;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
}
