/* Estilos para Ubigeo Peru */

/* Asegurar que los selects tengan el ancho completo */
.ubigeo-provincia select,
.ubigeo-distrito select,
#billing_provincia,
#shipping_provincia,
#billing_city,
#shipping_city {
    width: 100% !important;
}

/* Indicador de carga */
select.ubigeo-loading {
    opacity: 0.5;
    cursor: wait;
    background-image: url('data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

/* Estado deshabilitado */
select[disabled],
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ocultar campos innecesarios para Perú */
.woocommerce-checkout.country-PE .woocommerce-billing-fields #billing_postcode_field,
.woocommerce-checkout.country-PE .woocommerce-shipping-fields #shipping_postcode_field {
    display: none !important;
}

/* Ocultar campos duplicados si existen */
#billing_departamento_field,
#billing_provincia_field,
#billing_distrito_field,
#shipping_departamento_field,
#shipping_provincia_field,
#shipping_distrito_field {
    display: none !important;
}

/* Mejorar la apariencia de los selects */
.woocommerce-checkout .form-row select {
    padding: 0.6em;
    height: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Estado hover */
.woocommerce-checkout .form-row select:hover:not(:disabled) {
    border-color: #999;
}

/* Estado focus */
.woocommerce-checkout .form-row select:focus {
    border-color: #5b9dd9;
    box-shadow: 0 0 2px rgba(91, 157, 217, 0.8);
    outline: none;
}

/* Error styling */
.woocommerce-checkout .form-row.woocommerce-invalid select {
    border-color: #e2401c;
}

.woocommerce-checkout .form-row.woocommerce-invalid label {
    color: #e2401c;
}

/* Mensaje de validación */
.woocommerce-checkout .form-row.woocommerce-invalid .woocommerce-error {
    display: block;
    margin-top: 5px;
    color: #e2401c;
    font-size: 0.875em;
}

/* Responsive */
@media (max-width: 768px) {
    .ubigeo-provincia,
    .ubigeo-distrito {
        width: 100% !important;
    }
    
    .woocommerce-checkout .col-1,
    .woocommerce-checkout .col-2 {
        width: 100%;
        float: none;
    }
}

/* Compatibilidad con temas oscuros */
@media (prefers-color-scheme: dark) {
    .woocommerce-checkout .form-row select {
        background-color: #2a2a2a;
        color: #fff;
        border-color: #444;
    }
    
    .woocommerce-checkout .form-row select:hover:not(:disabled) {
        border-color: #666;
    }
}

/* Animación de carga */
@keyframes ubigeo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ubigeo-loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: ubigeo-spin 1s linear infinite;
}