/* ═══════════════════════════════════════════════════
   KSites/news — Panel Admin CSS
   Mobile-first: diseñado para usarse desde celular
   ═══════════════════════════════════════════════════ */

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

:root {
  --adm-bg:       #f4f5f7;
  --adm-surface:  #ffffff;
  --adm-primary:  #1a1a2e;
  --adm-accent:   #e94560;
  --adm-text:     #1a1a1a;
  --adm-muted:    #6b7280;
  --adm-border:   #e5e7eb;
  --adm-success:  #16a34a;
  --adm-error:    #dc2626;
  --adm-nav-h:    60px;
  --adm-top-h:    48px;
  --adm-radius:   10px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--adm-accent); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── LAYOUT PRINCIPAL ── */
.admin-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.admin-topbar {
  height: var(--adm-top-h);
  background: var(--adm-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title {
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 .5rem;
}
.topbar-site, .topbar-logout {
  color: rgba(255,255,255,.7);
  font-size: 1.1rem;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.topbar-site:hover, .topbar-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── CONTENIDO ── */
.admin-main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--adm-nav-h) + 1rem);
}
.admin-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 0;
}

/* ── NAV INFERIOR ── */
.admin-nav-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--adm-nav-h);
  background: var(--adm-surface);
  border-top: 1px solid var(--adm-border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--adm-muted);
  font-size: .65rem;
  font-weight: 500;
  padding: .4rem .25rem;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item.active { color: var(--adm-accent); }
.nav-item:hover  { color: var(--adm-accent); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: .75rem;
}
.page-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--adm-primary);
}

/* ── ALERTAS ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--adm-radius);
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.alert-success { background: #dcfce7; color: var(--adm-success); }
.alert-error   { background: #fee2e2; color: var(--adm-error); }

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  padding: 1rem .75rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.stat-num  { display: block; font-size: 2rem; font-weight: 700; color: var(--adm-accent); line-height: 1; }
.stat-label{ display: block; font-size: .7rem; color: var(--adm-muted); margin-top: .25rem; }

/* ── SECTION CARD ── */
.section-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  margin-bottom: 1.25rem;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--adm-border);
}
.section-card-header h3 { font-size: .95rem; font-weight: 600; }
.section-card-header a  { font-size: .82rem; color: var(--adm-accent); }

/* ── LIST ITEMS ── */
.list-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-border);
  border-radius: 0;
}
.list-item:first-child  { border-radius: var(--adm-radius) var(--adm-radius) 0 0; }
.list-item:last-child   { border-bottom: none; border-radius: 0 0 var(--adm-radius) var(--adm-radius); }
.list-item:only-child   { border-radius: var(--adm-radius); }
.list-item + .list-item { margin-top: 1px; }

/* Cuando está solo, sin section-card wrapper */
.admin-container > .list-item { border-radius: var(--adm-radius); margin-bottom: 1px; border-bottom: 1px solid var(--adm-border); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-meta { display: block; font-size: .75rem; color: var(--adm-muted); margin-top: .15rem; }
.list-item-actions { display: flex; gap: .35rem; flex-shrink: 0; }

/* ── BADGES ── */
.badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: .35rem;
}
.badge-ok    { background: #dcfce7; color: var(--adm-success); }
.badge-draft { background: #fef9c3; color: #854d0e; }

/* ── BOTONES ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  min-height: 40px;
}
.btn-primary { background: var(--adm-accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-outline { background: transparent; color: var(--adm-accent); border: 1.5px solid var(--adm-accent); }
.btn-outline:hover { background: var(--adm-accent); color: #fff; }
.btn-full { width: 100%; }

.btn-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: .95rem;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  cursor: pointer;
  color: var(--adm-text);
  transition: background .15s;
  text-decoration: none;
}
.btn-icon:hover { background: #e5e7eb; }
.btn-icon-danger { color: var(--adm-error); }
.btn-icon-danger:hover { background: #fee2e2; border-color: #fca5a5; }

/* ── FORMULARIOS ── */
.form-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  padding: 1.25rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  margin-bottom: 1.25rem;
}
.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--adm-muted);
  margin: 1.5rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--adm-border);
}
.form-section-title:first-child { margin-top: 0; }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--adm-muted);
  margin-bottom: .35rem;
}
.form-group label small { font-weight: 400; }
.form-group input[type=text],
.form-group input[type=url],
.form-group input[type=password],
.form-group input[type=number],
.form-group input[type=email],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--adm-border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
  color: var(--adm-text);
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--adm-accent);
  box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}
