/**
 * Estilos para campos personalizados de tarjetas de regalo
 * Frontend - Página de producto
 */

.saks-gc-product-fields {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 20px 0 25px 0;
}

.saks-gc-fields-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    padding: 0 0 15px 0;
    border-bottom: 2px solid #2271b1;
}

.saks-gc-field-group {
    margin-bottom: 18px;
}

.saks-gc-field-group:last-child {
    margin-bottom: 0;
}

.saks-gc-field-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.saks-gc-field-group label .required {
    color: #dc3232;
    font-weight: bold;
}

.saks-gc-field-group label .optional {
    color: #757575;
    font-weight: normal;
    font-size: 13px;
}

.saks-gc-input,
.saks-gc-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.saks-gc-input:focus,
.saks-gc-textarea:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.saks-gc-input.error,
.saks-gc-textarea.error {
    border-color: #dc3232;
}

.saks-gc-input.error:focus,
.saks-gc-textarea.error:focus {
    box-shadow: 0 0 0 1px #dc3232;
}

.saks-gc-textarea {
    resize: vertical;
    min-height: 100px;
}

.saks-gc-field-description {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    font-style: italic;
}

.saks-gc-char-counter {
    text-align: right;
    color: #757575;
    font-style: normal;
}

.saks-gc-char-counter .char-count {
    font-weight: 600;
    color: #333;
}

.saks-gc-char-counter.warning .char-count {
    color: #f0ad4e;
}

.saks-gc-char-counter.limit .char-count {
    color: #dc3232;
}

/* Error messages */
.saks-gc-error-message {
    display: none;
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
}

