/**
 * YITH Membership Download Buttons
 *
 * @package RecursosWorship
 * @since 1.0.0
 */

/* ========================================
   Container de botones
======================================== */

.wd-after-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
    width: 100%;
}

.yith-wcmbs-download-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
    width: 100%;
}

/* ========================================
   Estilos base del botón
======================================== */

.yith-wcmbs-product-download-button,
.yith-wcmbs-download-button,
.yith-wcmbs-download-links a {
    /* Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    /* Sizing */
    min-height: 3rem;
    padding: 0.875rem 1.5rem;
    flex: 1 1 auto;
    min-width: 120px;

    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;

    /* Colors - Default dark style */
    background-color: #1a1a2e;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* Border */
    border-radius: 0.5rem;

    /* Transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);

    /* Cursor */
    cursor: pointer;

    /* Misc */
    position: relative;
    overflow: hidden;
    outline: none;
}

/* ========================================
   Iconos de descarga
======================================== */

.yith-wcmbs-product-download-button::before,
.yith-wcmbs-download-button::before,
.yith-wcmbs-download-links a::before {
    content: '';
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Estados hover y focus
======================================== */

.yith-wcmbs-product-download-button:hover,
.yith-wcmbs-download-button:hover,
.yith-wcmbs-download-links a:hover {
    /* Elevación suave hacia arriba */
    transform: translateY(-4px);

    /* Gradiente más brillante */
    background: linear-gradient(135deg, #7c93f5 0%, #8b5fc4 100%);
}

.yith-wcmbs-product-download-button:hover::before,
.yith-wcmbs-download-button:hover::before,
.yith-wcmbs-download-links a:hover::before {
    /* Icono se mueve ligeramente hacia abajo */
    transform: translateY(2px);
}

.yith-wcmbs-product-download-button:focus,
.yith-wcmbs-download-button:focus,
.yith-wcmbs-download-links a:focus {
    outline: none;
    box-shadow: none;
    transform: translateY(-4px);
}

.yith-wcmbs-product-download-button:focus-visible,
.yith-wcmbs-download-button:focus-visible,
.yith-wcmbs-download-links a:focus-visible {
    /* Mantener enfoque visible para navegaciÃ³n con teclado */
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

/* ========================================
   Estado activo (click)
======================================== */

.yith-wcmbs-product-download-button:active,
.yith-wcmbs-download-button:active,
.yith-wcmbs-download-links a:active {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #5a6fd8 0%, #674098 100%);
}

/* ========================================
   Estado deshabilitado
======================================== */

.yith-wcmbs-product-download-button:disabled,
.yith-wcmbs-download-button:disabled,
.yith-wcmbs-download-links a.disabled {
    background: linear-gradient(135deg, #a0a0a0 0%, #808080 100%);
    cursor: not-allowed;
    transform: translateY(0);
    opacity: 0.6;
}

.yith-wcmbs-product-download-button:disabled:hover,
.yith-wcmbs-download-button:disabled:hover,
.yith-wcmbs-download-links a.disabled:hover {
    transform: translateY(0);
}

/* ========================================
   Variantes de color para diferentes resoluciones
======================================== */

/* Botón 720p */
.yith-wcmbs-download-links a[href*="720p"],
.yith-wcmbs-download-links a[href*="720"],
.yith-wcmbs-download-button.resolution-720p {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.yith-wcmbs-download-links a[href*="720p"]:hover,
.yith-wcmbs-download-links a[href*="720"]:hover,
.yith-wcmbs-download-button.resolution-720p:hover {
    background: linear-gradient(135deg, #5dd895 0%, #48c97f 100%);
}

/* Botón 1080p */
.yith-wcmbs-download-links a[href*="1080p"],
.yith-wcmbs-download-links a[href*="1080"],
.yith-wcmbs-download-button.resolution-1080p {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.yith-wcmbs-download-links a[href*="1080p"]:hover,
.yith-wcmbs-download-links a[href*="1080"]:hover,
.yith-wcmbs-download-button.resolution-1080p:hover {
    background: linear-gradient(135deg, #5eb3f5 0%, #4a9fe8 100%);
}

/* Botón 4K */
.yith-wcmbs-download-links a[href*="4k"],
.yith-wcmbs-download-links a[href*="4K"],
.yith-wcmbs-download-links a[href*="2160"],
.yith-wcmbs-download-button.resolution-4k {
    background: linear-gradient(135deg, #ed64a6 0%, #d53f8c 100%);
}

.yith-wcmbs-download-links a[href*="4k"]:hover,
.yith-wcmbs-download-links a[href*="4K"]:hover,
.yith-wcmbs-download-links a[href*="2160"]:hover,
.yith-wcmbs-download-button.resolution-4k:hover {
    background: linear-gradient(135deg, #f687b3 0%, #ed64a6 100%);
}

/* ========================================
   Textos dentro de los botones
======================================== */

.yith-wcmbs-download-links a span,
.yith-wcmbs-download-button span {
    display: inline-block;
    white-space: nowrap;
}

/* ========================================
   Responsive Design
======================================== */

/* Tablets (768px - 1023px): 1 botón por línea */
@media screen and (max-width: 1023px) {
    .yith-wcmbs-download-links {
        flex-direction: column;
        gap: 1rem;
    }

    .yith-wcmbs-product-download-button,
    .yith-wcmbs-download-button,
    .yith-wcmbs-download-links a {
        flex: 1 1 100%;
        width: 100%;
        min-width: unset;
    }
}

/* Móviles pequeños (< 480px) */
@media screen and (max-width: 480px) {
    .yith-wcmbs-product-download-button,
    .yith-wcmbs-download-button,
    .yith-wcmbs-download-links a {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
        min-height: 3rem;
    }

    .yith-wcmbs-product-download-button::before,
    .yith-wcmbs-download-button::before,
    .yith-wcmbs-download-links a::before {
        width: 1.125rem;
        height: 1.125rem;
    }
}

/* ========================================
   Animación de carga (opcional)
======================================== */

@keyframes rwLoadingShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes rwSpinner {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.yith-wcmbs-product-download-button.loading,
.yith-wcmbs-download-button.loading,
.yith-wcmbs-download-links a.loading {
    pointer-events: none;
    user-select: none;
    color: transparent !important;
    text-shadow: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(110deg, #151526 8%, #262642 30%, #1b1b31 55%, #151526 82%);
    background-size: 220% 100%;
    animation: rwLoadingShimmer 1.2s linear infinite;
    transform: none;
}

.yith-wcmbs-product-download-button.loading::before,
.yith-wcmbs-download-button.loading::before,
.yith-wcmbs-download-links a.loading::before {
    opacity: 0;
    transform: none;
}

.yith-wcmbs-product-download-button.loading > *,
.yith-wcmbs-download-button.loading > *,
.yith-wcmbs-download-links a.loading > * {
    opacity: 0;
}

.yith-wcmbs-product-download-button.loading::after,
.yith-wcmbs-download-button.loading::after,
.yith-wcmbs-download-links a.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    border: 2.5px solid rgba(255, 255, 255, 0.22);
    border-top-color: #ffffff;
    animation: rwSpinner 0.8s linear infinite;
    z-index: 2;
}

/* ========================================
   Accesibilidad mejorada
======================================== */

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .yith-wcmbs-product-download-button,
    .yith-wcmbs-download-button,
    .yith-wcmbs-download-links a {
        border: 2px solid currentColor;
    }
}

/* Reducir movimiento para usuarios que lo prefieran */
@media (prefers-reduced-motion: reduce) {
    .yith-wcmbs-product-download-button,
    .yith-wcmbs-download-button,
    .yith-wcmbs-download-links a,
    .yith-wcmbs-product-download-button::before,
    .yith-wcmbs-download-button::before,
    .yith-wcmbs-download-links a::before,
    .yith-wcmbs-product-download-button.loading::after,
    .yith-wcmbs-download-button.loading::after,
    .yith-wcmbs-download-links a.loading::after {
        transition: none;
        animation: none;
    }

    .yith-wcmbs-product-download-button:hover,
    .yith-wcmbs-download-button:hover,
    .yith-wcmbs-download-links a:hover {
        transform: none;
    }
}

/* ========================================
   Dark mode support
======================================== */

@media (prefers-color-scheme: dark) {
    .yith-wcmbs-product-download-button,
    .yith-wcmbs-download-button,
    .yith-wcmbs-download-links a {
        /* Gradientes ligeramente más oscuros en dark mode */
        filter: brightness(0.95);
    }

    .yith-wcmbs-product-download-button:hover,
    .yith-wcmbs-download-button:hover,
    .yith-wcmbs-download-links a:hover {
        filter: brightness(1.05);
    }
}

/* ========================================
   Contenedor de tab (si se usa en tabs)
======================================== */

.yith-wcmbs-download-tab-content {
    padding: 2rem 0;
}

.yith-wcmbs-download-tab-content .yith-wcmbs-download-links {
    margin-top: 0;
}

/* ========================================
   Mensajes informativos
======================================== */

.yith-wcmbs-download-info {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background-color: #f7fafc;
    border-left: 4px solid #667eea;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    color: #2d3748;
    line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
    .yith-wcmbs-download-info {
        background-color: #2d3748;
        color: #e2e8f0;
    }
}

/* ========================================
   Título de sección de descarga
======================================== */

.yith-wcmbs-download-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

@media (prefers-color-scheme: dark) {
    .yith-wcmbs-download-section-title {
        color: #f7fafc;
    }
}
