.fgw-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.fgw-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: fgwModalSlideIn 0.3s ease-out;
}

@keyframes fgwModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fgw-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.fgw-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
}

.fgw-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.fgw-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.fgw-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.fgw-gifts-counter {
    text-align: center;
    margin-bottom: 20px;
    padding: 12px;
    background: #e3f2fd;
    border-radius: 6px;
    color: #1976d2;
    font-weight: 500;
}

.fgw-gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.fgw-gift-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.fgw-gift-item:hover {
    border-color: #2196f3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
    transform: translateY(-2px);
}

.fgw-gift-item.selected {
    border-color: #4caf50;
    background: #f1f8e9;
}

.fgw-gift-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2196f3, #21cbf3);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.fgw-gift-item:hover::before {
    transform: scaleX(1);
}

.fgw-gift-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin: 0 auto 12px;
    display: block;
    border: 1px solid #eee;
}

.fgw-gift-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
    font-size: 14px;
}

.fgw-gift-select {
    background: #2196f3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fgw-gift-select:hover {
    background: #1976d2;
    transform: translateY(-1px);
}

.fgw-gift-select:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.fgw-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    text-align: right;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.fgw-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 14px;
}

.fgw-btn-secondary {
    background: #6c757d;
    color: white;
}

.fgw-btn-secondary:hover {
    background: #5a6268;
}

.fgw-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.free-gift-price {
    color: #4caf50;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fgw-gift-type {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin: 4px 0 8px 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fgw-gift-item[data-variation-id="0"] .fgw-gift-type {
    background: #e8f5e8;
    color: #2e7d32;
}

/* Asegurar que el modal funcione incluso con conflictos de CSS */
#fgw-modal-overlay {
    position: fixed ;
    top: 0 ;
    left: 0 ;
    width: 100% ;
    height: 100% ;
    background: rgba(0, 0, 0, 0.7) ;
    z-index: 999999 ;
    display: none ;
}

#fgw-modal-overlay.show {
    display: flex ;
    align-items: center ;
    justify-content: center ;
}

/* Fallback para temas que puedan interferir */
.fgw-modal {
    position: relative ;
    background: #fff ;
    border-radius: 8px ;
    max-width: 800px ;
    width: 90% ;
    max-height: 90vh ;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) ;
}

/* Debug helper - remover en producción */
.fgw-debug-modal {
    border: 2px solid red ;
}

/* Responsive */
@media (max-width: 768px) {
    .fgw-modal-overlay {
        padding: 10px;
    }
    
    .fgw-modal {
        max-height: 95vh;
    }
    
    .fgw-modal-header,
    .fgw-modal-body,
    .fgw-modal-footer {
        padding: 16px;
    }
    
    .fgw-gifts-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .fgw-gift-item {
        padding: 12px;
    }
    
    .fgw-gift-image {
        width: 60px;
        height: 60px;
    }
    
    .fgw-modal-header h3 {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .fgw-gifts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .fgw-gift-item {
        padding: 8px;
    }
    
    .fgw-gift-image {
        width: 50px;
        height: 50px;
    }
    
    .fgw-gift-name {
        font-size: 12px;
    }
    
    .fgw-gift-select {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Etiqueta de regalo en el carrito */
.fgw-gift-label {
    background: #4caf50;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    white-space: nowrap;
}

/* Precio gratis */
.free-gift-price {
    color: #4caf50 !important;
    font-weight: bold !important;
    font-size: 14px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Notice en checkout */
.fgw-checkout-notice {
    animation: fgwSlideIn 0.5s ease-out;
}

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

/* Overlay de recarga de página */
.fgw-reload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fgw-reload-overlay.show {
    opacity: 1;
}

.fgw-reload-message {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: fgwSlideUp 0.3s ease-out;
}

.fgw-reload-message h3 {
    margin: 20px 0 10px 0;
    color: #4CAF50;
    font-size: 20px;
}

.fgw-reload-message p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* Spinner de carga */
.fgw-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: fgwSpin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes fgwSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fgwSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mejorar el notice de éxito */
.fgw-notice-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    animation: fgwPulse 0.5s ease-out;
}

@keyframes fgwPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .fgw-reload-message {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .fgw-reload-message h3 {
        font-size: 18px;
    }
    
    .fgw-reload-message p {
        font-size: 14px;
    }
}

/* Estilos para selección múltiple */
.fgw-gift-item.selected {
    border-color: #4caf50;
    background: #f1f8e9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.25);
}

.fgw-gift-select.selected {
    background: #4caf50;
    color: white;
}

.fgw-gift-quantity-wrapper {
    margin-top: 10px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.fgw-gift-quantity-wrapper label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.fgw-gift-quantity {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.fgw-confirm-gifts {
    background: #2196f3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.fgw-confirm-gifts:hover {
    background: #1976d2;
    transform: translateY(-1px);
}

.fgw-btn-primary {
    margin-right: 10px;
}

/* Contador mejorado */
.fgw-gifts-counter {
    font-size: 16px;
    font-weight: bold;
    color: #2e7d32;
    margin: 10px 0;
    text-align: center;
}

/* Responsive para cantidad */
@media (max-width: 480px) {
    .fgw-gift-quantity-wrapper {
        padding: 6px;
    }
    
    .fgw-gift-quantity {
        width: 50px;
        font-size: 12px;
    }
}

.fgw-btn-ghost {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.fgw-btn-ghost:hover {
    background: #f5f5f5;
    color: #333;
    border-color: #999;
}

.fgw-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.fgw-modal-footer .fgw-btn-primary {
    order: 1;
}

.fgw-modal-footer .fgw-btn-secondary {
    order: 2;
}

.fgw-modal-footer .fgw-btn-ghost {
    order: 3;
}

.fgw-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.fgw-modal-actions-left {
    flex: 1;
}

.fgw-modal-actions-right {
    display: flex;
    gap: 10px;
}

.fgw-btn-ghost {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.fgw-btn-ghost:hover {
    background: #f5f5f5;
    color: #333;
    border-color: #999;
}