/* =========================================
   VERSION COMPACTA DEL SELECTOR (Dentro del Carrier)
   ========================================= */

.dropgo-place-selector.small-selector {
    gap: 10px;
}

.dropgo-place-card.compact {
    padding: 8px 5px;
    min-height: 60px;
    border-width: 1px;
}

.dropgo-place-card.compact .place-icon {
    margin-bottom: 4px;
}

.dropgo-place-card.compact .place-icon svg {
    width: 20px;
    height: 20px;
}

.dropgo-place-card.compact .place-name {
    font-size: 11px;
}

.dropgo-place-option input:checked + .dropgo-place-card.compact {
    background: #eafcfd;
    border-color: #2fb5d2;
    box-shadow: none;
}

.dropgo-rates-grid {
    margin-bottom: 0;
}

/* =========================================
   CONTENEDOR PRINCIPAL Y SPINNER
   ========================================= */

.dropgo-rates-container {
    position: relative;
    transition: opacity 0.2s ease-in-out;
    min-height: 80px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-top: 10px;
}

.dropgo-rates-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.dropgo-rates-container.loading .dropgo-rate-option-card {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.dropgo-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
}

.dropgo-rates-container.loading .dropgo-loader {
    display: block;
}

.dropgo-spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #2fb5d2;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 0.8s linear infinite;
}

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

/* =========================================
   🔥 DESCRIPCIÓN DE TARIFA SELECCIONADA
   ========================================= */

.dropgo-rate-description {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8ff 100%);
    border: 1px solid #2196f3;
    border-left: 4px solid #2196f3;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
    transition: all 0.3s ease;
}

.dropgo-description-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #2196f3;
    margin-top: 2px;
}

.dropgo-description-icon svg {
    width: 100%;
    height: 100%;
}

.dropgo-description-content {
    flex: 1;
}

.dropgo-description-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1565c0;
    margin-bottom: 6px;
}

#dropgo-description-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #424242;
}

/* =========================================
   🔥 SEPARADOR INFERIOR (Margen entre transportes)
   ========================================= */

.dropgo-bottom-separator {
    height: 20px;
    margin-top: 15px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

/* =========================================
   TÍTULO DE TARIFAS
   ========================================= */

.dropgo-rates-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    font-size: 15px;
}

/* =========================================
   CONTENEDOR GENERAL
   ========================================= */

.dropgo-container {
    margin-bottom: 20px;
}

.dropgo-container .form-group {
    margin-bottom: 15px;
}

/* =========================================
   OCULTAR CAMPOS NATIVOS
   ========================================= */

#delivery-address .form-group:has(input[name="city"]),
#invoice-address .form-group:has(input[name="city"]),
#delivery-address .form-group:has(select[name="id_state"]),
#invoice-address .form-group:has(select[name="id_state"]) {
    display: none !important;
}

/* =========================================
   GOOGLE MAPS AUTOCOMPLETE
   ========================================= */

.pac-container {
    z-index: 10000;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.pac-item {
    padding: 10px;
    cursor: pointer;
}

.pac-item:hover {
    background-color: #f5f5f5;
}

.pac-item-query {
    font-weight: bold;
}

/* =========================================
   SELECTOR DE TIPO DE LUGAR (SVG)
   ========================================= */

.dropgo-place-selector {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-bottom: 5px;
}

.dropgo-place-option {
    flex: 1;
    cursor: pointer;
    margin: 0;
    position: relative;
    min-width: 0;
}

.dropgo-place-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dropgo-place-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s ease;
    height: 100%;
    color: #555;
    text-align: center;
    min-height: 95px;
}

.place-icon {
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.place-icon svg {
    width: 28px;
    height: 28px;
    color: #888;
    transition: all 0.2s ease;
}

.place-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.dropgo-place-option:hover .dropgo-place-card {
    border-color: #b3b3b3;
    background: #f9f9f9;
    transform: translateY(-1px);
}

.dropgo-place-option input:checked + .dropgo-place-card {
    border-color: #2fb5d2;
    background: #eafcfd;
    box-shadow: 0 4px 10px rgba(47, 181, 210, 0.2);
    transform: translateY(-2px);
}

.dropgo-place-option input:checked + .dropgo-place-card .place-icon svg {
    color: #2fb5d2;
    stroke-width: 2.5;
    transform: scale(1.15);
}

.dropgo-place-option input:checked + .dropgo-place-card .place-name {
    color: #2fb5d2;
    font-weight: 700;
}

/* =========================================
   GRID DE TARIFAS (DISEÑO TARJETAS)
   ========================================= */

.dropgo-rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    width: 100%;
    margin-bottom: 8px;
}

