/**
 * Sn4p Membership Packs
 * Main CSS styles
 * 
 * @package Sn4p_Membership
 */

/* Selector de período global */
.global-period-selector-wrapper {
    margin-bottom: 30px;
    text-align: center;
}

.global-period-selector {
    display: inline-flex;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.global-period-selector .period-button {
    padding: 10px 20px;
    border-radius: 4px;
    margin: 0 5px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    font-weight: 500;
}

.global-period-selector .period-button.active {
    background: #4a6ee0;
    color: white;
}

/* Estilos para los packs */
.pack-container {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible !important; /* Permitir que los elementos hijos sean visibles fuera del contenedor */
}

/* Estilos para el pack popular */
.pack-container.pack-popular {
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 10;
    overflow: hidden !important; /* Mantener overflow hidden para el contenedor */
    position: relative; /* Asegurar que los elementos absolutos se posicionen relativos a este contenedor */
}

/* Badge de popular - Estilos base */
.popular-badge {
    position: absolute;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 20;
}

/* Badge horizontal (por defecto) */
.popular-badge.badge-horizontal {
    top: -10px;
    right: -10px;
    padding: 5px 15px;
    border-radius: 20px;
    min-width: 80px;
    text-align: center;
}

/* Badge diagonal (45 grados) */
.popular-badge.badge-diagonal {
    top: 20px;
    right: -35px;
    padding: 5px 40px;
    transform: rotate(45deg);
    min-width: 100px;
    text-align: center;
}

/* Badge vertical */
.popular-badge.badge-vertical {
    top: 10px;
    right: 10px;
    padding: 10px 5px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    border-radius: 5px;
    min-height: 80px;
    text-align: center;
}

/* Badge de esquina */
.popular-badge.badge-corner {
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    overflow: hidden;
    padding: 0;
}

.popular-badge.badge-corner span {
    position: absolute;
    top: 20px;
    right: -25px;
    transform: rotate(45deg);
    width: 120px;
    text-align: center;
    padding: 5px 0;
}

.pack-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.pack-badge {
    text-align: center;
    margin-bottom: 20px;
}

.pack-badge img {
    max-width: 150px;
    height: auto;
}

.pack-features {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 20px;
}

.pack-features li {
    margin-bottom: 8px;
    font-size: 14px;
}

.pack-content {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

/* Estilos para el precio */
.pack-price {
    margin-bottom: 20px;
    text-align: center;
}

/* Precio principal */
.pack-price .price {
    display: block;
    font-weight: bold;
    font-size: 1.4em;
    margin-bottom: 5px;
}

/* Texto adicional (período o cuota de registro) */
.pack-price .subscription-period {
    display: block;
    font-size: 0.7em;
    color: #777;
    margin-top: 2px;
    line-height: 1.2;
}

.pack-price .registration-fee {
    font-size: 0.7em;
    color: #777;
    margin-top: 2px;
    line-height: 1.2;
}

.pack-price .loading {
    display: inline-block;
    padding: 3px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 14px;
    color: #666;
}

/* Contenedor para los controles de compra (cantidad y botón) */
.subscription-form.cart {
    margin-top: auto;
    padding-top: 15px;
    position: relative;
    z-index: 5;
    width: 100%;
    box-sizing: border-box;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 40px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qty {
    flex: 1;
    height: 40px;
    text-align: center;
    border: none;
    -moz-appearance: textfield;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 0;
    margin: 0;
    min-width: 40px;
}

.qty::-webkit-outer-spin-button,
.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pack-container .single_add_to_cart_button,
.pack-container .single_add_to_cart_button:focus,
.pack-container .single_add_to_cart_button:active,
.pack-container .single_add_to_cart_button:visited,
.pack-container .single_add_to_cart_button:hover {
    padding: 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    width: 100% !important;
    height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
}

.pack-container .consult-button,
.pack-container .consult-button:focus,
.pack-container .consult-button:active,
.pack-container .consult-button:visited,
.pack-container .consult-button:hover {
    padding: 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    width: 100% !important;
    height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
}

/* Estilos para colocar packs en fila */
.packs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch;
}

.packs-row .pack-container {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Aseguramos que todas las tarjetas tengan la misma altura */
@media (min-width: 769px) {
    .packs-row {
        align-items: stretch;
        display: flex;
    }
    
    .packs-row .pack-container {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .pack-container > *:not(.subscription-form) {
        flex: 0 0 auto;
    }
    
    .subscription-form.cart {
        margin-top: auto;
    }
}

/* Estilos para el modal */
.sn4p-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.sn4p-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.sn4p-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.sn4p-modal-close:hover {
    color: #333;
}

.consult-form .form-group {
    margin-bottom: 15px;
}

.consult-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.consult-form input,
.consult-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.consult-form .form-actions {
    text-align: right;
    margin-top: 20px;
}

.consult-submit {
    background: #4a6ee0;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.consult-submit:hover {
    background: #3a5ec4;
}

.consult-response {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

.consult-response.success {
    background-color: #d4edda;
    color: #3c763d;
    border: 1px solid #c3e6cb;
}

.consult-response.error {
    background-color: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

/* Estilos para el input de cantidad */
.sn4p-quantity {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 15px !important;
    width: 100% !important;
    border: 1px solid #e2e2e2 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
}

.sn4p-quantity .minus.sn4p-qty-btn,
.sn4p-quantity .plus.sn4p-qty-btn {
    background-color: #f5f5f5 !important;
    border: none !important;
    color: #333 !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: bold !important;
    height: 40px !important;
    width: 40px !important;
    padding: 0 !important;
    text-align: center !important;
    transition: background-color 0.3s !important;
}

.sn4p-quantity .minus.sn4p-qty-btn:hover,
.sn4p-quantity .plus.sn4p-qty-btn:hover {
    background-color: #e0e0e0 !important;
}

.sn4p-quantity .sn4p-qty {
    border: none !important;
    text-align: center !important;
    width: calc(100% - 80px) !important;
    padding: 10px 0 !important;
    height: 40px !important;
    font-size: 16px !important;
    -webkit-appearance: textfield !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

.sn4p-quantity .sn4p-qty::-webkit-outer-spin-button,
.sn4p-quantity .sn4p-qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Mensaje antes del botón de compra */
.sn4p-form-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 10;
    display: block;
    clear: both;
    box-sizing: border-box;
}

.sn4p-form-message.show {
    opacity: 1;
    transform: translateY(0);
}

.sn4p-form-message-success {
    background-color: #dff0d8;
    color: #3c763d;
    border: 1px solid #c3e6cb;
}

.sn4p-form-message-error {
    background-color: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

/* Enlace Ver carrito */
.sn4p-view-cart-link {
    display: block;
    text-align: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    position: relative;
    z-index: 10;
    clear: both;
    box-sizing: border-box;
}

.sn4p-view-cart-link:hover {
    text-decoration: underline;
    color: #555;
}

/* Botón de compra */
.single_add_to_cart_button {
    margin-bottom: 5px !important;
}

/* Estilo para botón en estado de carga */
.single_add_to_cart_button.loading {
    opacity: 0.7;
    position: relative;
}

.single_add_to_cart_button.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    margin-top: -7px;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sn4p-spin 0.8s infinite linear;
}

@keyframes sn4p-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .packs-row {
        flex-direction: column;
    }
    
    .global-period-selector {
        flex-wrap: wrap;
    }
    
    .global-period-selector .period-button {
        margin: 5px;
        flex: 1 0 40%;
        text-align: center;
    }
}

/* Ocultar enlaces "Ver carrito" de WooCommerce */
.pack-container .added_to_cart,
.pack-container .added_to_cart.wc-forward {
    display: none !important;
}

/* Mostrar nuestro enlace "Ver carrito" cuando está activado */
.sn4p-view-cart-link {
    display: block;
    text-align: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    position: relative;
    z-index: 10;
    clear: both;
    box-sizing: border-box;
}

.sn4p-view-cart-link:hover {
    text-decoration: underline;
    color: #555;
}

/* Contenedor de formulario */
.subscription-form.cart {
    position: relative;
    z-index: 5;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Botón de compra */
.subscription-form.cart .single_add_to_cart_button {
    width: 100%;
    margin: 10px 0 0 0 !important;
    box-sizing: border-box;
}