/* ====================================================================
   BLOG / AUTH / EDITOR — estilos compartidos
   Reutiliza las variables y tokens definidos en main.css
   ==================================================================== */

/* ── Empuja el contenido bajo el nav fijo ── */
.page-offset {
  padding-top: 76px;
}

/* ── HERO DEL BLOG (listado) ── */
.blog-hero {
  position: relative;
  overflow: hidden;
  padding: 116px 5% 70px;
  background: radial-gradient(ellipse 85% 70% at 78% 12%, #16315E 0%, var(--blue-deep) 48%, var(--blue-deep2) 100%);
  color: #fff;
}

.blog-hero .hero-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.05;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 35%, #000 70%, transparent);
}

.blog-hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.blog-hero-content .section-label {
  color: #FF6166;
}

.blog-hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 14px;
}

.blog-hero p {
  color: var(--muted-dark);
  font-size: 1.1rem;
  max-width: 540px;
}

/* ── LISTADO / GRID DE NOTICIAS ── */
.blog-list {
  padding: 64px 5% 120px;
  background: var(--mist);
}

.blog-list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 36px;
}

.blog-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 260px;
  flex: 1;
  max-width: 360px;
}

.blog-search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--body);
  font-size: 0.9rem;
  width: 100%;
  color: var(--ink);
}

.blog-search svg {
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.blog-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.blog-grid.featured-row .blog-card:first-child {
  grid-column: span 2;
  grid-row: span 1;
}

.blog-grid.featured-row .blog-card:first-child .blog-card-img {
  aspect-ratio: 16/9;
}

.blog-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue);
  box-shadow: 0 16px 40px rgba(21, 35, 61, 0.08);
}

.blog-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--blue-deep);
  overflow: hidden;
  position: relative;
}

.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-card-img .blog-tag-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 100px;
  background: var(--red);
  color: #fff;
}

.blog-card-body {
  padding: 22px 22px 26px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 10px;
}

.blog-card-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--ink);
}

.blog-card-excerpt {
  color: var(--ink-soft);
  font-size: 0.875rem;
  line-height: 1.7;
  flex: 1;
}

.blog-card-readmore {
  margin-top: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.blog-card-readmore svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.blog-card:hover .blog-card-readmore svg {
  transform: translateX(3px);
}

.blog-empty,
.blog-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

@media (max-width:1100px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-grid.featured-row .blog-card:first-child {
    grid-column: span 2;
  }
}

@media (max-width:640px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-grid.featured-row .blog-card:first-child {
    grid-column: span 1;
  }

  .blog-list-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .blog-search {
    max-width: none;
  }
}

/* ── PÁGINA DE ARTÍCULO ── */
.post-header {
  padding: 116px 5% 50px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.post-header-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
}

.post-meta-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 14px;
  display: block;
}

.post-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 22px;
  color: var(--ink);
}

.post-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.post-author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--display);
  flex-shrink: 0;
  overflow: hidden;
}

