/**
 * Estilos para el plugin de método de envío Zoom
 *
 * @package Dt24\MetodoZoom
 * @since 1.0.0
 */

/* Contenedor principal de campos Zoom */
/* #zoom_shipping_fields {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
} */

#zoom_shipping_fields h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

/* Campos requeridos */
.zoom-required-field {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 5px rgba(255, 107, 107, 0.3);
}

.zoom-valid-field {
    border-color: #51cf66 !important;
    box-shadow: 0 0 5px rgba(81, 207, 102, 0.3);
}

/* Indicador de carga */
.zoom-loading {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
    font-weight: bold;
}

.zoom-loading:before {
    content: "⏳ ";
    margin-right: 5px;
}

/* Costo calculado */
.zoom-cost-display {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    text-align: center;
    font-size: 16px;
}

.zoom-cost-display:before {
    content: "💰 ";
    margin-right: 5px;
}

/* Botones */
#recalcular-envio-zoom {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
    font-weight: bold;
}

#recalcular-envio-zoom:hover {
    background: #005a87;
}

#recalcular-envio-zoom:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Guía de envío */
/* .zoom-shipping-guide {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
} */

.zoom-shipping-guide h3 {
    color: #0073aa;
    margin-top: 0;
}

#download-zoom-pdf,
.download-zoom-pdf-auto {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    margin: 10px 0;
}

#download-zoom-pdf:hover,
.download-zoom-pdf-auto:hover {
    background: #218838;
}

#download-zoom-pdf:disabled,
.download-zoom-pdf-auto:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Mensajes */
.woocommerce-error,
.woocommerce-message {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.woocommerce-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.woocommerce-message {
    background: #d1ecf1;
    border-left-color: #17a2b8;
    color: #0c5460;
}

/* Campos específicos por tipo de entrega */
.office_select,
.municipality_select,
.parish_select {
    transition: all 0.3s ease;
}

/* Botón de dirección guardada - Fix de color */
.btn-current-address .address-text strong,
.zoom-select-trigger .address-text strong {
    color: #333 !important;
    font-weight: 700 !important;
}

/* === SAVED ADDRESSES UI === */
.zoom-saved-addresses-wrapper {
    margin-bottom: 15px;
}

/* Contenedor flexible para selector y botón + */
.zoom-controls-row {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.zoom-dropdown-container {
    flex: 1;
}

/* El botón que parece un Select Input */
.zoom-select-trigger {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 10px 14px;
    color: #333333;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    cursor: pointer;
    transition: border-color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.zoom-select-trigger:hover,
.zoom-select-trigger:active,
.zoom-select-trigger:focus {
    border-color: #CBD5E0;
    background: #FFFFFF !important;
}

.zoom-select-trigger > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* El icono del Pin (color rosa/magenta) */
.zoom-icon-pin {
    color: #E91E63;
    font-size: 16px;
}

/* El botón naranja de "+" */
.zoom-add-btn, .new-address-btn {
    background-color: #F26419;
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    min-width: auto !important;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.zoom-add-btn:hover, .new-address-btn:hover {
    background-color: #d4551a;
}

/* Dropdown de direcciones */
.saved-addresses-dropdown {
    margin-top: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.saved-addresses-dropdown.show {
    max-height: 300px;
}

.zoom-dropdown-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: white;
}

/* Items de la lista */
.address-item {
    padding: 16px;
    border-bottom: 1px solid #F1F1F1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFFFFF;
    cursor: pointer;
    transition: background-color 0.15s;
}

.address-item:hover {
    background: #F7FAFC;
}

.address-item:last-child {
    border-bottom: none;
}

/* Título de la dirección */
.address-item strong {
    display: block;
    color: #2D3748;
    font-size: 14px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* Texto secundario de la dirección */
.address-item > div:first-child > div {
    color: #718096;
    font-size: 13px;
    line-height: 1.4;
}

/* Botón de eliminar (Papelera) */
.delete-address-btn {
    color: #CBD5E0 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
}

.delete-address-btn svg {
    width: 18px;
    height: 18px;
}

.delete-address-btn:hover {
    color: #E53E3E !important;
}

/* Checkbox Superior */
#zoom-destination-mode {
    background: transparent;
    padding: 10px 0;
    margin-bottom: 10px;
    border: none;
}

#zoom-destination-mode label {
    font-weight: 600;
    color: #4A5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Layout optimizado de campos Zoom - 2 columnas en desktop */
#zoom-form-fields-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 -8px;
}

#zoom-form-fields-wrapper > p {
    flex: 0 0 calc(50% - 16px);
    margin: 0 8px 16px 8px;
    box-sizing: border-box;
}

/* Selects con ancho máximo */
#zoom-form-fields-wrapper select {
    width: 100% !important;
    max-width: 100% !important;
}

/* Campos que deben ocupar ancho completo */
#zoom-form-fields-wrapper > p#direccion_entrega_field,
#zoom-form-fields-wrapper > p#lugar_entrega_field,
#zoom-form-fields-wrapper > p#punto_referencia_field,
#zoom-form-fields-wrapper > div#zoom-loading-indicator {
    flex: 0 0 calc(100% - 16px);
}

/* Responsive */
@media (max-width: 768px) {
    #zoom_shipping_fields {
        padding: 15px;
        margin: 15px 0;
    }

    .zoom-cost-display {
        font-size: 14px;
        padding: 12px;
    }

    #recalcular-envio-zoom,
    #download-zoom-pdf,
    .download-zoom-pdf-auto {
        width: 100%;
        margin: 10px 0;
    }
    
    /* En mobile todos los campos full width */
    #zoom-form-fields-wrapper > p {
        flex: 0 0 calc(100% - 16px);
    }
    
    /* Saved addresses responsive */
    .zoom-controls-row {
        flex-wrap: nowrap;
    }
    
    .zoom-select-trigger {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .zoom-add-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.zoom-cost-display,
.zoom-loading,
.woocommerce-error,
.woocommerce-message {
    animation: fadeIn 0.3s ease;
}

/* Estados de campos select */
select:disabled {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

select option:disabled {
    color: #999;
}

/* Tooltips para campos */
.zoom-field-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 5px;
    color: #666;
}

.zoom-field-tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    font-size: 12px;
}

.zoom-field-tooltip:hover:before {
    content: "";
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 1000;
}
