/* ============================================
   MULTI CONTACT - CONSULTA MÚLTIPLE
   ============================================ */
.multi-contact-checkbox-wrapper {
    min-height: 32px;
    margin: 5px auto;
    text-align: center;
           display: inline;
               float: right;
    padding-right: 5px;
}

/* Label contenedor */
.multi-contact-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #f0f4ff;
    border: 1px solid #6d53a2;
    transition: all 0.2s ease;
}

.multi-contact-label:hover {
    background-color: #e0e8ff;
}

/* Ocultar checkbox nativo */
.multi-contact-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Checkmark personalizado */
.multi-contact-checkmark {
    width: 18px;
    height: 18px;
    background-color: #fff;
    border: 2px solid #6d53a2;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
    transition: all 0.2s ease;
}

/* Checkmark cuando está seleccionado */
.multi-contact-checkbox:checked + .multi-contact-checkmark {
    background-color: #6d53a2;
}

/* El tick del checkbox */
.multi-contact-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.multi-contact-checkbox:checked + .multi-contact-checkmark:after {
    display: block;
}

/* Texto del checkbox */
.multi-contact-text {
    font-size: 12px;
    color: #6d53a2;
    font-weight: 500;
}

/* Cuando está seleccionado, cambiar estilo del wrapper */
.multi-contact-label.selected {
    background-color: #6d53a2;
    border-color: #6d53a2;
}

.multi-contact-label.selected .multi-contact-text {
    color: #fff;
}

/* ============================================
   BOTÓN FLOTANTE - BASE (DESKTOP)
   ============================================ */

.multi-contact-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: none;
}

.multi-contact-floating-btn .btn-multi-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
}

.multi-contact-floating-btn .btn-multi-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.5);
}

.multi-contact-floating-btn .btn-multi-contact:active {
    transform: translateY(0);
}

.multi-contact-floating-btn .btn-multi-contact i {
    margin-right: 8px;
    font-size: 16px;
}

.multi-contact-floating-btn .selected-count {
    display: none;
    background-color: #fff;
    color: #c62828;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
    line-height: 24px;
    text-align: center;
}

.multi-contact-floating-btn.has-selection .selected-count {
    display: inline-block;
}

.multi-contact-floating-btn.active .btn-multi-contact {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.multi-contact-floating-btn.active .btn-multi-contact:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

/* ============================================
   BOTÓN LIMPIAR - DESKTOP
   ============================================ */

.btn-clear-selection {
    display: none;
    position: absolute;
    left: -45px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #dc3545;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.btn-clear-selection:hover {
    background-color: #c82333;
    transform: translateY(-50%) scale(1.1);
}

.multi-contact-floating-btn.has-selection .btn-clear-selection {
    display: flex;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}

.btn-clear-selection.pulse {
    animation: pulse 0.3s ease;
}

/* ============================================
   MODAL
   ============================================ */

#multiContactModal .modal-header {
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    color: #fff;
    border-radius: 5px 5px 0 0;
}

#multiContactModal .modal-title {
    font-weight: 600;
}

#multiContactModal .close {
    color: #fff;
    opacity: 0.8;
}

#multiContactModal .close:hover {
    opacity: 1;
}

#multiContactModal .selected-comercios-list {
    max-height: 150px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    -webkit-overflow-scrolling: touch;
    position: relative;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: scroll-position;
    padding-right: 5px;
}

#selectedComerciosList::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
}

#selectedComerciosList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#selectedComerciosList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#selectedComerciosList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#multiContactModal .selected-comercio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: #fff;
    border-radius: 3px;
    margin-bottom: 5px;
    font-size: 13px;
}

#multiContactModal .selected-comercio-item:last-child {
    margin-bottom: 0;
}

#multiContactModal .selected-comercio-item .remove-comercio {
    color: #dc3545;
    cursor: pointer;
    font-size: 16px;
}

#multiContactModal .selected-comercio-item .remove-comercio:hover {
    color: #c82333;
}

#multiContactModal .form-group label {
    font-weight: 500;
    color: #333;
}

#multiContactModal .btn-send-multi {
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    border: none;
    padding: 10px 30px;
    font-weight: 600;
}

#multiContactModal .btn-send-multi:hover {
    background: linear-gradient(135deg, #b71c1c 0%, #c62828 100%);
}

.multi-contact-limit-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    padding: 10px 20px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
    color: #856404;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: none;
}

.recaptcha-loading {
    padding: 15px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.recaptcha-loading i {
    margin-right: 8px;
}

#multiContactRecaptcha iframe {
    max-width: 100%;
}

.message-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

input.error,
textarea.error {
    border-color: #dc3545;
}

/* ============================================
   MOBILE - TRANSICIONES SUAVES
   ============================================ */

