/* ══════════════════════════════════════════════════════════════════════
   PANEL DE ADMINISTRACIÓN — Black Embassy
   Archivo: ASSETS/css/admin.css
   ══════════════════════════════════════════════════════════════════════

   ¿QUÉ HAY EN ESTE ARCHIVO?
   -------------------------
   1. Pantalla de inicio de sesión.
   2. Barra superior del panel (usuario, salir, volver al sitio).
   3. Lista de noticias con buscador, filtro y acciones.
   4. Ventana (dialog) para crear o editar una noticia.
   5. Avisos, estados de carga y diseño responsive.

   Los colores y las fuentes vienen de ASSETS/css/style.css. Si cambias
   --gold, --navy o --accent allí, este panel se actualiza solo.

   NOTA: este panel es solo para administradores. La seguridad real
   NO está en el CSS ni en el JS: está en las políticas RLS de
   Supabase (ver docs/supabase-setup.sql).
   ══════════════════════════════════════════════════════════════════════ */

/* ── Base de la página ──────────────────────────────────────────── */

body.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 55% 45% at 12% 0%, rgba(91, 180, 229, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 50% at 92% 100%, rgba(228, 184, 68, 0.1), transparent 62%),
    var(--navy-deep);
  color: var(--text);
}

.admin-page [hidden] { display: none !important; }

.admin-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

/* ── Barra superior ─────────────────────────────────────────────── */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(228, 184, 68, 0.18);
  background: rgba(6, 13, 24, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 10px 0;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.admin-brand-text { min-width: 0; }

.admin-brand-text strong {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  color: var(--white);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-brand-text span {
  display: block;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 240px;
}

.admin-user i { color: var(--accent); }

.admin-user span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.admin-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-btn--gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--navy-deep);
  box-shadow: 0 10px 26px rgba(228, 184, 68, 0.22);
}

.admin-btn--gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(228, 184, 68, 0.34);
}

.admin-btn--ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.admin-btn--ghost:hover {
  border-color: rgba(228, 184, 68, 0.5);
  background: rgba(228, 184, 68, 0.1);
  color: var(--white);
}

.admin-btn--danger {
  border-color: rgba(255, 99, 99, 0.4);
  background: rgba(255, 99, 99, 0.08);
  color: #ff9c9c;
}

.admin-btn--danger:hover {
  background: rgba(255, 99, 99, 0.18);
  border-color: rgba(255, 99, 99, 0.7);
}

.admin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.admin-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-icon-btn:hover {
  background: rgba(228, 184, 68, 0.14);
  border-color: rgba(228, 184, 68, 0.5);
  color: var(--gold-light);
}

.admin-icon-btn--danger:hover {
  background: rgba(255, 99, 99, 0.16);
  border-color: rgba(255, 99, 99, 0.55);
  color: #ff9c9c;
}

.admin-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Pantalla de login ─────────────────────────────────────────── */

.login-view {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 72px);
  padding: 56px 0;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  width: min(920px, 100%);
  overflow: hidden;
  border: 1px solid rgba(228, 184, 68, 0.22);
  border-radius: 24px;
  background: rgba(8, 19, 33, 0.72);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 42px 36px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 13, 24, 0.18), rgba(6, 13, 24, 0.92)),
    url("../img/BANNER-EMBAJADA.webp") center / cover no-repeat,
    var(--navy);
}

.login-side::after {
  content: "";
  position: absolute;
  inset: 0;
  border-right: 1px solid rgba(228, 184, 68, 0.16);
  pointer-events: none;
}

.login-side .tag {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  background: rgba(6, 13, 24, 0.7);
}

.login-side h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.1;
}

.login-side p {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 0.9rem;
  max-width: 34ch;
}

.login-form-wrap {
  padding: 42px 38px;
}

.login-form-wrap h2 {
  font-size: 1.7rem;
  margin-bottom: 6px;
}

.login-form-wrap > p {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-field { margin-bottom: 16px; }

.admin-field label,
.admin-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
}

