/**
 * Frontend CSS v4.0 - Ofertas en Checkout
 * Diseño profesional y elegante
 */

/* ========== HEADER PRINCIPAL ========== */
.fco-offers-main-header {
    border-top: 3px solid #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.fco-offers-main-header .fco-main-title {
    padding: 20px 25px !important;
    text-align: center;
    border: none !important;
}

.fco-title-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fco-icon {
    font-size: 28px;
    line-height: 1;
}

/* ========== CONTENEDOR DE OFERTAS ========== */
.fco-offer-container {
    border: none !important;
    background: transparent !important;
}

.fco-offer-cell {
    padding: 0 !important;
    border: none !important;
}

/* ========== CAJA DE OFERTA ========== */
.fco-offer-box {
    background: #fff;
    border: 3px solid #667eea;
    border-radius: 12px;
    padding: 25px;
    margin: 15px 0;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== HEADER DE OFERTA ========== */
.fco-offer-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.fco-offer-header h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    line-height: 1.3;
}

.fco-offer-description {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* ========== DISPLAY TYPE: CHECKBOX ========== */
.fco-display-checkbox {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fco-checkbox-item {
    position: relative;
    transition: all 0.3s ease;
}

.fco-checkbox-label {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
}

.fco-checkbox-label:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(4px);
}

.fco-checkbox-input {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
}

.fco-checkbox-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 15px;
}

.fco-checkbox-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fco-option-label {
    font-weight: 700;
    font-size: 16px;
    color: #1f2937;
}

.fco-option-product {
    font-size: 13px;
    color: #6b7280;
}

.fco-checkbox-price {
    font-size: 18px;
    font-weight: 800;
    color: #667eea;
    flex-shrink: 0;
}

.fco-checkbox-item.fco-selected .fco-checkbox-label {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.fco-checkbox-item.fco-selected .fco-option-label {
    color: #10b981;
}

/* ========== DISPLAY TYPE: SELECT ========== */
.fco-display-select {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fco-select-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 500;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

.fco-select-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #fff;
}

.fco-select-actions {
    display: flex;
    justify-content: center;
}

.fco-remove-offer-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fco-remove-offer-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ========== DISPLAY TYPE: BUTTONS ========== */
.fco-display-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.fco-button-item {
    position: relative;
}

.fco-button-option {
    width: 100%;
    padding: 20px;
    background: #f9fafb;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fco-button-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.fco-button-option.selected {
    border-color: #10b981;
    background: #ecfdf5;
    cursor: default;
}

.fco-button-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.fco-button-icon {
    font-size: 32px;
    font-weight: 700;
    color: #10b981;
    min-height: 32px;
}

.fco-button-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fco-button-label {
    font-weight: 700;
    font-size: 17px;
    color: #1f2937;
    line-height: 1.3;
}

.fco-button-product {
    font-size: 13px;
    color: #6b7280;
}

.fco-button-price {
    font-size: 22px;
    font-weight: 800;
    color: #667eea;
    margin-top: 8px;
}

.fco-button-option.selected .fco-button-price {
    color: #10b981;
}

.fco-button-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #10b981;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.fco-remove-button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.fco-remove-button:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ========== FOOTER ========== */
.fco-offer-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
}

.fco-footer-note {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    border: 1px solid #fbbf24;
}

/* ========== BADGE EN CARRITO ========== */
.fco-offer-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ========== MENSAJES ========== */
.fco-message {
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 14px;
    font-weight: 600;
    animation: slideDown 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fco-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 2px solid #10b981;
}

.fco-message.success::before {
    content: '✓';
    font-size: 18px;
    font-weight: 700;
}

.fco-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.fco-message.error::before {
    content: '✕';
    font-size: 18px;
    font-weight: 700;
}

/* ========== ESTADOS DE CARGA ========== */
.fco-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.fco-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .fco-offer-box {
        padding: 20px;
        margin: 10px 0;
    }
    
    .fco-offer-header h4 {
        font-size: 18px;
    }
    
    .fco-checkbox-label {
        padding: 12px 15px;
    }
    
    .fco-checkbox-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .fco-checkbox-price {
        font-size: 16px;
    }
    
    .fco-display-buttons {
        grid-template-columns: 1fr;
    }
    
    .fco-button-option {
        padding: 16px;
    }
    
    .fco-button-price {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .fco-title-content {
        font-size: 18px;
    }
    
    .fco-icon {
        font-size: 24px;
    }
    
    .fco-offer-box {
        padding: 15px;
        border-width: 2px;
    }
    
    .fco-option-label {
        font-size: 15px;
    }
    
    .fco-option-product {
        font-size: 12px;
    }
}

/* ========== INTEGRACIÓN WOOCOMMERCE ========== */
.woocommerce-checkout-review-order-table .fco-offers-main-header,
.woocommerce-checkout-review-order-table .fco-offer-container {
    background: transparent;
}

.woocommerce-checkout-review-order-table .fco-offers-main-header th,
.woocommerce-checkout-review-order-table .fco-offer-cell {
    border: none;
}

/* ========== DARK MODE COMPATIBLE ========== */
@media (prefers-color-scheme: dark) {
    .fco-offer-box {
        background: #1f2937;
        border-color: #4b5563;
    }
    
    .fco-offer-header {
        border-bottom-color: #374151;
    }
    
    .fco-offer-header h4 {
        color: #93c5fd;
    }
    
    .fco-offer-description {
        color: #9ca3af;
    }
    
    .fco-checkbox-label {
        background: #111827;
        border-color: #374151;
    }
    
    .fco-option-label {
        color: #f3f4f6;
    }
    
    .fco-option-product {
        color: #9ca3af;
    }
}