/* ============================================================
   JKTORNEL CONTIGO — admin.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --blue: #142c40;
  --blue-deep: #0d1e2d;
  --gold: #bc974f;
  --gold-light: #d4af6a;
  --white: #ffffff;
  --ink: #172331;
  --muted: #667282;
  --line: #e5ebf0;
  --surface: #f5f7fa;
  --danger: #a92121;
  --success: #247246;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(20, 44, 64, 0.04), 0 4px 20px rgba(20, 44, 64, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 44, 64, 0.06), 0 16px 48px rgba(20, 44, 64, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: inherit;
}

/* ── Login ───────────────────────────────────────── */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%);
  background-image:
    linear-gradient(135deg, var(--blue) 0%, var(--blue-deep) 100%),
    radial-gradient(circle at 70% 30%, rgba(188, 151, 79, 0.08) 0%, transparent 50%);
}

.login-shell {
  width: min(440px, calc(100% - 28px));
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  border-top: 3px solid var(--gold);
  background: var(--white);
  box-shadow: var(--shadow-md);
  padding: 40px;
}

.login-brand {
  color: var(--blue);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.login-card h1 {
  margin: 14px 0 28px;
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-card form {
  display: grid;
  gap: 18px;
}

/* ── Admin layout ────────────────────────────────── */

.admin-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px 1fr;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: var(--white);
  padding: 28px 20px;
  overflow-y: auto;
}

.admin-brand {
  display: block;
  margin-bottom: 32px;
  color: var(--white);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  padding: 0 8px;
}

.admin-sidebar nav {
  display: grid;
  gap: 4px;
}

.admin-sidebar nav a {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease, padding-left 160ms ease;
  border-left: 2px solid transparent;
}

.admin-sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  padding-left: 18px;
}

.admin-sidebar nav a.is-active {
  background: rgba(188, 151, 79, 0.14);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.admin-main {
  padding: 36px 40px;
  overflow-x: hidden;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.admin-topbar h1 {
  margin: 0;
  color: var(--blue);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── Tarjetas métricas ───────────────────────────── */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--blue);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* ── Panel general ───────────────────────────────── */

.admin-panel,
.message-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.admin-panel {
  padding: 28px;
  margin-bottom: 24px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.panel-heading h2,
.admin-panel h2 {
  margin: 0;
  color: var(--blue);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Formularios ─────────────────────────────────── */

.post-form {
  display: grid;
  gap: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--blue);
  font-weight: 700;
  font-size: 0.88rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.93rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
  border-color: rgba(20, 44, 64, 0.22);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(188, 151, 79, 0.12);
}

/* ── Botones admin ───────────────────────────────── */

button,
.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: var(--white);
  padding: 10px 18px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  letter-spacing: 0.01em;
}

button:hover,
.admin-button:hover {
  transform: translateY(-1px);
  background: var(--gold);
  box-shadow: 0 8px 24px rgba(188, 151, 79, 0.25);
}

button:active,
.admin-button:active {
  transform: scale(0.97);
  transition-duration: 60ms;
}

.admin-button.secondary {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--line);
  box-shadow: none;
}

.admin-button.secondary:hover {
  background: var(--surface);
  border-color: rgba(20, 44, 64, 0.2);
  box-shadow: var(--shadow-sm);
}

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

/* ── Alertas ─────────────────────────────────────── */

.admin-alert {
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-alert.success {
  background: #ecf8f2;
  color: var(--success);
  border-left: 3px solid #2ecc71;
}

.admin-alert.error {
  background: #fff1f1;
  color: var(--danger);
  border-left: 3px solid #e74c3c;
}

/* ── Tabla ───────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--surface);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover td {
  background: rgba(20, 44, 64, 0.025);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-actions a,
.table-actions button {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 7px;
}

.table-actions button {
  background: var(--danger);
}

.table-actions button:hover {
  background: #8a1919;
}

/* ── Badges de estado ────────────────────────────── */

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status.published {
  background: #e8f8ef;
  color: var(--success);
}

.status.draft {
  background: #fff8e6;
  color: #7d5a10;
}

/* ── Form grid ───────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ── Quill editor ────────────────────────────────── */

.quill-editor {
  min-height: 260px;
  background: var(--white);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ── Mensajes ────────────────────────────────────── */

.message-list {
  display: grid;
  gap: 22px;
}

.message-card {
  padding: 28px 30px;
  transition: box-shadow 200ms ease;
}

.message-card:hover {
  box-shadow: var(--shadow-md);
}

.message-card.new {
  border-left: 3px solid var(--gold);
}

.message-card header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.message-card header > div {
  min-width: 0;
}

.message-card h3,
.message-card p {
  margin: 0 0 6px;
}

.message-card h3 {
  color: var(--blue);
  font-size: 0.98rem;
  font-weight: 700;
}

.message-card header span {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.message-body {
  max-width: 96ch;
  color: var(--ink);
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-card footer.table-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ── Responsive 900px ────────────────────────────── */

@media (max-width: 900px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    padding: 20px;
  }

  .admin-sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-main {
    padding: 24px 20px;
  }

  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive 560px ────────────────────────────── */

@media (max-width: 560px) {
  .admin-main {
    padding: 18px;
  }

  .admin-sidebar nav,
  .panel-heading {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .message-card header {
    flex-direction: column;
    gap: 8px;
  }

  .message-card header span {
    text-align: left;
    white-space: normal;
  }

  .admin-button,
  button {
    width: 100%;
  }
}
