/* ============================================================
   Identidad visual: "Gaceta cívica"
   ============================================================ */

   :root {
    --tinta: #14192B;
    --tinta-suave: #3B4258;
    --papel: #FBFAF6;
    --papel-panel: #F3F0E7;
    --oro: #B8862E;
    --verde: #2F6E4E;
    --rojo: #A13D3D;
    --linea: #DDD8C8;
    --celeste: #23EFF1;
    --negro-no: #0A0A0A;
    --sans: 'Poppins', -apple-system, 'Inter', Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  }
  
  * {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    font-family: var(--sans);
    font-weight: 400;
    background: var(--papel);
    color: var(--tinta);
    line-height: 1.5;
  }
  
  /* ============================================================
     TIPOGRAFÍA
     ============================================================ */
  
  h1,
  h2,
  h3,
  .marca {
    font-family: var(--sans);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
  }
  
  .pregunta-mercado {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    line-height: 1.35;
  }
  
  a {
    color: inherit;
    text-decoration: none;
  }
  
  /* ============================================================
     CABECERA
     ============================================================ */
  
  .cabecera {
    background: linear-gradient(
      135deg,
      #BFF7F8 0%,
      var(--celeste) 55%,
      #0FD3D6 100%
    );
  
    color: var(--tinta);
    border-bottom: 3px solid var(--tinta);
  }
  
  .cabecera-contenido {
    max-width: 1100px;
    margin: 0 auto;
    padding: 6px 20px;
  
    display: flex;
    align-items: center;
  
    gap: 24px;
  }
  
  /* ============================================================
     MARCA / LOGO
     ============================================================ */
  
  .marca {
    display: flex;
    flex-direction: row;
    align-items: center;
  
    gap: 10px;
  
    margin-right: auto;
  
    text-transform: none;
    letter-spacing: normal;
  
    color: var(--tinta);
  }
  
  /* Cuadro blanco del logo */
  
  .marca-icono {
    width: 64px;
    height: 64px;
  
    background: #fff;
  
    border-radius: 16px;
    padding: 5px;
  
    display: flex;
    align-items: center;
    justify-content: center;
  
    box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
  
    position: relative;
    z-index: 10;
  
    transform: translateY(8px);
  }
  
  .marca-logo {
    width: 100%;
    height: 100%;
  
    object-fit: contain;
    display: block;
  }
  
  /* ============================================================
     NOMBRE DEL SITIO
     ============================================================ */
  
  /*
   * IMPORTANTE:
   * Ahora "entre" y "pilas" quedan uno debajo del otro.
   */
  
  .marca-nombre {
    font-size: 1.3rem;
    font-weight: 800;
  
    white-space: nowrap;
  
    display: flex;
    flex-direction: column;
  
    align-items: flex-start;
    justify-content: center;
  
    line-height: .85;
  
    transform: translateY(16px);
  }
  
  /* "entre" */
  
  .marca-entre {
    display: block;
  
    color: #fff;
  
    -webkit-text-stroke: 1.5px #000;
    paint-order: stroke fill;
  }
  
  /* "pilas" */
  
  .marca-pilas {
    color: #BFF7F8;
  
    -webkit-text-stroke: 1.5px #000;
    paint-order: stroke fill;
  
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 800;
  }

  .marca-entre,
  .marca-pilas {
    -webkit-text-stroke: 2.5px #000;
    paint-order: stroke fill;
    text-shadow: 0 0 1px #000;
  }
  
  /* ============================================================
     NAVEGACIÓN
     ============================================================ */
  
  .nav-principal {
    display: flex;
    gap: 20px;
  }
  
  .nav-principal a {
    opacity: .75;
    padding: 4px 0;
  
    font-weight: 500;
  
    transition:
      color .15s ease,
      opacity .15s ease;
  }
  
  .nav-principal a:hover {
    opacity: 1;
    color: #000;
    font-weight: 700;
  }
  
  .nav-usuario {
    display: flex;
    align-items: center;
  
    gap: 16px;
    margin-left: auto;
  }
  
  .saldo {
    color: var(--tinta);
    font-weight: 700;
  }
  
  .btn-cta {
    background: var(--tinta);
    color: var(--celeste);
  
    padding: 8px 16px;
  
    border-radius: 20px;
  
    font-weight: 600;
  }
  
  /* ============================================================
     MENÚ MÓVIL
     ============================================================ */
  
  .menu-movil {
    display: flex;
    align-items: center;
  
    flex: 1;
    min-width: 0;
  }
  
  .menu-toggle {
    display: none;
  
    background: none;
    border: none;
  
    font-size: 1.5rem;
    line-height: 1;
  
    color: var(--tinta);
  
    cursor: pointer;
  
    padding: 4px 8px;
    margin-left: auto;
  }
  
  /* ============================================================
     LAYOUT GENERAL
     ============================================================ */
  
  .contenedor {
    max-width: 1100px;
  
    margin: 0 auto;
  
    padding: 32px 20px 60px;
  }
  
  .pie {
    border-top: 1px solid var(--linea);
    margin-top: 40px;
  }
  
  .pie-contenido {
    max-width: 1100px;
  
    margin: 0 auto;
    padding: 24px 20px;
  
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  
    gap: 12px;
  
    font-size: .9rem;
    color: var(--tinta-suave);
  }
  
  .pie nav {
    display: flex;
    gap: 16px;
  }
  
  /* ============================================================
     MENSAJES FLASH
     ============================================================ */
  
  .flash {
    padding: 12px 16px;
  
    border-left: 4px solid var(--oro);
  
    margin-bottom: 20px;
  
    background: var(--papel-panel);
  }
  
  .flash-error {
    border-color: var(--rojo);
  }
  
  .flash-exito {
    border-color: var(--verde);
  }
  
  /* ============================================================
     HERO
     ============================================================ */
  
  .hero {
    padding: 10px 0 30px;
  
    border-bottom: 1px solid var(--linea);
  
    margin-bottom: 30px;
  }
  
  .hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
  
    line-height: 1.15;
  
    max-width: 640px;
  
    margin: 0 0 10px;
  }
  
  .hero p {
    max-width: 560px;
    color: var(--tinta-suave);
  }
  
  /* ============================================================
     BLOQUES DE CONTENIDO
     ============================================================ */
  
  .bloques-contenido {
    display: grid;
  
    grid-template-columns:
      repeat(auto-fit, minmax(260px, 1fr));
  
    gap: 20px;
  
    margin-bottom: 34px;
  }
  
  .bloque-contenido {
    border: 1px solid var(--linea);
  
    border-radius: 14px;
  
    overflow: hidden;
  
    background: #fff;
  
    display: flex;
    flex-direction: column;
  }
  
  .bloque-contenido img,
  .bloque-contenido video {
    width: 100%;
  
    max-height: 260px;
  
    object-fit: cover;
  
    display: block;
  }
  
  .bloque-contenido h3,
  .bloque-contenido p,
  .bloque-contenido .boton {
    margin: 10px 16px;
  }
  
  .bloque-contenido h3:first-child,
  .bloque-contenido p:first-child {
    margin-top: 16px;
  }
  
  .bloque-contenido .boton {
    align-self: flex-start;
    margin-bottom: 16px;
  }
  
  .bloque-boton {
    justify-content: center;
  
    text-align: center;
  
    padding: 20px;
  }
  
  .video-embed-wrap {
    position: relative;
  
    width: 100%;
  
    padding-top: 56.25%;
  }
  
  .video-embed-wrap iframe {
    position: absolute;
  
    inset: 0;
  
    width: 100%;
    height: 100%;
  
    border: none;
  }
  
  /* ============================================================
     FILTROS
     ============================================================ */
  
  .filtros {
    display: flex;
  
    gap: 10px;
  
    flex-wrap: wrap;
  
    margin-bottom: 24px;
  }
  
  .filtros a {
    padding: 6px 14px;
  
    border: 1px solid var(--linea);
  
    border-radius: 3px;
  
    font-size: .9rem;
  }
  
  .filtros a.activo {
    background: var(--tinta);
  
    color: var(--papel);
  
    border-color: var(--tinta);
  }
  
  /* ============================================================
     PRECIO SI / NO
     ============================================================ */
  
  .opciones-precio {
    display: flex;
    gap: 10px;
  }
  
  .opcion-precio {
    flex: 1;
  
    text-align: center;
  
    padding: 10px 6px;
  
    border: 1px solid var(--linea);
  
    font-weight: 600;
    font-size: .95rem;
  
    border-radius: 8px;
  }
  
  .opcion-precio.si {
    color: var(--celeste);
  
    border-color: var(--celeste);
  
    background: rgba(35, 239, 241, .08);
  }
  
  .opcion-precio.no {
    color: var(--negro-no);
  
    border-color: var(--negro-no);
  }
  
  .opcion-precio small {
    display: block;
  
    font-weight: 400;
  
    color: var(--tinta-suave);
  
    font-size: .72rem;
  
    margin-top: 2px;
  }
  
  .meta-mercado {
    display: flex;
  
    justify-content: space-between;
  
    font-size: .78rem;
  
    color: var(--tinta-suave);
  
    margin-top: 10px;
  }
  
  /* ============================================================
     LISTA DE MERCADOS
     ============================================================ */
  
  .lista-mercados {
    display: grid;
  
    grid-template-columns:
      repeat(auto-fill, minmax(220px, 1fr));
  
    gap: 16px;
  }
  
  .tarjeta-mercado {
    position: relative;
  
    aspect-ratio: 1 / 1;
  
    overflow: hidden;
  
    border: 1px solid var(--linea);
  
    border-radius: 16px;
  
    background: var(--tinta);
  
    display: block;
  
    color: #fff;
  
    transition: transform .15s ease;
  }
  
  .tarjeta-mercado:hover {
    transform: translateY(-3px);
  }
  
  .tarjeta-imagen {
    position: absolute;
  
    inset: 0;
  
    background-size: cover;
  
    background-position: center;
  
    background-color: var(--tinta);
  }
  
  .tarjeta-imagen.sin-imagen {
    display: flex;
  
    align-items: center;
    justify-content: center;
  
    font-size: 2.6rem;
  
    color: var(--oro);
  
    opacity: .5;
  }
  
  .tarjeta-overlay {
    position: absolute;
  
    inset: 0;
  
    background:
      linear-gradient(
        to top,
        rgba(20, 25, 43, .92) 0%,
        rgba(20, 25, 43, .55) 45%,
        rgba(20, 25, 43, .1) 75%
      );
  }
  
  .tarjeta-contenido {
    position: relative;
  
    z-index: 2;
  
    height: 100%;
  
    display: flex;
  
    flex-direction: column;
  
    justify-content: flex-end;
  
    padding: 14px;
  }
  
  .tarjeta-contenido .categoria {
    font-size: .72rem;
  
    color: var(--oro);
  
    margin-bottom: 6px;
  
    text-transform: none;
  }
  
  .tarjeta-contenido h3 {
    font-size: .95rem;
  
    line-height: 1.3;
  
    margin: 0 0 10px;
  
    color: #fff;
  
    display: -webkit-box;
  
    -webkit-line-clamp: 3;
  
    -webkit-box-orient: vertical;
  
    overflow: hidden;
  }
  
  .tarjeta-contenido .opciones-precio {
    gap: 6px;
  }
  
  .tarjeta-contenido .opcion-precio {
    padding: 6px 4px;
  
    font-size: .82rem;
  
    background: rgba(255, 255, 255, .08);
  
    backdrop-filter: blur(2px);
  }
  
  .tarjeta-contenido .opcion-precio.si {
    color: var(--tinta);
  
    background: var(--celeste);
  
    border-color: var(--celeste);
  
    font-weight: 700;
  }
  
  .tarjeta-contenido .opcion-precio.no {
    color: #fff;
  
    background: var(--negro-no);
  
    border-color: var(--negro-no);
  
    font-weight: 700;
  }
  
  .tarjeta-contenido .opcion-precio small {
    color: rgba(0, 0, 0, .55);
  }
  
  .tarjeta-contenido .opcion-precio.no small {
    color: rgba(255, 255, 255, .65);
  }
  
  .tarjeta-contenido .meta-mercado {
    margin-top: 8px;
  
    color: rgba(255, 255, 255, .7);
  
    font-size: .68rem;
  }
  
  /* ============================================================
     DETALLE DE MERCADO
     ============================================================ */
  
  .detalle-mercado {
    display: grid;
  
    grid-template-columns: 2fr 1fr;
  
    gap: 30px;
  }
  
  .panel-apuesta {
    border: 1px solid var(--linea);
  
    padding: 20px;
  
    background: #fff;
  
    align-self: start;
  
    position: sticky;
  
    top: 20px;
  }
  
  .panel-apuesta h3 {
    margin-top: 0;
  }
  
  .selector-opcion {
    display: flex;
  
    gap: 12px;
  
    margin-bottom: 16px;
  }
  
  .selector-opcion button {
    flex: 1;
  
    padding: 22px 10px;
  
    border: 2px solid var(--linea);
  
    background: #fff;
  
    font-weight: 800;
  
    cursor: pointer;
  
    font-size: 1.3rem;
  
    border-radius: 14px;
  
    letter-spacing: .5px;
  
    transition:
      transform .1s ease,
      box-shadow .15s ease,
      background .15s ease,
      color .15s ease,
      border-color .15s ease;
  }
  
  .selector-opcion button:hover {
    transform: translateY(-1px);
  }
  
  .selector-opcion button.si:hover {
    border-color: var(--celeste);
  }
  
  .selector-opcion button.no:hover {
    border-color: var(--negro-no);
  }
  
  .selector-opcion button.si.seleccionado {
    background: var(--celeste);
  
    color: var(--tinta);
  
    border-color: var(--celeste);
  
    box-shadow:
      0 6px 16px rgba(35, 239, 241, .45);
  }
  
  .selector-opcion button.no.seleccionado {
    background: var(--negro-no);
  
    color: #fff;
  
    border-color: var(--negro-no);
  
    box-shadow:
      0 6px 16px rgba(0, 0, 0, .35);
  }
  
  /* ============================================================
     CAMPOS
     ============================================================ */
  
  .campo {
    margin-bottom: 14px;
  }
  
  .campo label {
    display: block;
  
    margin-bottom: 5px;
  
    font-size: .9rem;
  }
  
  .campo input,
  .campo select,
  .campo textarea {
    width: 100%;
  
    padding: 9px 10px;
  
    border: 1px solid var(--linea);
  
    font-family: var(--sans);
  
    font-size: 1rem;
  }
  
  /* ============================================================
     BOTONES
     ============================================================ */
  
  .boton {
    display: inline-block;
  
    padding: 11px 20px;
  
    border: none;
  
    background: var(--tinta);
  
    color: #fff;
  
    font-weight: 700;
  
    cursor: pointer;
  
    font-size: .9rem;
  
    border-radius: 10px;
  
    transition: background .15s ease;
  
    text-transform: uppercase;
  
    letter-spacing: .4px;
  }
  
  .boton:hover {
    background: var(--tinta-suave);
  }
  
  .boton.secundario {
    background: transparent;
  
    color: var(--tinta);
  
    border: 1px solid var(--tinta);
  }
  
  .boton.secundario:hover {
    background: var(--tinta);
  
    color: #fff;
  }
  
  .boton.peligro {
    background: var(--rojo);
  }
  
  .boton.peligro:hover {
    background: #8a3131;
  }
  
  /* ============================================================
     TABLAS
     ============================================================ */
  
  table {
    width: 100%;
  
    border-collapse: collapse;
  
    background: #fff;
  }
  
  th,
  td {
    padding: 10px 12px;
  
    border-bottom: 1px solid var(--linea);
  
    text-align: left;
  
    font-size: .9rem;
  }
  
  th {
    background: var(--papel-panel);
  
    font-weight: 600;
  }
  
  .estado-pill {
    padding: 2px 9px;
  
    border-radius: 20px;
  
    font-size: .75rem;
  
    font-weight: 600;
  }
  
  .estado-abierto {
    background: #e4f2ea;
  
    color: var(--verde);
  }
  
  .estado-cerrado {
    background: #f2e9d8;
  
    color: var(--oro);
  }
  
  .estado-resuelto {
    background: #eee;
  
    color: var(--tinta-suave);
  }
  
  /* ============================================================
     PANELES ADMIN / USUARIO
     ============================================================ */
  
  .rejilla-stats {
    display: grid;
  
    grid-template-columns:
      repeat(auto-fit, minmax(180px, 1fr));
  
    gap: 16px;
  
    margin-bottom: 30px;
  }
  
  .stat {
    border: 1px solid var(--linea);
  
    padding: 16px;
  
    background: #fff;
  }
  
  .stat .valor {
    font-family: var(--sans);
  
    font-size: 1.8rem;
  }
  
  .stat .etiqueta {
    color: var(--tinta-suave);
  
    font-size: .85rem;
  }
  
  .form-ancho {
    max-width: 560px;
  }
  
  .campo-checkbox {
    display: flex;
  
    align-items: flex-start;
  
    gap: 8px;
  
    font-weight: 400;
  
    margin-bottom: 14px;
  }
  
  .campo-checkbox input[type="checkbox"] {
    flex-shrink: 0;
  
    width: 16px;
    height: 16px;
  
    margin-top: 3px;
  }
  
  /* ============================================================
     REDUCIR MOVIMIENTO
     ============================================================ */
  
  @media (prefers-reduced-motion: reduce) {
    * {
      animation: none !important;
      transition: none !important;
    }
  }
  
  /* ============================================================
     TABLET / MÓVIL
     ============================================================ */
  
  @media (max-width: 800px) {
  
    .detalle-mercado {
      grid-template-columns: 1fr;
    }
  
  }
  
  /* ============================================================
     MÓVIL
     ============================================================ */
  
  @media (max-width: 640px) {
  
    /* ---------- Cabecera ---------- */
  
    .cabecera-contenido {
      padding: 5px 15px;
  
      gap: 8px;
  
      flex-wrap: wrap;
    }
  
    /* ---------- Logo ---------- */
  
    .marca {
      gap: 8px;
    }
  
    .marca-icono {
      width: 54px;
      height: 54px;
  
      border-radius: 14px;
  
      padding: 4px;
  
      transform: translateY(5px);
    }
  
    .marca-logo {
      width: 100%;
      height: 100%;
  
      object-fit: contain;
    }
  
    .marca-nombre {
      font-size: 1rem;
  
      /*
       * Mantener "entre" arriba y "pilas" abajo
       * también en móvil.
       */
      display: flex;
      flex-direction: column;
  
      align-items: flex-start;
  
      line-height: .85;
  
      transform: translateY(12px);
    }
  
    .marca-entre,
    .marca-pilas {
      -webkit-text-stroke: 1.2px #000;
    }
  
    /* ---------- Menú ---------- */
  
    .menu-toggle {
      display: block;
  
      font-size: 1.4rem;
  
      padding: 4px 6px;
    }
  
    .menu-movil {
      flex-basis: 100%;
  
      flex-direction: column;
  
      align-items: stretch;
  
      width: 100%;
  
      max-height: 0;
  
      overflow: hidden;
  
      transition: max-height .3s ease;
    }
  
    .menu-movil.abierto {
      max-height: 480px;
    }
  
    .nav-principal {
      flex-direction: column;
  
      gap: 0;
  
      width: 100%;
  
      font-size: .95rem;
    }
  
    .nav-usuario {
      flex-direction: column;
  
      align-items: stretch;
  
      gap: 0;
  
      margin-left: 0;
  
      width: 100%;
  
      font-size: .9rem;
    }
  
    .nav-principal a,
    .nav-usuario a {
      width: 100%;
  
      padding: 10px 4px;
  
      border-bottom:
        1px solid rgba(20, 25, 43, .12);
  
      border-radius: 0;
    }
  
    .nav-usuario .saldo {
      padding: 10px 4px;
  
      border-bottom:
        1px solid rgba(20, 25, 43, .12);
    }
  
    .btn-cta {
      display: block;
  
      text-align: center;
  
      margin-top: 8px;
    }
  
    /* ---------- Contenido ---------- */
  
    .contenedor {
      padding: 24px 15px 50px;
    }
  
    .hero h1 {
      font-size: 1.6rem;
    }
  
    /* ---------- Estadísticas ---------- */
  
    .rejilla-stats {
      grid-template-columns: 1fr 1fr;
    }
  
    /* ---------- Mercados ---------- */
  
    .lista-mercados {
      grid-template-columns:
        repeat(auto-fill, minmax(140px, 1fr));
  
      gap: 10px;
    }
  
    .tarjeta-contenido {
      padding: 10px;
    }
  
    .tarjeta-contenido h3 {
      font-size: .82rem;
  
      -webkit-line-clamp: 2;
    }
  
    .tarjeta-contenido .opcion-precio {
      font-size: .72rem;
  
      padding: 4px 2px;
    }
  
    /* ---------- Selector ---------- */
  
    .selector-opcion button {
      padding: 16px 8px;
  
      font-size: 1.05rem;
  
      border-radius: 10px;
    }
  }
  
  /* =====================================================
   ADMINISTRACIÓN: MERCADOS RESPONSIVE
   ===================================================== */

