/**
 * CPT Loop Carousel - Estilos
 */

/* ==========================================
   Wrapper Principal
   ========================================== */
.cpt-carousel-wrapper {
    position: relative;
    padding: 0 50px;
    margin: 20px 0;
}

.cpt-carousel-container {
    overflow: hidden;
}

/* ==========================================
   Slide
   ========================================== */
.cpt-carousel-slide {
    height: auto;
    display: flex;
}

.cpt-carousel-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.cpt-carousel-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   Imagen
   ========================================== */
.cpt-carousel-image {
    position: relative;
    overflow: hidden;
}

.cpt-carousel-image a {
    display: block;
    position: relative;
}

.cpt-carousel-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Aspect Ratios */
.cpt-carousel-wrapper[data-ratio="1-1"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="1-1"] .cpt-carousel-no-image {
    aspect-ratio: 1 / 1;
}

.cpt-carousel-wrapper[data-ratio="4-3"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="4-3"] .cpt-carousel-no-image {
    aspect-ratio: 4 / 3;
}

.cpt-carousel-wrapper[data-ratio="16-9"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="16-9"] .cpt-carousel-no-image {
    aspect-ratio: 16 / 9;
}

.cpt-carousel-wrapper[data-ratio="21-9"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="21-9"] .cpt-carousel-no-image {
    aspect-ratio: 21 / 9;
}

.cpt-carousel-wrapper[data-ratio="3-4"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="3-4"] .cpt-carousel-no-image {
    aspect-ratio: 3 / 4;
}

.cpt-carousel-wrapper[data-ratio="9-16"] .cpt-carousel-image a,
.cpt-carousel-wrapper[data-ratio="9-16"] .cpt-carousel-no-image {
    aspect-ratio: 9 / 16;
}

.cpt-carousel-image a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cpt-carousel-item:hover .cpt-carousel-thumbnail {
    transform: scale(1.05);
}

.cpt-carousel-no-image {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpt-carousel-no-image svg {
    width: 60px;
    height: 60px;
    stroke: #cccccc;
}

/* ==========================================
   Categorías
   ========================================== */
.cpt-carousel-categories {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 2;
}

.cpt-carousel-category {
    display: inline-block;
    padding: 5px 12px;
    background: #0073aa;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.cpt-carousel-category:hover {
    background: #005177;
    color: #ffffff;
}

/* ==========================================
   Contenido
   ========================================== */
.cpt-carousel-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Meta (fecha, autor) */
.cpt-carousel-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #888888;
}

.cpt-carousel-date,
.cpt-carousel-author {
    display: inline-flex;
    align-items: center;
}

.cpt-carousel-date::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #0073aa;
    border-radius: 50%;
    margin-right: 8px;
}

/* Título */
.cpt-carousel-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.cpt-carousel-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cpt-carousel-title a:hover {
    color: #0073aa;
}

/* Extracto */
.cpt-carousel-excerpt {
    font-size: 14px;
    line-height: 1.7;
    color: #666666;
    margin-bottom: 15px;
    flex: 1;
}

/* Botón Leer más */
.cpt-carousel-read-more {
    margin-top: auto;
}

.cpt-carousel-read-more-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #0073aa;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease, gap 0.3s ease;
}

.cpt-carousel-read-more-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.cpt-carousel-read-more-link:hover {
    color: #005177;
    gap: 12px;
}

.cpt-carousel-read-more-link:hover svg {
    transform: translateX(4px);
}

/* ==========================================
   Botón Personalizado
   ========================================== */
.cpt-carousel-custom-button {
    margin-top: 12px;
}

.cpt-carousel-custom-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.cpt-carousel-custom-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a1 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cpt-carousel-custom-btn:active {
    transform: translateY(0);
}

.cpt-carousel-custom-btn .custom-btn-text {
    display: inline-block;
}

.cpt-carousel-custom-btn .custom-btn-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    transition: transform 0.3s ease;
}

.cpt-carousel-custom-btn:hover .custom-btn-icon {
    transform: scale(1.1);
}

