/* ========== SECTIONS.CSS ========== */
section {
    text-align: center;
}

/* Contenedor principal ajustado a tu diseño */
.carousel-container {
    margin: 0px auto 10px auto; 
    position: relative;
    max-width: 1280px; 
    overflow: hidden;
    height: 500px;      
    border-radius: 20px; 

    box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.5), 
    0 10px 30px rgba(0, 0, 0, 0.15);

}

/* Contenedor de las imágenes */
.image-container {
    width: 100%;
    height: 100%; 
    position: relative;
}

/* Imágenes del carrusel */
.image-container img {
    width: 100%;
    height: 100%; 
    object-fit: cover; 
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}

.image-container img.active {
    display: block;
}

/* Barra inferior: indicadores centrados y botón LIGHT cuadrado a la derecha */
.nav-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1280px;
    min-height: 48px;
    box-sizing: border-box;
    margin: 12px auto 30px;
    padding: 0 52px 0 8px;
}

.carousel-dots {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-width: 0;
}

.nav-dot {
    appearance: none;
    display: block;
    flex: 0 0 12px;
    width: 12px;
    min-width: 12px;
    height: 12px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #555555;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.nav-dot.active {
    background: #ffffff;
    transform: scale(1.25);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Reutiliza el estilo LIGHT de TuxUniverse, en formato cuadrado fijo. */
#play-pause-btn,
#play-pause-stat-btn,
.carousel-play-pause,
#play-pause-btn.btn-tux-base.btn-glass-light,
#play-pause-stat-btn.btn-tux-base.btn-glass-light {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    left: auto !important;
    bottom: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border: 2px solid rgba(102, 102, 102, 0.45) !important;
    border-radius: 8px;
    background: #ffffff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    filter: none !important;
    overflow: hidden;
}

#play-pause-btn img,
#play-pause-stat-btn img,
.carousel-play-pause img {
    display: block;
    position: relative;
    z-index: 1;
    flex: 0 0 22px;
    width: 22px;
    min-width: 22px;
    max-width: 22px;
    height: 22px;
    min-height: 22px;
    max-height: 22px;
    object-fit: contain;
    pointer-events: none;
}

#play-pause-btn:hover,
#play-pause-stat-btn:hover,
.carousel-play-pause:hover {
    border: 2px solid #555555 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    transform: none !important;
}

#play-pause-btn:focus-visible,
#play-pause-stat-btn:focus-visible,
.carousel-play-pause:focus-visible {
    outline: 2px solid #555555 !important;
    outline-offset: 2px;
    box-shadow: none !important;
}

#play-pause-btn:active,
#play-pause-btn:focus,
#play-pause-stat-btn:active,
#play-pause-stat-btn:focus,
.carousel-play-pause:active,
.carousel-play-pause:focus {
    border: 2px solid #555555 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    transform: none !important;
}

