:root {
  --blue-400: #60a5fa;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-950: #172554;
 
  --slate-900: #04091f; 
  --gray-600: #4b5563;
  --gray-200: #e5e7eb;

  --radius-xl: 1rem;
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
  --shadow-xl: 0 25px 50px rgba(0,0,0,.25);
}

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Source Sans 3', sans-serif;
  }

  /* HERO */
  .info-hero {
    position: relative;
    padding: 120px 20px;
    background: linear-gradient(135deg, #020617, #0a1a3a);
    color: #fff;
    text-align: center;
  }

  .hero-overlay {
    position: absolute;
    inset: 0;
    background: url("https://images.unsplash.com/photo-1554224155-8d04cb21cd6c?auto=format&fit=crop&q=80")
      center/cover;
    opacity: 0.08;
  }

  .hero-content {
    position: relative;
    max-width: 900px;
    margin: auto;
    animation: fadeUp 0.8s ease;
  }

  .hero-content h1 {
    font-size: 3.5rem;
  }

  .hero-content span {
    color: #60a5fa;
  }

  .hero-content p {
    margin: 20px 0 35px;
    color: #cbd5f5;
    font-size: 1.2rem;
  }

  .btn-primary {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 18px 30px;
    border-radius: 16px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.35s;
  }

  .btn-primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(37,99,235,0.35);
  }

  /* GRID */
  .info-section {
    padding: 80px 20px;
    background: #f8fafc;
  }

  .info-grid {
    max-width: 1250px;
    margin: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }

  @media (max-width: 1024px) {
    .info-grid {
      grid-template-columns: repeat(2, 1fr);
    }

  }

  @media (max-width: 600px) {
    .info-grid {
      grid-template-columns: 1fr;
    }

    .post-card {
      min-height: 38vh;
      max-height: 38vh;
    }
  }




  /* CARD */
  .post-card {
    position: relative;
    min-height: 33.5vh;
    max-height: 33.5vh;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    animation: fadeScale 0.4s ease;
  }

  @media (max-width: 480px) {
    .post-card {
      min-height: 38vh;
      max-height: 38vh;
    }
  }

  .post-card:hover {
    transform: translateY(-14px);
    box-shadow: 0 35px 70px rgba(0,0,0,0.18);
  }

  .post-body {
    padding: 25px;
    flex-grow: 1;
    overflow-y: auto;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dbeafe;
    color: #1e40af;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .post-title {
    margin: 16px 0 12px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #020617;
  }

  .post-excerpt {
    white-space: pre-wrap;      /* ⬅️ respeta Enter */
    word-break: break-word;
    line-height: 1.5;
    color: #475569;
    font-size: 0.9rem;
  }


  .post-footer {
    padding: 16px 25px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
  }

  .post-footer span {
    color: #475569;
    font-size: 1rem;
  }

  .post-footer button {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
  }

  .delete-btn {
    color: #94a3b8;
    font-size: 0.9rem;
  }

  .delete-btn:hover {
    color: #ef4444;
  }

  /* MODAL */
  .modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .modal.hidden {
    display: none;
  }

  .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
  }

  .modal-content {
    position: relative;
    background: #fff;
        min-width: 750px;
      max-width: 750px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalUp 0.35s ease;
  }

  .modal-header {
    background: #f1f5f9;
    padding: 25px;
    display: flex;
    justify-content: space-between;
  }


  .modal-header p{
    font-size: 1rem;
  }

  /* ===== CONTENIDO DEL ARTÍCULO ===== */
  .modal-body {
    padding: 36px 42px; /* ⬅️ más aire lateral */
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.8;
    color: #475569;
    font-size: 1.2rem;

    word-wrap: break-word;
    overflow-wrap: break-word;
  }





  .modal-footer {
    display: flex;
    flex-direction: column;   /* ⬅️ uno debajo del otro */
    align-items: flex-start;      /* ⬅️ centrado horizontal */
    gap: 14px;                /* ⬅️ espacio entre texto y botón */
    text-align: center;

  }