.dropgo-rate-option-card {
    position: relative;
    margin: 0;
    cursor: pointer;
    min-height: 85px;
}

.dropgo-rate-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dropgo-rate-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 85px;
    padding: 14px 12px;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
}

.dropgo-rate-content .rate-name {
    font-size: 13px;
    color: #666;
    line-height: 1.3;
    margin-bottom: 8px;
    font-weight: 500;
}

.dropgo-rate-content .rate-price {
    font-size: 16px;
    color: #333;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.dropgo-rate-option-card:hover .dropgo-rate-content {
    border-color: #2fb5d2;
    background: #fcfcfc;
    box-shadow: 0 2px 8px rgba(47, 181, 210, 0.1);
    transform: translateY(-2px);
}

.dropgo-rate-option-card input:checked + .dropgo-rate-content {
    border-color: #2fb5d2;
    border-width: 3px;
    background: #eafcfd;
    box-shadow: 0 4px 12px rgba(47, 181, 210, 0.25);
    transform: translateY(-2px);
}

.dropgo-rate-option-card input:checked + .dropgo-rate-content .rate-name {
    color: #1a8a9f;
    font-weight: 600;
}

.dropgo-rate-option-card input:checked + .dropgo-rate-content .rate-price {
    color: #1a8a9f;
    font-size: 17px;
}

.dropgo-rate-option-card::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: #fff;
    transition: all 0.2s ease;
    z-index: 1;
}

.dropgo-rate-option-card:has(input:checked)::after {
    background: #2fb5d2;
    border-color: #2fb5d2;
    box-shadow: inset 0 0 0 4px #fff;
}

/* =========================================
   ADVERTENCIA DE SELECCIÓN REQUERIDA
   ========================================= */

.dropgo-selection-warning {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeInShake 0.4s ease-out;
}

.dropgo-selection-warning svg,
.dropgo-selection-warning .material-icons {
    color: #ffc107;
    flex-shrink: 0;
}

@keyframes fadeInShake {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   MENSAJE DE AYUDA
   ========================================= */

.dropgo-help-text {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.dropgo-help-text svg {
    flex-shrink: 0;
    color: #666;
    margin-top: 1px;
}

/* =========================================
   RESPONSIVE (MÓVIL)
   ========================================= */

@media (max-width: 768px) {
    .dropgo-rates-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .dropgo-rate-description {
        flex-direction: column;
        gap: 8px;
    }
    
    .dropgo-description-icon {
        align-self: flex-start;
    }
}

@media (max-width: 576px) {
    .dropgo-place-selector {
        gap: 8px;
    }
    
    .dropgo-place-card {
        padding: 12px 8px;
        min-height: 85px;
    }
    
    .place-icon svg {
        width: 24px;
        height: 24px;
        margin-bottom: 6px;
    }
    
    .place-name {
        font-size: 12px;
    }
    
    .dropgo-rates-container {
        padding: 12px;
    }
    
    .dropgo-rate-description {
        padding: 12px;
    }
}

@media (max-width: 400px) {
    .dropgo-rates-grid {
        grid-template-columns: 1fr;
    }
    
    .dropgo-rate-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        min-height: 60px;
    }
    
    .dropgo-rate-content .rate-name {
        margin-bottom: 0;
        text-align: left;
        flex: 1;
    }
    
    .dropgo-rate-content .rate-price {
        text-align: right;
        margin-left: 10px;
    }
}

/* =========================================
   ESTADO DISABLED DEL BOTÓN
   ========================================= */

button.dropgo-blocked {
    opacity: 0.5;
    cursor: not-allowed !important;
    position: relative;
}

button.dropgo-blocked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: not-allowed;
}

/* =========================================
   ALERTA DIRECCION EN FORMULARIO
   ========================================= */

/* Efecto Neón Rojo para Error */
.dropgo-input-error {
    border-color: #ff3333 !important;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.6) !important;
    animation: dropgoShake 0.4s ease-in-out;
}

/* Mensaje de error arriba del campo */
.dropgo-error-message {
    color: #ff3333;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes dropgoShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Ocultar transporte DropGo en carrito si no tiene precio */
.cart-summary .cart-summary-line.cart-total.shipping:has(.value:empty),
.cart-summary .cart-summary-line.cart-total.shipping:has(.value:contains("Gratis")),
.cart-summary .cart-summary-line.cart-total.shipping:has(.value:contains("$0")) {
    display: none !important;
}