.admin-input,
.admin-textarea,
.admin-select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(6, 13, 24, 0.62);
  color: var(--white);
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.admin-textarea {
  min-height: 110px;
  resize: vertical;
}

.admin-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(6, 13, 24, 0.85);
  box-shadow: 0 0 0 3px rgba(228, 184, 68, 0.14);
}

.admin-input::placeholder,
.admin-textarea::placeholder { color: rgba(143, 168, 190, 0.62); }

.password-wrap { position: relative; }

.password-wrap .admin-input { padding-right: 46px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover { color: var(--gold-light); background: rgba(255, 255, 255, 0.06); }

.login-submit { width: 100%; margin-top: 6px; padding: 12px 18px; }

.login-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-separator::before,
.login-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

/* Mensajes de error / aviso del formulario de login. */
.admin-message {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 0.82rem;
  line-height: 1.55;
  display: none;
}

.admin-message.is-visible { display: block; }

.admin-message.is-error {
  border: 1px solid rgba(255, 99, 99, 0.4);
  background: rgba(255, 99, 99, 0.1);
  color: #ffb3b3;
}

.admin-message.is-ok {
  border: 1px solid rgba(91, 180, 229, 0.4);
  background: rgba(91, 180, 229, 0.1);
  color: #a9dcff;
}

.admin-message.is-info {
  border: 1px solid rgba(228, 184, 68, 0.35);
  background: rgba(228, 184, 68, 0.08);
  color: var(--gold-light);
}

.admin-message a { color: var(--gold-light); text-decoration: underline; }

/* ── Panel: cabecera de sección ────────────────────────────────── */

.dashboard-view {
  /* Deja aire al final para que el personaje guía (fijo abajo) no tape
     la última noticia cuando se llega al final del listado. */
  padding: 40px 0 150px;
}

.dashboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 26px;
}

.dashboard-head h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  line-height: 1.05;
}

.dashboard-head p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.dashboard-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

/* Aviso de modo demostración. */
.admin-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
  padding: 14px 18px;
  border: 1px solid rgba(228, 184, 68, 0.35);
  border-radius: 12px;
  background: rgba(228, 184, 68, 0.08);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.6;
}

.admin-banner i { color: var(--gold); margin-top: 3px; }
.admin-banner strong { color: var(--gold-light); }

/* ── Barra de herramientas ─────────────────────────────────────── */

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.admin-search {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}

.admin-search i {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.admin-search .admin-input { padding-left: 36px; }

.admin-toolbar .admin-select { flex: 0 1 190px; }

.admin-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-count strong { color: var(--gold-light); }

/* ── Lista de noticias ─────────────────────────────────────────── */

.news-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-admin-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.news-admin-item:hover {
  border-color: rgba(228, 184, 68, 0.34);
  background: rgba(228, 184, 68, 0.045);
  transform: translateY(-1px);
}

.news-admin-thumb {
  width: 92px;
  height: 64px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(6, 13, 24, 0.75);
  display: grid;
  place-items: center;
  color: rgba(228, 184, 68, 0.5);
  font-size: 1.15rem;
}

.news-admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-admin-body { min-width: 0; }

.news-admin-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.news-admin-title h3 {
  font-family: "DM Sans", sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-admin-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 0.74rem;
}

.news-admin-meta span { display: inline-flex; align-items: center; gap: 5px; }

.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-pill--published {
  background: rgba(84, 214, 140, 0.14);
  color: #7fe3ac;
  border: 1px solid rgba(84, 214, 140, 0.35);
}

.admin-pill--draft {
  background: rgba(255, 193, 99, 0.12);
  color: #ffcf85;
  border: 1px solid rgba(255, 193, 99, 0.32);
}

.news-admin-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Estado vacío / carga ───────────────────────────────────────── */

.admin-empty {
  padding: 60px 24px;
  border: 1px dashed rgba(228, 184, 68, 0.3);
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.admin-empty i {
  display: block;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 2rem;
  opacity: 0.8;
}

.admin-empty h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.admin-empty p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 20px;
}

.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-loading i { color: var(--gold); font-size: 1.3rem; }

/* ── Editor (dialog) ───────────────────────────────────────────── */

.admin-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(228, 184, 68, 0.26);
  border-radius: 20px;
  background: #081426;
  color: var(--text);
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.admin-dialog::backdrop {
  background: rgba(2, 7, 13, 0.72);
  backdrop-filter: blur(4px);
}

.admin-dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.02);
}