.modal-header,
.modal-footer {
  flex-shrink: 0;
}


  .close-btn {
    background: transparent;
    border: none;
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
  
  }

  .fas.fa-times {
    color: #64748b;
    font-size: 1.5rem;
    margin-bottom: 60px;
    
  }

  /* EMPTY */
  .empty-state {
    text-align: center;
    color: #64748b;
  }

  .empty-state i {
    font-size: 4rem;
    opacity: 0.2;
    margin-bottom: 20px;
  }

  .hidden {
    display: none;
  }

  /* ANIMATIONS */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes fadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
  }

  @keyframes modalUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .delete-btn {
    position: absolute;
    top: 16px;
    right: 16px;

    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;

    font-size: 0.95rem;
    padding: 6px;
    border-radius: 8px;

    transition: 
      color 0.25s ease,
      background 0.25s ease,
      transform 0.2s ease;
  }

  .delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    transform: scale(1.1);
  }
  @media (max-width: 768px) {

    .modal-content {
      min-width: 92%;
      max-width: 92%;
      border-radius: 18px;
    }

    .modal-content .modal-header,
    .modal-content .modal-body {
      padding: 20px;
    }

    .modal-card {
      width: 90%;
    }
  }

  @media (max-width: 480px) {

    .modal-card {
      width: 92%;
      border-radius: 16px;
    }

    .modal-footer button {
      width: 100%;
    }

    .diagonal-hint {
      font-size: 10px;
      opacity: 0.75;
    }
  }

 .navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(
    to right,
    var(--slate-900),
    var(--blue-950),
    var(--slate-900)
  );
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
}

/* Container */
.nav-container {
  max-width: 1280px;
  margin: auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo img {
  height: 350px;
  margin-top: 30px;/* controla el tamaño */
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* efecto bonito */
.logo img:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

@media (max-width: 1024px) {
  .logo img {
    height: 10rem;
    transform: scale(1.5);
    pointer-events: none;
  }
}

/* Desktop links */
.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  position: relative;
  color: #e5e7eb;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--blue-400);
}

.nav-link.active {
  color: var(--blue-400);
}

/* Underline animation */
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--blue-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* Mobile menu button */
.menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: white;
  cursor: pointer;
  transition: color 0.3s ease;
}

.menu-btn:hover {
  color: white
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown .arrow {
  font-size: 0.7rem;
  margin-left: 4px;
}

.dropdown-menu {
  position: absolute;
  top: 250%;
  left: 200%;
  transform: translateX(-50%);
  background: #fff;
  min-width: 280px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
  opacity: 0;
  visibility: hidden;
  transform-origin: top;
  transition: all .25s ease;
  z-index: 1000;
}

.dropdown-menu a {
  text-decoration: none;
  display: block;
  padding: 12px 16px;
  color: #1e293b;
  font-size: 0.9rem;
  transition: background .2s, color .2s;
}

/* Preparar el enlace para la línea */
.dropdown-menu a {
  position: relative;
  padding-left: 26px; /* espacio para la línea */
}

/* Línea decorativa oculta */
.dropdown-menu a::before {
  content: "|";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: currentColor; /* mismo color del texto */
  opacity: 0;
  transition: opacity .2s ease;
}

/* Mostrar línea al pasar el mouse */
.dropdown-menu a:hover::before {
  opacity: 1;
}


.dropdown-menu a:hover {
  color: #2563eb;
}

/* Mostrar dropdown */
.nav-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
}

/* ===================== MOBILE MENU ===================== */
.mobile-menu {
  background: #04091f57;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease;
}

.mobile-menu.open {
  max-height: 600px;
}

.mobile-link {
  display: block;
  padding: 0.9rem 1.5rem;
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease, background 0.3s ease;
}

.mobile-link:hover {
  color: var(--blue-400);
  background: rgba(59, 130, 246, 0.08);
}