.form-group textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
.form-group input[type=file] { padding: .4rem; font-size: .82rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.form-group-check { display: flex; align-items: flex-end; padding-bottom: .5rem; }
.check-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
}
.check-label input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--adm-accent); cursor: pointer; }

.form-actions { margin-top: 1.5rem; }
.form-inline { display: flex; gap: .5rem; align-items: center; }
.form-inline label { font-size: .88rem; color: var(--adm-muted); }
.form-inline span  { font-size: .88rem; color: var(--adm-muted); }
.form-inline input[type=number] { width: 60px; padding: .4rem .5rem; text-align: center; }

.thumb-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: .5rem;
  border: 1px solid var(--adm-border);
}

/* ── INLINE FORM (categorías) ── */
.inline-form {
  display: flex;
  gap: .5rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--adm-border);
}
.inline-form input[type=text] {
  flex: 1;
  padding: .55rem .85rem;
  border: 1.5px solid var(--adm-border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
}
.inline-form input:focus { outline: none; border-color: var(--adm-accent); }

/* ── BANNERS ADMIN ── */
.banner-zona-card {
  background: var(--adm-surface);
  border-radius: var(--adm-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  margin-bottom: 1rem;
}
.banner-zona-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .85rem 1rem;
  background: var(--adm-bg);
  border-bottom: 1px solid var(--adm-border);
}
.banner-size-tag {
  font-size: .7rem;
  color: var(--adm-muted);
  background: var(--adm-border);
  padding: .2rem .5rem;
  border-radius: 20px;
}
.banner-zona-body { padding: 1rem; }

.tabs-tipo { margin-bottom: .75rem; }
.radio-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
}
.radio-label input[type=radio] { accent-color: var(--adm-accent); width: 16px; height: 16px; }

/* ── COLOR PICKER ── */
.color-pick { display: flex; align-items: center; gap: .5rem; }
.color-pick input[type=color] { width: 40px; height: 40px; border: none; padding: 2px; border-radius: 6px; cursor: pointer; background: none; }
.color-pick input[type=text] { flex: 1; }

/* ── LOGIN ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--adm-bg);
}
.login-card {
  background: var(--adm-surface);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-logo img { max-height: 50px; margin: 0 auto; }
.login-site-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--adm-primary);
}
.login-card h1 {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: var(--adm-muted);
  margin-bottom: 1.5rem;
}

/* ── DESKTOP adjustments ── */
@media (min-width: 768px) {
  .admin-nav-bottom {
    /* En desktop el nav va a la izquierda */
    top: var(--adm-top-h);
    bottom: 0;
    left: 0;
    right: auto;
    width: 200px;
    height: auto;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid var(--adm-border);
    box-shadow: 2px 0 8px rgba(0,0,0,.05);
    padding: 1rem 0;
    overflow-y: auto;
  }
  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: .65rem;
    padding: .75rem 1.25rem;
    font-size: .85rem;
    border-radius: 0;
  }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-item.active { background: rgba(233,69,96,.08); border-right: 3px solid var(--adm-accent); }

  .admin-main {
    margin-left: 200px;
    padding-bottom: 2rem;
  }
  .admin-container { padding: 1.5rem; }

  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Galería de fotos en notas ── */
.galeria-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
}
.galeria-thumb-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: .5px solid var(--adm-border);
}
.galeria-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.galeria-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,.65);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}
.galeria-del:hover { background: var(--adm-error); }

/* ── Form helpers ── */
.form-hint {
  display: block;
  font-size: .73rem;
  color: var(--adm-muted);
  margin-top: .3rem;
}
.form-optional {
  font-size: .73rem;
  font-weight: 400;
  color: var(--adm-muted);
}