/* Estilo para popup de Elementor */
.cpt-carousel-custom-btn.elementor-popup-trigger {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.cpt-carousel-custom-btn.elementor-popup-trigger:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Estilo alternativo para popup personalizado */
.cpt-carousel-custom-btn.open-popup,
.cpt-carousel-custom-btn[data-popup],
.cpt-carousel-custom-btn.popup-trigger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.cpt-carousel-custom-btn.open-popup:hover,
.cpt-carousel-custom-btn[data-popup]:hover,
.cpt-carousel-custom-btn.popup-trigger:hover {
    background: linear-gradient(135deg, #e879f9 0%, #ec4899 100%);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* Campos personalizados */
.cpt-carousel-custom-fields {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eeeeee;
}

.cpt-carousel-field {
    font-size: 13px;
    margin-bottom: 8px;
}

.cpt-carousel-field:last-child {
    margin-bottom: 0;
}

.cpt-carousel-field .field-label {
    font-weight: 600;
    color: #444444;
}

.cpt-carousel-field .field-value {
    color: #666666;
}

/* ==========================================
   Navegación (Flechas)
   ========================================== */
.cpt-carousel-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.cpt-carousel-button-prev,
.cpt-carousel-button-next {
    width: 44px;
    height: 44px;
    background: #0073aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.cpt-carousel-button-prev:hover,
.cpt-carousel-button-next:hover {
    background: #005177;
    transform: scale(1.1);
}

.cpt-carousel-button-prev svg,
.cpt-carousel-button-next svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
}

.cpt-carousel-button-prev.swiper-button-disabled,
.cpt-carousel-button-next.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Override Swiper default styles */
.cpt-carousel-wrapper .swiper-button-prev::after,
.cpt-carousel-wrapper .swiper-button-next::after {
    display: none;
}

/* ==========================================
   Paginación
   ========================================== */
.cpt-carousel-pagination {
    margin-top: 25px;
    text-align: center;
}

.cpt-carousel-pagination.swiper-pagination-bullets {
    position: relative;
    bottom: auto;
}

.cpt-carousel-pagination .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #cccccc;
    opacity: 1;
    margin: 0 5px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.cpt-carousel-pagination .swiper-pagination-bullet-active {
    background: #0073aa;
    transform: scale(1.2);
}

/* Paginación tipo fracción */
.cpt-carousel-pagination.swiper-pagination-fraction {
    font-size: 14px;
    font-weight: 600;
    color: #666666;
}

/* Paginación tipo progressbar */
.cpt-carousel-pagination.swiper-pagination-progressbar {
    position: relative;
    top: auto;
    height: 4px;
    background: #eeeeee;
    border-radius: 2px;
}

.cpt-carousel-pagination.swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
    background: #0073aa;
    border-radius: 2px;
}

/* ==========================================
   No Posts Message
   ========================================== */
.cpt-carousel-no-posts {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
    color: #666666;
    font-size: 16px;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1024px) {
    .cpt-carousel-wrapper {
        padding: 0 40px;
    }

    .cpt-carousel-button-prev,
    .cpt-carousel-button-next {
        width: 40px;
        height: 40px;
    }

    .cpt-carousel-button-prev svg,
    .cpt-carousel-button-next svg {
        width: 18px;
        height: 18px;
    }

    .cpt-carousel-title {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .cpt-carousel-wrapper {
        padding: 0 15px;
    }

    .cpt-carousel-navigation {
        display: none;
    }

    .cpt-carousel-content {
        padding: 15px;
    }

    .cpt-carousel-title {
        font-size: 15px;
    }

    .cpt-carousel-excerpt {
        font-size: 13px;
    }

    .cpt-carousel-meta-top {
        font-size: 12px;
    }

    .cpt-carousel-category {
        font-size: 10px;
        padding: 4px 10px;
    }

    .cpt-carousel-pagination {
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .cpt-carousel-wrapper {
        padding: 0 10px;
    }

    .cpt-carousel-categories {
        top: 10px;
        left: 10px;
    }
}

/* ==========================================
   Efectos especiales
   ========================================== */

/* Efecto Coverflow */
.swiper-coverflow .cpt-carousel-slide {
    width: 300px;
}

/* Efecto Cards */
.swiper-cards .cpt-carousel-slide {
    width: 280px;
}

/* Slides centrados */
.swiper-centered .swiper-slide-active .cpt-carousel-item {
    transform: scale(1.05);
}

/* ==========================================
   Loading State
   ========================================== */
.cpt-carousel-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.cpt-carousel-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #eeeeee;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: cpt-carousel-spin 0.8s linear infinite;
}

@keyframes cpt-carousel-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Animaciones de entrada
   ========================================== */
.cpt-carousel-item {
    opacity: 0;
    animation: cpt-carousel-fadeIn 0.5s ease forwards;
}

@keyframes cpt-carousel-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.swiper-slide:nth-child(1) .cpt-carousel-item { animation-delay: 0.1s; }
.swiper-slide:nth-child(2) .cpt-carousel-item { animation-delay: 0.2s; }
.swiper-slide:nth-child(3) .cpt-carousel-item { animation-delay: 0.3s; }
.swiper-slide:nth-child(4) .cpt-carousel-item { animation-delay: 0.4s; }
.swiper-slide:nth-child(5) .cpt-carousel-item { animation-delay: 0.5s; }
.swiper-slide:nth-child(6) .cpt-carousel-item { animation-delay: 0.6s; }

/* ==========================================
   ACF Fields Widget Styles
   ========================================== */
.acf-fields-wrapper {
    box-sizing: border-box;
}

.acf-fields-wrapper *,
.acf-fields-wrapper *::before,
.acf-fields-wrapper *::after {
    box-sizing: inherit;
}

.acf-fields-list {
    display: flex;
    flex-direction: column;
}

.acf-fields-list.layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}

.acf-fields-list.layout-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
}

.acf-fields-list.layout-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.acf-fields-list.layout-grid {
    display: grid;
}

/* Item de campo */
.acf-field-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
}