/* --- Estilo del Cuadro de Cristal (Glassmorphism) --- */
.carousel-caption {
    position: absolute;
    top: 50%;
    left: 60px; 
    transform: translateY(-50%); 
    width: 400px;
    padding: 30px;
    background: rgba(0, 0, 0, 0.45); 
    backdrop-filter: blur(15px);    
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    text-align: left;
    z-index: 20; 
    color: white;
    display: none; 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.carousel-caption.active {
    display: block !important;
}

.carousel-caption h3 {
    font-family: 'Audiowide', cursive;
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: #ffffff;
    text-transform: uppercase;
}

.carousel-caption p {
    font-family: 'Open Sans', sans-serif; 
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
    color: #e0e0e0;
}

/* ============================================================
   NUEVOS BOTONES LATERALES DEL CARRUSEL (CRISTAL OSCURO)
   ============================================================ */
.carousel-container .nav-stat-btn {
    position: absolute;
    top: 0;
    width: 80px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0; /* Ocultos por defecto */
    transition: all 0.4s ease;
    
    /* Efecto Cristal Oscuro */
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-size: 35px;
    user-select: none;
}

/* Área de detección invisible de 50px adicionales */
.carousel-container .nav-stat-btn::after {
    content: "";
    position: absolute;
    top: 0;
    height: 100%;
    width: 130px; /* 80px del botón + 50px de margen */
}

.carousel-container .nav-stat-btn.prev { 
    left: 0; 
}

.carousel-container .nav-stat-btn.prev::after {
    left: 0;
}

.carousel-container .nav-stat-btn.next { 
    right: 0; 
}

.carousel-container .nav-stat-btn.next::after {
    right: 0;
}

/* Aparecen solo cuando estás sobre el área del botón (incluyendo los 50px de margen) */
.carousel-container .nav-stat-btn:hover {
    opacity: 1;
}

.carousel-container .nav-stat-btn:hover {
    background: rgba(0, 0, 0, 0.45);
}

.carousel-container .nav-stat-btn span {
    transition: transform 0.2s ease;
}

.carousel-container .nav-stat-btn:active span {
    transform: scale(0.85);
}

.carousel-caption .btn-tux-base {
    height: 40px !important;    /* Forzamos los 40px exactos */
    padding: 0 24px !important; /* Eliminamos el padding vertical que lo engorda */
    display: inline-flex;       /* Aseguramos centrado total */
    align-items: center;
    justify-content: center;
}

/* ============================================================
CARROUSEL PARA SERVICIOS
============================================================ */
.tux-container-wrapper {
    margin: 0 auto 20px auto;
    max-width: 1280px;
    height: 500px;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.tux-showcase {
  width: 100%;
  height: 100%;
  position: relative;
}

.tux-panels {
  display: flex;
  width: 100%;
  height: 100%;
}

.panel {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column; /* TEXTO ARRIBA */
  justify-content: space-between;
  padding: 40px;
}

/* IZQUIERDA */
.panel-left {
  background: linear-gradient(to right, #e8e8e8, #adadad);
}

/* DERECHA */
.panel-right {
  background: linear-gradient(to left, #235a90, #081f51);
  color: white;
}

/* TEXTO ARRIBA */
.panel-content {
  width: 100%;
}

/* IMAGEN ABAJO */
.panel-image {
  width: 100%;
  height: 60%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tux-buttons {
  position: absolute;
  top: 84%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

/* ===== TITULO COMO IMAGEN ===== */
.panel-title {
  width: 100%;
  display: flex;
  justify-content: center;

  /* 🔥 AJUSTA ESTO PARA SUBIR/BAJAR */
  margin-top: 20px;   /* pon negativo para subir más (-20px por ejemplo) */
  margin-bottom: 30px;
}

/* IMAGEN DEL TITULO */
.panel-title img {
  width: 250px;      /* 🔥 CONTROL DIRECTO DEL TAMAÑO */
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* ============================================================
   CARRUSEL DE PORTADA: AJUSTES EXCLUSIVOS PARA MÓVILES
   Escritorio conserva las reglas anteriores.
   ============================================================ */
@media (max-width: 768px) {
    /* El carrusel se alinea con las tarjetas: 18px por lado en móvil.
       Se usa el ancho del contenedor, no 96vw + márgenes calculados, para
       evitar que el carrusel se desplace fuera de la pantalla. */
    #main-carousel {
        width: calc(100% - 36px);
        max-width: 1280px;
        height: 560px;
        margin: 0 auto 10px;
        box-sizing: border-box;
        overflow: hidden;
        border-radius: 18px;
    }

    #main-carousel .image-container {
        position: relative;
        width: 100%;
        height: 100%;
    }

    /* Compatible con diapositivas envueltas en <picture> (MariaDB)
       y con las imágenes directas del HTML anterior. */
    #main-carousel .image-container picture {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
    }

    #main-carousel .image-container picture img,
    #main-carousel .image-container > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    /* La caja sigue siempre SOBRE la imagen y alineada con el carrusel. */
    #main-carousel .carousel-caption {
        left: 0;
        right: 0;
        top: 18px;
        bottom: auto;
        width: 100%;
        max-width: none;
        padding: 18px 16px;
        box-sizing: border-box;
        border-radius: 16px;
        transform: none;
    }

    #main-carousel .carousel-caption h3 {
        font-size: 1.08rem;
        line-height: 1.25;
        margin: 0 0 8px;
    }

    #main-carousel .carousel-caption p {
        font-size: 0.86rem;
        line-height: 1.4;
        margin: 0 0 12px;
    }

    #main-carousel .carousel-caption .btn-tux-base {
        min-height: 40px;
        height: 40px !important;
    }

    /* En móvil las flechas laterales son visibles y pulsables sin hover. */
    #main-carousel .nav-stat-btn {
        width: 44px;
        opacity: 0.9;
        visibility: visible;
        pointer-events: auto;
        z-index: 101;
        background: rgba(0, 0, 0, 0.28);
    }

    #main-carousel .nav-stat-btn::after {
        width: 44px;
    }

    #main-carousel .nav-stat-btn:focus-visible {
        opacity: 1;
        outline: 2px solid #ffffff;
        outline-offset: -4px;
    }

    /* Barra de controles debajo de la imagen, alineada con las tarjetas. */
    #main-carousel + .nav-bar,
    .nav-bar-stats {
        position: relative;
        width: calc(100% - 36px);
        max-width: 1280px;
        min-height: 48px;
        margin: 10px auto 24px;
        padding: 0 48px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        overflow: visible;
    }

    /* Indicadores centrados, tanto si el JS los genera directamente en
       .nav-bar como si los agrupa en .carousel-dots. */
    #main-carousel + .nav-bar .carousel-dots,
    .nav-bar-stats .carousel-dots {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin: 0;
        max-width: calc(100% - 96px);
        min-width: 0;
    }

    #main-carousel + .nav-bar > .nav-dot {
        flex: 0 0 22px;
        width: 22px;
        min-width: 22px;
        height: 4px;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 3px;
        background: #dfe5e9;
        box-shadow: none;
        transform: none;
    }

    #main-carousel + .nav-bar .carousel-dots .nav-dot,
    .nav-bar-stats .carousel-dots .nav-dot {
        flex: 0 0 22px;
        width: 22px;
        min-width: 22px;
        height: 4px;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 3px;
        background: #dfe5e9;
        box-shadow: none;
        transform: none;
    }

    #main-carousel + .nav-bar > .nav-dot.active,
    #main-carousel + .nav-bar .carousel-dots .nav-dot.active,
    .nav-bar-stats .carousel-dots .nav-dot.active {
        background: #555555;
        box-shadow: none;
        transform: none;
    }

    /* Botón LIGHT cuadrado, siempre dentro de la barra inferior.
       Se mantiene el estilo de botón de TuxUniverse; solo fijamos tamaño. */
    #main-carousel + .nav-bar #play-pause-btn,
    .nav-bar-stats #play-pause-stat-btn {
        position: absolute !important;
        top: 4px !important;
        right: 0 !important;
        left: auto !important;
        bottom: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
        transform: none !important;
        filter: none !important;
        overflow: hidden;
        z-index: 5;
    }

    #main-carousel + .nav-bar #play-pause-btn img,
    .nav-bar-stats #play-pause-stat-btn img {
        display: block !important;
        position: relative;
        width: 22px !important;
        min-width: 22px !important;
        max-width: 22px !important;
        height: 22px !important;
        min-height: 22px !important;
        max-height: 22px !important;
        object-fit: contain;
        pointer-events: none;
    }
}