.post-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-author-text {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.post-author-text strong {
  color: var(--ink);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-cover {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--blue-deep);
  border: 1px solid var(--line);
}

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

@media (max-width:900px) {
  .post-header-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .post-cover {
    order: -1;
    aspect-ratio: 16/9;
  }
}

/* ── CUERPO DEL ARTÍCULO (HTML enriquecido) ── */
.post-body {
  padding: 56px 5% 110px;
}

.post-body-inner {
  max-width: 760px;
  margin: 0 auto;
}
.post-body #postContent,
.post-content,
.article-content {
  text-align: justify;
  text-justify: inter-word;
}

.post-body #postContent p,
.post-content p,
.article-content p {
  text-align: justify;
  line-height: 1.8;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  margin-bottom: 28px;
}

.post-back svg {
  width: 16px;
  height: 16px;
  transform: rotate(180deg);
}

/* Tipografía del contenido enriquecido (Quill output) */
.prose {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.85;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 36px 0 16px;
  color: var(--ink);
}

.prose h1 {
  font-size: 1.9rem;
}

.prose h2 {
  font-size: 1.55rem;
}

.prose h3 {
  font-size: 1.25rem;
}

.prose p {
  margin-bottom: 20px;
}

.prose a {
  color: var(--blue);
  text-decoration: underline;
}

.prose strong {
  font-weight: 700;
}

.prose ul,
.prose ol {
  margin: 0 0 20px 1.4em;
}

.prose li {
  margin-bottom: 8px;
}

.prose blockquote {
  border-left: 3px solid var(--red);
  padding: 4px 0 4px 20px;
  margin: 28px 0;
  color: var(--ink-soft);
  font-style: italic;
}

.prose img {
  max-width: 100%;
  border-radius: 10px;
  margin: 28px 0;
  display: block;
}

.prose pre,
.prose code {
  font-family: var(--mono);
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.prose code {
  padding: 2px 6px;
  font-size: 0.88em;
}

.prose pre {
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.prose pre code {
  border: none;
  padding: 0;
  background: none;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

/* ── AUTH (login / registro) ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 116px 5% 60px;
  background: var(--mist);
}

.auth-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 40px rgba(21, 35, 61, 0.06);
}

.auth-card h1 {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--ink);
}

.auth-card p.auth-sub {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.15s;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--blue);
}

.form-field textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--body);
}

.btn-block {
  width: 100%;
  display: flex;
  justify-content: center;
}

.form-msg {
  margin-top: 16px;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 8px;
  display: none;
}

.form-msg.show {
  display: block;
}

.form-msg.error {
  background: rgba(220, 34, 39, 0.08);
  border: 1px solid rgba(220, 34, 39, 0.2);
  color: var(--red);
}

.form-msg.success {
  background: rgba(36, 85, 164, 0.08);
  border: 1px solid rgba(36, 85, 164, 0.2);
  color: var(--blue);
}

.auth-foot {
  margin-top: 22px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

.auth-foot a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

/* ── DASHBOARD ── */
.dash-wrap {
  padding: 110px 5% 100px;
  min-height: 100vh;
  background: var(--mist);
}

.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.dash-table {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.dash-row {
  display: grid;
  grid-template-columns: 1fr 140px 130px 160px;
  gap: 14px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.dash-row:last-child {
  border-bottom: none;
}

.dash-row.head {
  background: var(--mist);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dash-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.92rem;
}

.dash-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  display: inline-flex;
  width: fit-content;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-status.published {
  background: rgba(36, 85, 164, 0.08);
  color: var(--blue);
  border: 1px solid rgba(36, 85, 164, 0.2);
}

.dash-status.draft {
  background: var(--mist);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.dash-row-actions {
  display: flex;
  gap: 10px;
}

.btn-small {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-small:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-small.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

@media (max-width:760px) {
  .dash-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dash-row.head {
    display: none;
  }
}

/* ── EDITOR DE NOTICIAS ── */
.editor-wrap {
  padding: 110px 5% 100px;
  background: var(--mist);
  min-height: 100vh;
}

.editor-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px;
  max-width: 860px;
  margin: 0 auto;
}

.editor-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width:640px) {
  .editor-grid-2 {
    grid-template-columns: 1fr;
  }
}

#editorContent {
  background: var(--paper);
  border-radius: 0 0 8px 8px;
}

.ql-toolbar.ql-snow {
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  font-family: var(--body);
}

.ql-container.ql-snow {
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  min-height: 280px;
  font-family: var(--body);
  font-size: 0.95rem;
}

/* ── NAV: estado de sesión ── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.nav-link-plain {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-link-plain:hover {
  color: var(--ink);
}

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.dark {
  border-color: var(--line);
  border-top-color: var(--blue);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── CKEDITOR 5 ── */
.ck-editor__editable_inline {
  min-height: 280px;
  font-family: var(--body);
  color: var(--ink);
}

.ck.ck-editor {
  width: 100%;
}

.ck.ck-toolbar,
.ck.ck-editor__main > .ck-editor__editable {
  border-color: var(--line) !important;
}

.ck.ck-editor__main > .ck-editor__editable {
  border-radius: 0 0 8px 8px !important;
}

/* Tablas en editor y en detalle de noticia */
.ck-content figure.table,
.prose figure.table {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
}

.ck-content figure.table table,
.prose figure.table table,
.ck-content table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: #fff;
}

.ck-content table th,
.ck-content table td,
.prose table th,
.prose table td {
  border: 1px solid #cfd8e3;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 120px;
}

.ck-content table th,
.prose table th {
  background: #f3f6fb;
  color: var(--ink);
  font-weight: 700;
}

.ck-content table td,
.prose table td {
  color: var(--ink);
}

/* Imágenes generadas por CKEditor */
.prose figure.image {
  margin: 28px 0;
}

.prose figure.image img,
.ck-content figure.image img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
}

.prose figure.image figcaption,
.ck-content figure.image figcaption {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 8px;
}