.mobile-link.active {
  color: var(--blue-400);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .menu-btn {
    display: block;
  }

  .mobile-dropdown .arrow {
    font-size: 0.7rem;
  }
}

.mobile-dropdown {
  display: flex;
  flex-direction: column;
}

.mobile-toggle {
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  padding-left: 12px;
}

.mobile-submenu a {
  margin-left: 20px;
  text-decoration: none;
  display: block;
  padding: 10px;
  font-size: .9rem;
  color: #cbd5f5;
}

.mobile-submenu a:hover {
  color: #fff;
}

/* abierto */
.mobile-dropdown.open .mobile-submenu {
  max-height: 500px;
}

  /* ===================== FOOTER ===================== */
  .footer {
    background: linear-gradient(
      to right,
      var(--slate-900),
      var(--blue-950),
      var(--slate-900)
    );
    color: white;
    margin-top: 4rem;
  }

  .footer-container {
    max-width: 1280px;
    margin: auto;
    padding: 3rem 1.5rem 2rem;
  }

  /* Grid */
  .footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2.5rem;
  }

  /* Titles */
  .footer-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
  }

  .footer-title span {
    color: var(--blue-400);
  }

  .footer-subtitle {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
  }

  /* Text */
  .footer-text {
    color: #d1d5db;
    line-height: 1.6;
    margin-bottom: 1.2rem;
  }

  /* Contact */
  .footer-contact {
    display: grid;
    gap: 0.6rem;
  }

  .contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #d1d5db;
    font-size: 0.95rem;
  }

  .contact-item .icon {
    font-size: 1rem;
  }

  /* Links */
  .footer-links,
  .footer-services {
    list-style: none;
    padding: 0;
  }

  .footer-links li,
  .footer-services li {
    margin-bottom: 0.5rem;
  }

  .footer-links a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
  }

  .footer-links a:hover {
    color: var(--blue-400);
  }
  
  .footer-services a {
  color: #d1d5db;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-services a:hover {
  color: var(--blue-400);
}


  /* Bottom */
  .footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
  }

  /* ===== MODAL AGREGAR ARTÍCULO ===== */

  /* =======================
    MODAL CARD
  ======================= */
  .modal-card {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 18px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.25);
    overflow: hidden;
    overflow: auto;
    animation: modalUp 0.35s ease;
  }

  .modal-card .modal-body {
    padding: 18px;
    flex: 1;                 /* ⬅️ ocupa el espacio disponible */
    overflow-y: auto;        /* ⬅️ scroll interno */
  }

  .field textarea[name="preview"] {
    resize: none;          /* ❌ no se agranda */
    height: 70px;          /* 👈 pequeño */
    max-height: 70px;
    overflow-y: hidden;
  }


  .field textarea {
    scrollbar-width: thin;
    resize: vertical;   /* ⬅️ clave */
    min-height: 140px;
    max-height: 320px;
    overflow-y: auto;
    line-height: 1.5;
  }




  /* =======================
    HEADER
  ======================= */
  .modal-header {
    padding: 20px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
  }

  .modal-header h2 {
    margin-top: 12px;
    font-size: 1.7rem;
    font-weight: bold;
    color: #0f172a;
  }

  /* =======================
    BODY
  ======================= */

  /* =======================
    FIELD
  ======================= */

  .field label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 6px;
    display: block;
  }

  /* =======================
    INPUTS
  ======================= */
  .field input,
  .field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-family: inherit;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    transition: border-color .25s, box-shadow .25s;
  }


  .field input::placeholder,
  .field textarea::placeholder {
    color: #94a3b8;
    font-size: 13px;
  }

  /* Focus elegante */
  .field input:focus,
  .field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  }

  /* =======================
    ERROR
  ======================= */
  .error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 6px;
    min-height: 14px;
  }

  /* =======================
    FOOTER
  ======================= */
  .modal-footer {
    padding: 18px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
  }

  .modal-footer p {
  margin: 0;
  width: 100%;
  text-align: left;
  line-height: 1.5;
  font-style: italic;
  color: #7c8897;
  
}


  /* =======================
    BUTTONS
  ======================= */
  .modal-footer button {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
  }

  .modal-footer .btn-cancel {
    background: #e5e7eb;
    color: #334155;
  }

  .modal-footer .btn-submit {
    background: #2563eb;
    color: #fff;
  }

  .modal-footer button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,.15);
  }

  /* =======================
    TEXTO DIAGONAL
  ======================= */
  .diagonal-hint {
    position: absolute;
    bottom: 12px;
    left: 14px;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    transform: rotate(-6deg);
    pointer-events: none;
  }

  /* =======================
    ANIMACIÓN
  ======================= */
  @keyframes modalUp {
    from {
      opacity: 0;
      transform: translateY(20px) scale(.96);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* =======================
    MODAL RESPONSIVE (FIX)
  ======================= */

  /* Tablet */
  @media (max-width: 768px) {
    .modal-card {
      max-width: 500px;
      width: 92%;
      max-height: 85vh;
    }
  }


  /* Mobile */
  @media (max-width: 480px) {
    .modal {
      padding: 16px; /* 👈 aire alrededor */
    }

    .modal-card {
      width: 100%;
      max-width: 100%;
      max-height: 88vh;   /* 👈 NO 100vh */
      border-radius: 16px;
    }

    .modal-body {
      padding: 16px;
    }

    .modal-footer {
      padding: 14px 16px;
    }

.modal-footer p {
  margin: 0;
  width: 100%;
  text-align: left;
  line-height: 1.5;
}


    .modal-footer button {
      width: 100%;
    }

    .modal-backdrop {
      margin-right: 10px;
    }
  }



  /* ============================
    BADGE CON ICONO (CARD + MODAL)
  ============================ */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    background: #dbeafe;
    color: #1e40af;

    padding: 6px 14px;
    border-radius: 999px;

    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;

    white-space: nowrap;
  }

  /* Badge base (forma, color, texto) */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    background: #dbeafe;
    color: #1e40af;

    padding: 6px 14px;
    border-radius: 999px;

    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  /* 👇 SOLO EL MODAL TIENE ICONO AUTOMÁTICO */
  .modal-header .badge::before {
    content: "\f02b"; /* fa-tag */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.7rem;
  }

  .editor {
    min-height: 160px;
    max-height: 120px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
  }

  .editor:focus {
    outline: none;
    border-color: #2563eb;
  }

  .editor-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
  }

  .editor-toolbar button {
    padding: 6px 10px;
    cursor: pointer;
  }

  @media (max-width: 480px) {
    .modal-footer .btn-primary {
      width: auto;
      align-self: flex-start; /* izquierda */
    }
  }

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #6b7280;
  font-size: 0.85rem;
}

.meta-row i {
  font-size: 0.85rem;
}

#addPostBtn,
#addPostBtn2 {
  display: none;
}

body.admin #addPostBtn,
body.admin #addPostBtn2 {
  display: inline-flex;
}
.post-actions .delete-btn {
  opacity: 0;
  pointer-events: none;
}

body.admin .post-card:hover .delete-btn {
  opacity: 1;
  pointer-events: auto;
}

.admin-only {
  display: none;
}

body.admin .admin-only {
  display: inline-flex;
}

/* =========================
   BOTÓN SALIR ADMIN
========================= */

.admin-only {
  display: none;
}

body.admin .admin-only {
  display: inline-flex;
}

/* Estilo visual */
.admin-only {
  align-items: center;
  gap: 8px;

  border-radius: 12px;

  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;

  font-size: 0.9rem;
  font-weight: 600;

  border: none;
  cursor: pointer;

  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.35);
  transition: 
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

/* Hover */
.admin-only:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 45px rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Active (click) */
.admin-only:active {
  transform: scale(0.96);
}

/* Icono opcional */
.admin-only i {
  font-size: 0.9rem;
}