@media (max-width: 480px) {
    #main-carousel {
        width: calc(100% - 36px);
        height: 560px;
        border-radius: 16px;
    }

    #main-carousel .carousel-caption {
        top: 14px;
        padding: 15px 13px;
    }

    #main-carousel .carousel-caption h3 {
        font-size: 1rem;
    }

    #main-carousel .carousel-caption p {
        font-size: 0.82rem;
        line-height: 1.36;
    }

    #main-carousel + .nav-bar,
    .nav-bar-stats {
        width: calc(100% - 36px);
        padding-left: 44px;
        padding-right: 44px;
    }

    #main-carousel + .nav-bar .carousel-dots,
    .nav-bar-stats .carousel-dots {
        max-width: calc(100% - 88px);
        gap: 6px;
    }
}
/* ============================================================
   AJUSTES FINALES DEL CARRUSEL DE PORTADA EN MÓVIL
   Afecta exclusivamente a #main-carousel y su barra inmediata.
   ============================================================ */
@media (max-width: 768px) {
    #main-carousel {
        width: 100vw;
        max-width: none;
        height: calc(100svh - 150px);
        min-height: 390px;
        max-height: 760px;
        margin: 0 0 0 calc(50% - 50vw);
        border-radius: 0;
        box-sizing: border-box;
        overflow: hidden;
    }

    #main-carousel .image-container,
    #main-carousel .image-container picture {
        width: 100%;
        height: 100%;
    }

    #main-carousel .image-container picture img,
    #main-carousel .image-container > img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    /* Barra inferior: flecha izquierda, líneas, flecha derecha y pausa. */
    #main-carousel + .nav-bar {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
        align-items: center;
        column-gap: 8px;
        width: 100vw;
        max-width: none;
        min-height: 48px;
        margin: 8px 0 20px calc(50% - 50vw);
        padding: 0 12px;
        box-sizing: border-box;
    }

    #main-carousel + .nav-bar .nav-stat-btn {
        position: relative !important;
        inset: auto !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px !important;
        min-width: 40px;
        height: 40px !important;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #555555;
        font-size: 30px;
        line-height: 1;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        cursor: pointer;
        z-index: 2;
    }

    #main-carousel + .nav-bar .nav-stat-btn.prev {
        grid-column: 1;
        grid-row: 1;
    }

    #main-carousel + .nav-bar .nav-stat-btn.next {
        grid-column: 3;
        grid-row: 1;
    }

    #main-carousel + .nav-bar .nav-stat-btn::after {
        display: none;
    }

    #main-carousel + .nav-bar .carousel-dots {
        position: static;
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
    }

    #main-carousel + .nav-bar .carousel-dots .nav-dot {
        flex: 0 1 22px;
        width: 22px;
        min-width: 10px;
        max-width: 22px;
        height: 4px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 3px;
        background: #dfe5e9;
        box-shadow: none;
        transform: none;
    }

    #main-carousel + .nav-bar .carousel-dots .nav-dot.active {
        background: #555555;
    }

    #main-carousel + .nav-bar #play-pause-btn {
        position: relative !important;
        inset: auto !important;
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 2px solid #555555 !important;
        background: #ffffff !important;
        box-shadow: none !important;
    }
}