.dialog-head h2 {
  font-size: 1.5rem;
  line-height: 1.1;
}

.dialog-head-close {
  margin-left: auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.dialog-head-close:hover { background: rgba(255, 99, 99, 0.16); color: #ff9c9c; }

.dialog-body {
  padding: 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 26px;
}

.dialog-col { min-width: 0; }

.dialog-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--gold-light);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dialog-section-title i { color: var(--gold); }

.dialog-section + .dialog-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dialog-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

/* Interruptor de publicación. */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(6, 13, 24, 0.5);
}

.switch-row input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; }

.switch-row label { font-size: 0.82rem; font-weight: 600; color: var(--text); cursor: pointer; }

.switch-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
}

/* Zona de subida de archivos. */
.upload-field {
  padding: 12px;
  border: 1px dashed rgba(228, 184, 68, 0.32);
  border-radius: 10px;
  background: rgba(6, 13, 24, 0.45);
}

.upload-field .admin-label { margin-bottom: 8px; }

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.upload-row .admin-input { flex: 1 1 180px; min-width: 0; }

/* El input file nativo es difícil de estilizar: lo ocultamos y usamos
   un botón <label> que hace la misma función. */
.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.upload-file-btn:hover {
  background: rgba(228, 184, 68, 0.12);
  border-color: rgba(228, 184, 68, 0.45);
  color: var(--gold-light);
}

.upload-preview {
  display: none;
  position: relative;
  margin-top: 10px;
  width: 100%;
  max-width: 280px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(6, 13, 24, 0.7);
}

.upload-preview.is-visible { display: block; }

.upload-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.upload-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(6, 13, 24, 0.82);
  color: #ff9c9c;
  cursor: pointer;
}

.upload-preview-remove:hover { background: rgba(255, 99, 99, 0.9); color: #fff; }

/* Estado de subida. */
.upload-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.72rem;
}

.upload-status i { color: var(--gold); }

/* Traducciones plegables. */
.dialog details {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 0 14px;
}

.dialog details + details { margin-top: 10px; }

.dialog summary {
  padding: 13px 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog summary::-webkit-details-marker { display: none; }

.dialog summary::after {
  content: "\\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 0.66rem;
  color: var(--gold);
  transition: transform 0.2s ease;
}

.dialog details[open] summary::after { transform: rotate(180deg); }

.dialog details .admin-field:last-child { margin-bottom: 14px; }

/* Pie del diálogo. */
.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.02);
}

.dialog-foot .admin-message { margin-top: 0; flex: 1 1 100%; }

.dialog-foot-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* ── Aviso flotante (toast) ────────────────────────────────────── */

.admin-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2000;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid rgba(228, 184, 68, 0.4);
  border-radius: 12px;
  background: rgba(8, 19, 33, 0.97);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.5;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.admin-toast.is-visible { opacity: 1; transform: none; }