.saks-gc-field-group.has-error .saks-gc-error-message {
    display: block;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .saks-gc-product-fields {
        padding: 20px 15px;
    }
    
    .saks-gc-fields-title {
        font-size: 16px;
    }
    
    .saks-gc-input,
    .saks-gc-textarea {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Compatibilidad con diferentes temas */
.woocommerce div.product form.cart .saks-gc-product-fields {
    clear: both;
}

/* Animación de entrada */
.saks-gc-product-fields {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.saks-gc-product-fields.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success state */
.saks-gc-field-group.success .saks-gc-input,
.saks-gc-field-group.success .saks-gc-textarea {
    border-color: #46b450;
}

/* Placeholder personalizado */
.saks-gc-input::placeholder,
.saks-gc-textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* Estilos para cart y checkout */
.woocommerce-cart-form .saks-gc-cart-data,
.woocommerce-checkout .saks-gc-order-data {
    font-size: 13px;
    line-height: 1.6;
}

.woocommerce-cart-form .saks-gc-cart-data dt,
.woocommerce-checkout .saks-gc-order-data dt {
    font-weight: 600;
    color: #333;
}

.woocommerce-cart-form .saks-gc-cart-data dd,
.woocommerce-checkout .saks-gc-order-data dd {
    margin: 0 0 8px 0;
    color: #666;
}

/* ========================================
   MODAL DE RESTRICCIONES DEL CARRITO
   ======================================== */

.saks-gc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.saks-gc-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.saks-gc-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    margin: 20px;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.saks-gc-modal-overlay.active .saks-gc-modal {
    transform: scale(1) translateY(0);
}

.saks-gc-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.saks-gc-modal-header h3 {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.saks-gc-modal-body {
    padding: 25px;
}

.saks-gc-modal-body p {
    margin: 0;
    padding: 0;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

.saks-gc-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.saks-gc-modal-footer .saks-gc-modal-btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.saks-gc-modal-footer .saks-gc-btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.saks-gc-modal-footer .saks-gc-btn-cancel:hover {
    background: #e0e0e0;
}

.saks-gc-modal-footer .saks-gc-btn-accept {
    background: #2271b1;
    color: #fff;
}

.saks-gc-modal-footer .saks-gc-btn-accept:hover {
    background: #135e96;
}

.saks-gc-modal-footer .saks-gc-btn-accept:disabled,
.saks-gc-modal-footer .saks-gc-btn-cancel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive para el modal */
@media screen and (max-width: 600px) {
    .saks-gc-modal {
        max-width: 100%;
        margin: 15px;
    }
    
    .saks-gc-modal-header h3 {
        font-size: 18px;
    }
    
    .saks-gc-modal-body p {
        font-size: 14px;
    }
    
    .saks-gc-modal-footer {
        flex-direction: column-reverse;
    }
    
    .saks-gc-modal-footer .saks-gc-modal-btn {
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   CHECKOUT - TARJETA DE REGALO
   ======================================== */

.saks-gift-card-checkout-row {
    border-top: 2px solid #2271b1 !important;
}

.saks-gift-card-checkout-cell {
    padding: 0 !important;
    background: transparent !important;
}

.saks-gift-card-checkout {
    background: #f9f9f9;
    border: none;
    border-radius: 0;
    padding: 20px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.saks-gift-card-checkout h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.saks-gift-card-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saks-gift-card-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.saks-gift-card-form .form-row {
    margin: 0;
}

.saks-gift-card-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.saks-gift-card-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.saks-gift-card-form input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.saks-apply-gift-card {
    background: #2271b1;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.saks-apply-gift-card:hover {
    background: #135e96;
}

.saks-select-my-card {
    background: #f0f0f0;
    color: #333;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.saks-select-my-card:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.saks-select-my-card svg {
    width: 16px;
    height: 16px;
}

.saks-apply-gift-card:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.saks-gift-card-message {
    margin-top: 10px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.saks-gift-card-message.show {
    display: block;
}

.saks-gift-card-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.saks-gift-card-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.saks-gift-card-applied {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 15px;
}

.saks-gift-card-success {
    color: #155724;
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.saks-gift-card-success strong {
    display: inline-block;
    min-width: 150px;
}

.saks-gift-card-success .card-number,
.saks-gift-card-success .card-balance,
.saks-gift-card-success .card-applied {
    color: #0f4520;
    font-weight: 600;
}

.saks-remove-gift-card {
    background: #dc3232;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.saks-remove-gift-card:hover {
    background: #b32d2e;
}

/* Loading spinner para el botón */
.saks-apply-gift-card.loading::after,
.saks-remove-gift-card.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .saks-gift-card-checkout {
        padding: 15px;
    }
    
    .saks-gift-card-checkout h3 {
        font-size: 16px;
    }
    
    .saks-gift-card-form input {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .saks-gift-card-buttons {
        flex-direction: column;
    }
    
    .saks-apply-gift-card,
    .saks-remove-gift-card,
    .saks-select-my-card {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Modal de selecci\u00f3n de tarjetas */
.saks-cards-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.saks-cards-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.saks-cards-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.saks-cards-modal-overlay.active .saks-cards-modal {
    transform: scale(1);
}

.saks-cards-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saks-cards-modal-header h3 {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.saks-cards-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

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

.saks-cards-modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.saks-cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saks-card-item {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.saks-card-item:hover {
    border-color: #2271b1;
    background: #f8f9fa;
}

.saks-card-item.selected {
    border-color: #2271b1;
    background: #e7f3ff;
}

.saks-card-item input[type=\"radio\"] {
    margin-right: 12px;
}

.saks-card-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
    margin: 0;
    width: 100%;
}

.saks-card-info {
    flex: 1;
}

.saks-card-number {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
}

.saks-card-details {
    font-size: 13px;
    color: #666;
}

.saks-cards-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.saks-cards-modal-footer .saks-gc-modal-btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.saks-cards-modal-footer .saks-cards-btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.saks-cards-modal-footer .saks-cards-btn-cancel:hover {
    background: #e0e0e0;
}

.saks-cards-modal-footer .saks-cards-btn-accept {
    background: #2271b1;
    color: #fff;
}

.saks-cards-modal-footer .saks-cards-btn-accept:hover {
    background: #135e96;
}

.saks-cards-modal-footer .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.saks-cards-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.saks-cards-loading {
    text-align: center;
    padding: 40px 20px;
}

.saks-cards-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Orden completada - Vista de detalles */
.woocommerce-gift-card-details {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.woocommerce-gift-card-details h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.woocommerce-gift-card-details table {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-gift-card-details table th,
.woocommerce-gift-card-details table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.woocommerce-gift-card-details table th {
    font-weight: 600;
    color: #333;
    width: 40%;
}

.woocommerce-gift-card-details table td {
    color: #666;
}

/* CAMBIANDO ESTILOS A PRODUCTOS */
.postid-4483801 .woocommerce-variation-add-to-cart.variations_button.woocommerce-variation-add-to-cart-disabled,
.postid-4483801.single-product .product-type-variable .woocommerce-variation-add-to-cart.variations_button{
    display: block !important;
}

/* ============================================
   FORMULARIO DE LOGIN PARA TARJETAS DE REGALO
   ============================================ */

.saks-gc-login-required {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #2271b1;
    border-radius: 12px;
    /* padding: 35px; */
    padding: 20px;
    margin: 20px 0 25px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    position: relative;
    z-index: 10;
}

/* Ocultar elementos del producto cuando se muestra el login */
.product:has(.saks-gc-login-required) .price,
.product:has(.saks-gc-login-required) p.price,
.product:has(.saks-gc-login-required) .summary .price {
    display: none !important;
}

.product:has(.saks-gc-login-required) .variations,
.product:has(.saks-gc-login-required) table.variations {
    display: none !important;
}

.product:has(.saks-gc-login-required) .quantity {
    display: none !important;
}

.product:has(.saks-gc-login-required) .reset_variations {
    display: none !important;
}

.product:has(.saks-gc-login-required) .single_add_to_cart_button,
.product:has(.saks-gc-login-required) button[type="submit"][name="add-to-cart"] {
    display: none !important;
}

.saks-gc-login-message {
    text-align: center;
    margin-bottom: 30px;
}

.saks-gc-login-icon {
    color: #2271b1;
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    display: block;
    stroke-width: 1.5;
}

.saks-gc-login-title {
    font-size: 24px;
    font-weight: 700;
    color: #2271b1;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.saks-gc-login-description {
    font-size: 16px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

.saks-gc-login-button-wrapper {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.saks-gc-login-button {
    display: inline-block;
    background: #2271b1;
    color: white;
    padding: 16px 40px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid #2271b1;
    cursor: pointer;
}

.saks-gc-login-button:hover {
    background: #1a5a8a;
    border-color: #1a5a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.25);
    text-decoration: none;
    color: white;
}

.saks-gc-register-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
    color: #666;
}

.saks-gc-register-link a {
    color: #2271b1;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.saks-gc-register-link a:hover {
    color: #1a5a8a;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .saks-gc-login-required {
        padding: 25px 20px;
    }
    
    .saks-gc-login-form-wrapper {
        padding: 20px;
    }
    
    .saks-gc-login-title {
        font-size: 20px;
    }
    
    .saks-gc-login-description {
        font-size: 14px;
    }
}