@media (max-width: 768px) {
    /* El menú fijo mide 60px; quitamos los 40px extra del padding global. */
    main:has(#main-carousel) {
        padding-top: 60px;
    }
}

/* Ajuste final del cuadro de texto: mismo ancho que las tarjetas móviles
   y altura máxima del 50% de la imagen. */
@media (max-width: 768px) {
    #main-carousel .carousel-caption {
        left: 18px;
        right: auto;
        width: calc(100% - 36px);
        max-width: none;
        height: auto;
        max-height: 50%;
        box-sizing: border-box;
        overflow: visible;
    }
}


/* Ajuste fino de espaciado del cuadro: solo móvil. */
@media (max-width: 480px) {
    #main-carousel .carousel-caption {
        top: 16px;                 /* Baja la caja 2px. */
        padding-left: 15px;        /* Da 2px más de margen al texto y al botón. */
        padding-right: 15px;
    }

    #main-carousel .carousel-caption .btn-tux-base {
        margin-top: 4px;           /* Separa un poco el botón del texto. */
    }
}

/* ============================================================
   CONTROLES DE ESTADÍSTICAS EN MÓVIL
   Misma apariencia que el carrusel principal, sin flechas.
   ============================================================ */
@media (max-width: 768px) {
    .nav-bar-stats {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
        align-items: center;
        column-gap: 8px;
        min-height: 48px;
    }

    .nav-bar-stats .stats-mobile-arrow {
        position: relative !important;
        inset: auto !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px !important;
        min-width: 40px;
        height: 40px !important;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #555555;
        font-size: 30px;
        line-height: 1;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        box-shadow: none;
        cursor: pointer;
        z-index: 2;
    }

    .nav-bar-stats #btn-prev-stat-mobile {
        grid-column: 1;
        grid-row: 1;
    }

    .nav-bar-stats #btn-next-stat-mobile {
        grid-column: 3;
        grid-row: 1;
    }

    .nav-bar-stats .stats-mobile-arrow:active span {
        transform: scale(0.85);
    }

    .nav-bar-stats .carousel-dots {
        position: static;
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
    }

    .nav-bar-stats .carousel-dots .nav-dot {
        flex: 0 1 22px;
        width: 22px;
        min-width: 10px;
        max-width: 22px;
        height: 4px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 3px;
        background: #dfe5e9;
        box-shadow: none;
        transform: none;
    }

    .nav-bar-stats .carousel-dots .nav-dot.active {
        background: #555555;
        box-shadow: none;
        transform: none;
    }

    .nav-bar-stats #play-pause-stat-btn {
        position: relative !important;
        inset: auto !important;
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 2px solid #555555 !important;
        border-radius: 8px !important;
        background: #ffffff !important;
        box-shadow: none !important;
    }

    .nav-bar-stats #play-pause-stat-btn img {
        width: 22px !important;
        min-width: 22px !important;
        max-width: 22px !important;
        height: 22px !important;
        min-height: 22px !important;
        max-height: 22px !important;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .nav-bar-stats {
        padding-left: 12px;
        padding-right: 12px;
    }

    .nav-bar-stats .carousel-dots {
        gap: 6px;
    }
}