.mercados-admin-responsive {
    width: 100%;
    min-width: 0;
}

.tabla-mercados-admin {
    width: 100%;
    border-collapse: collapse;
}

.acciones-mercado-admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.acciones-mercado-admin form {
    margin: 0;
}

.cancelar-mercado-admin {
    position: relative;
}

.form-cancelar-mercado {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(260px, 80vw);
    margin-top: 10px;
}

.form-cancelar-mercado input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* En celulares, cada fila se transforma en tarjeta */

@media (max-width: 768px) {

    .mercados-admin-responsive {
        overflow: visible;
    }

    .tabla-mercados-admin,
    .tabla-mercados-admin tbody {
        display: block;
        width: 100%;
    }

    .tabla-mercados-admin thead {
        display: none;
    }

    .tabla-mercados-admin tbody tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 18px;
        padding: 14px;
        border: 1px solid var(--linea, #ddd);
        border-radius: 12px;
        background: var(--fondo, #fff);
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
    }

    .tabla-mercados-admin tbody td {
        display: grid;
        grid-template-columns: minmax(105px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 0;
        border: 0;
        border-bottom: 1px solid var(--linea, #eee);
        overflow-wrap: anywhere;
    }

    .tabla-mercados-admin tbody td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .tabla-mercados-admin tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--tinta-suave, #666);
        font-size: 0.85rem;
    }

    .tabla-mercados-admin tbody td[data-label="Título"] a {
        font-weight: 600;
        text-decoration: none;
    }

    .acciones-mercado-admin {
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .acciones-mercado-admin .boton {
        max-width: 100%;
        box-sizing: border-box;
        text-align: center;
        white-space: normal;
    }

    .acciones-mercado-admin form {
        max-width: 100%;
    }

    .acciones-mercado-admin details {
        max-width: 100%;
    }

    .form-cancelar-mercado {
        width: 100%;
    }
}
  
  
  