@media (max-width: 767px) {
    
    /* ============================================
       CONTENEDOR PRINCIPAL
       Posición fija, transiciones suaves
       ============================================ */
    
    .multi-contact-floating-btn {
        bottom: auto;
        top: 50%;
        right: 0;
        left: auto;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        gap: 0;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* ============================================
       BOTÓN PRINCIPAL
       Se expande/contrae suavemente
       ============================================ */
    
    .multi-contact-floating-btn .btn-multi-contact {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
        width: 54px;
        height: 54px;
        border-radius: 27px 0 0 27px;
        background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
        box-shadow: -2px 2px 10px rgba(198, 40, 40, 0.3);
        gap: 0;
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .multi-contact-floating-btn .btn-multi-contact:hover,
    .multi-contact-floating-btn .btn-multi-contact:active {
        transform: none;
        box-shadow: -2px 2px 10px rgba(198, 40, 40, 0.3);
    }
    
    .multi-contact-floating-btn .btn-multi-contact i {
        font-size: 20px;
        margin: 0;
        flex-shrink: 0;
        transition: margin 0.3s ease;
    }
    
    /* Texto oculto inicialmente */
    .multi-contact-floating-btn .btn-multi-contact .btn-text {
        display: block;
        white-space: nowrap;
        max-width: 0;
        opacity: 0;
        overflow: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Contador y clear ocultos inicialmente */
    .multi-contact-floating-btn .selected-count,
    .multi-contact-floating-btn .btn-clear-selection {
        display: none !important;
    }
    
    /* ============================================
       ESTADO 2: EXPANDIDO
       El botón crece hacia la izquierda
       ============================================ */
    
    .multi-contact-floating-btn.expanded .btn-multi-contact {
        width: auto;
        padding: 0 24px;
        gap: 12px;
    }
    
    .multi-contact-floating-btn.expanded .btn-multi-contact i {
        margin-right: 0;
    }
    
    .multi-contact-floating-btn.expanded .btn-multi-contact .btn-text {
        max-width: 200px;
        opacity: 1;
        font-weight: 600;
        font-size: 15px;
    }
    
    /* ============================================
       ESTADO 3: SELECCIÓN ACTIVA
       Vuelve a ser compacto, con contador y X
       ============================================ */
    
    .multi-contact-floating-btn.active {
        gap: 10px;
        right: 0;
    }
    
    .multi-contact-floating-btn.active .btn-multi-contact {
        width: auto;
        min-width: 54px;
        padding: 0 18px;
        gap: 10px;
        background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
        box-shadow: -2px 2px 10px rgba(76, 175, 80, 0.3);
        border-radius: 27px 0 0 27px;
    }
    
    .multi-contact-floating-btn.active .btn-multi-contact .btn-text {
        max-width: 0;
        opacity: 0;
    }
    
    /* Contador visible */
    .multi-contact-floating-btn.active .selected-count {
        display: inline-flex !important;
        position: relative;
        top: auto;
        right: auto;
        margin: 0;
        background-color: #fff;
        color: #4caf50;
        min-width: 26px;
        height: 26px;
        border-radius: 13px;
        font-size: 14px;
        font-weight: bold;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        transition: all 0.2s ease;
    }
    
    .multi-contact-floating-btn.active .selected-count:active {
        transform: scale(0.95);
    }
    
    /* Animación pulso en contador */
    .multi-contact-floating-btn.active.has-selection .selected-count {
        animation: pulse-hint 2s ease-in-out infinite;
    }
    
    @keyframes pulse-hint {
        0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        50% { box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4); }
    }
    
    /* Botón X */
    .multi-contact-floating-btn.active .btn-clear-selection {
        display: flex !important;
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        order: -1;
        width: 42px;
        height: 42px;
        background-color: #dc3545;
        border: none;
        border-radius: 50%;
        color: #fff;
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        opacity: 0;
        margin-left: -52px;
        animation: slideInClear 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        animation-delay: 0.1s;
    }
    
    @keyframes slideInClear {
        from {
            opacity: 0;
            margin-left: -52px;
        }
        to {
            opacity: 1;
            margin-left: 0;
        }
    }
    
    .multi-contact-floating-btn.active .btn-clear-selection i {
        font-size: 16px;
    }
    
    .multi-contact-floating-btn.active .btn-clear-selection:active {
        transform: scale(0.95);
        background-color: #c82333;
    }
    
    /* ============================================
       CHECKBOX WRAPPER - MOBILE
       ============================================ */
    
    .multi-contact-checkbox-wrapper {
        min-height: 28px;
        margin: 3px 0;
    }
    
    .multi-contact-label {
        padding: 4px 8px;
    }
    
    .multi-contact-checkmark {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }
    
    .multi-contact-checkmark:after {
        left: 4px;
        top: 1px;
        width: 4px;
        height: 8px;
    }
    
    .multi-contact-text {
        font-size: 11px;
    }
    
    /* ============================================
       ANIMACIÓN LIMPIAR
       ============================================ */
    
    @keyframes pulse-clear {
        0% { transform: scale(1); }
        50% { transform: scale(1.1); }
        100% { transform: scale(1); }
    }
    
    .multi-contact-floating-btn.active .btn-clear-selection.pulse {
        animation: pulse-clear 0.25s ease;
    }
    
    /* ============================================
       ALERTA LÍMITE
       ============================================ */
    
    .multi-contact-limit-alert {
        top: auto;
        bottom: auto;
        top: 50%;
        transform: translateY(-100px);
        left: 10px;
        right: 10px;
        font-size: 13px;
    }
}

/* ============================================
   PANTALLAS MUY PEQUEÑAS
   ============================================ */

@media (max-width: 360px) {
    .multi-contact-floating-btn.expanded .btn-multi-contact {
        padding: 0 18px;
    }
    
    .multi-contact-floating-btn.expanded .btn-multi-contact .btn-text {
        font-size: 14px;
    }
    
    .multi-contact-floating-btn.active .btn-multi-contact {
        padding: 0 14px;
        min-width: 50px;
        height: 50px;
    }
    
    .multi-contact-floating-btn.active .btn-clear-selection {
        width: 38px;
        height: 38px;
    }
    
    .multi-contact-floating-btn.active .selected-count {
        min-width: 24px;
        height: 24px;
        font-size: 13px;
    }
}