.admin-toast.is-error { border-color: rgba(255, 99, 99, 0.5); }
.admin-toast.is-ok { border-color: rgba(84, 214, 140, 0.5); }

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-side { min-height: 190px; padding: 30px; }
  .login-side p { max-width: none; }
  .login-form-wrap { padding: 32px 26px; }
  .dialog-body { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 680px) {
  .admin-shell { width: calc(100% - 24px); }

  /* En móvil todos los controles miden al menos 44 px de alto: son
     cómodos de pulsar con el dedo y evitan toques accidentales. */
  .admin-btn { min-height: 44px; }
  .admin-icon-btn { width: 44px; height: 44px; font-size: 0.95rem; }
  .upload-file-btn { min-height: 46px; }

  .admin-header-inner { min-height: 64px; gap: 10px; }
  .admin-brand img { width: 34px; height: 34px; }
  .admin-brand-text strong { font-size: 1.1rem; }
  .admin-brand-text span { font-size: 0.58rem; }
  .admin-user { display: none; }
  .admin-header-actions .admin-btn span { display: none; }
  .admin-header-actions .admin-btn { padding: 9px 11px; }

  .dashboard-view { padding: 26px 0 140px; }
  .dashboard-head-actions { width: 100%; margin-left: 0; gap: 8px; }
  .dashboard-head-actions .admin-btn { flex: 1 1 0; min-width: 0; }

  .admin-toolbar { padding: 12px; }
  .admin-toolbar .admin-select { flex: 1 1 100%; }
  .admin-count { margin-left: 0; }

  .news-admin-item {
    grid-template-columns: 68px minmax(0, 1fr);
    grid-template-areas:
      "thumb body"
      "actions actions";
    gap: 12px;
    padding: 12px;
  }

  .news-admin-thumb { grid-area: thumb; width: 68px; height: 52px; }
  .news-admin-body { grid-area: body; }
  .news-admin-actions { grid-area: actions; justify-content: flex-end; gap: 8px; }

  .dialog-head { padding: 16px 18px; }
  .dialog-head h2 { font-size: 1.25rem; }
  .dialog-body { padding: 18px; }
  .dialog-foot { padding: 14px 18px; }
  .dialog-foot-actions { width: 100%; }
  .dialog-foot-actions .admin-btn { flex: 1 1 auto; }
  .dialog-grid-2 { grid-template-columns: 1fr; }
  .login-view { padding: 28px 0; }
  .login-form-wrap { padding: 26px 20px; }
  .login-side { display: none; }
}

/* Pantallas muy estrechas (360 px): el botón de actualizar muestra solo
   el icono para que "Nueva noticia" conserve su texto. */
@media (max-width: 400px) {
  #refreshBtn span { display: none; }
  .dashboard-head-actions .admin-btn { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-btn,
  .admin-icon-btn,
  .news-admin-item,
  .admin-toast {
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   APLICACIÓN INSTALABLE (PWA)
   El panel de noticias se puede instalar en el teléfono y abrir como
   una app. Estos estilos visten el aviso de instalación y ajustan la
   pantalla cuando el panel corre sin la barra del navegador.
   ══════════════════════════════════════════════════════════════════════ */

.admin-install-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(1180px, calc(100% - 40px));
  margin: 16px auto 0;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(228, 184, 68, 0.38);
  background:
    linear-gradient(135deg, rgba(228, 184, 68, 0.14), rgba(10, 22, 40, 0.9));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  position: relative;
}

.admin-install-hint img {
  flex: none;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.admin-install-hint p {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.admin-install-hint p strong {
  display: block;
  color: var(--white);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.admin-install-hint .admin-btn {
  flex: none;
  white-space: nowrap;
}

.admin-install-hint__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-install-hint__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

/* Cuando el panel se abre como app (standalone) respetamos el hueco del
   notch y la barra de estado del teléfono. */
@media (display-mode: standalone) {
  body.admin-page {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .admin-install-hint { display: none !important; }
}

/* En móvil el aviso se apila y el botón ocupa todo el ancho. */
@media (max-width: 640px) {
  .admin-install-hint {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 12px;
    padding: 14px;
  }
  .admin-install-hint img { width: 38px; height: 38px; }
  .admin-install-hint p { flex: 1 1 calc(100% - 62px); font-size: 0.78rem; }
  .admin-install-hint .admin-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
  .admin-install-hint__close {
    position: absolute;
    top: 8px;
    right: 8px;
  }
  #installAppBtn span { display: none; }
}