.acf-fields-list.layout-vertical .acf-field-item {
    flex-direction: column;
    align-items: flex-start;
}

.acf-fields-list.layout-table .acf-field-item {
    display: table-row;
}

.acf-fields-list.layout-inline .acf-field-item {
    margin-right: 15px;
}

.acf-fields-list.layout-inline .acf-field-item:last-child {
    margin-right: 0;
}

/* Separador */
.acf-fields-list.has-separator .acf-field-item {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eeeeee;
}

.acf-fields-list.has-separator .acf-field-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Etiqueta */
.acf-field-label {
    font-weight: 600;
    color: #333333;
    margin-right: 8px;
    display: inline-block;
}

.acf-fields-list.layout-table .acf-field-label {
    display: table-cell;
    padding: 8px 15px 8px 0;
    white-space: nowrap;
    vertical-align: top;
}

/* Valor */
.acf-field-value {
    color: #666666;
    display: inline-block;
}

.acf-fields-list.layout-table .acf-field-value {
    display: table-cell;
    padding: 8px 0;
    vertical-align: top;
}

/* Enlaces */
.acf-field-value a,
.acf-field-value a.acf-link {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.acf-field-value a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Imágenes */
.acf-field-value img.acf-image {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Galería */
.acf-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.acf-gallery-item {
    display: block;
    overflow: hidden;
    border-radius: 4px;
}

.acf-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.acf-gallery-item:hover img {
    transform: scale(1.05);
}

/* Lista */
.acf-list {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.acf-list li {
    margin-bottom: 5px;
}

.acf-list li:last-child {
    margin-bottom: 0;
}

/* Mensajes */
.acf-fields-error,
.acf-fields-placeholder {
    padding: 20px;
    text-align: center;
    color: #666666;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 14px;
}

.acf-fields-error {
    background: #ffebe8;
    color: #cc0000;
    border-left: 4px solid #cc0000;
}

/* Responsive */
@media (max-width: 768px) {
    .acf-fields-list.layout-horizontal {
        flex-direction: column;
    }
    
    .acf-fields-list.layout-table {
        display: block;
    }
    
    .acf-fields-list.layout-table .acf-field-item {
        display: flex;
        flex-direction: column;
        padding: 10px 0;
        border-bottom: 1px solid #eeeeee;
    }
    
    .acf-fields-list.layout-table .acf-field-label,
    .acf-fields-list.layout-table .acf-field-value {
        display: block;
        padding: 0;
    }
    
    .acf-gallery {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* ==========================================
   Accessibility
   ========================================== */
.cpt-carousel-button-prev:focus,
.cpt-carousel-button-next:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.cpt-carousel-title a:focus,
.cpt-carousel-read-more-link:focus,
.cpt-carousel-category:focus,
.cpt-carousel-custom-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cpt-carousel-item,
    .cpt-carousel-thumbnail,
    .cpt-carousel-button-prev,
    .cpt-carousel-button-next,
    .cpt-carousel-read-more-link svg,
    .cpt-carousel-custom-btn,
    .cpt-carousel-custom-btn .custom-btn-icon,
    .swiper-pagination-bullet {
        transition: none;
        animation: none;
    }
}
