/* ==========================================
   ESTILOS PARA FUNCIONALIDAD DE RESCATE
   ========================================== */

/* Botones de rescate */
.rescue-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rescue-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.rescue-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.rescue-btn:hover::before {
    left: 100%;
}

/* Badges de inactividad */
.inactive-badge {
    animation: pulse-warning 2s infinite;
    font-size: 0.7rem;
    font-weight: 600;
}

@keyframes pulse-warning {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.05);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* Modal de rescate mejorado */
.rescue-modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.rescue-modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    animation: rescueModalSlideIn 0.4s ease-out;
}

@keyframes rescueModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Preview de plantilla en modal de rescate */
.template-preview-rescue {
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
    position: relative;
    overflow: hidden;
}

.template-preview-rescue::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ffc107, #ff8f00, #ffc107);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.message-bubble-preview {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
}

/* Variables de rescate */
.rescue-variable-input {
    margin-bottom: 1rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 5px solid #ffc107;
    transition: all 0.3s ease;
}

.rescue-variable-input:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.rescue-variable-input .form-label {
    font-weight: 700;
    color: #495057;
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
}

.rescue-variable-input .form-label::before {
    content: '●';
    color: #ffc107;
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.rescue-variable-input .form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: white;
}

.rescue-variable-input .form-control:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.1);
    transform: scale(1.02);
}

/* Conversaciones inactivas en la lista */
.conversation-item.inactive {
    border-left: 4px solid #ffc107;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.05) 0%, transparent 100%);
}

.conversation-item.inactive .conversation-avatar {
    border: 2px solid #ffc107;
    position: relative;
}

.conversation-item.inactive .conversation-avatar::after {
    content: '⚠';
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ffc107;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Efectos hover mejorados */
.rescue-conversation-btn:hover {
    background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    color: white;
    border-color: #ffc107;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 193, 7, 0.4);
}

/* Estados de carga para rescate */
.rescue-loading {
    position: relative;
    overflow: hidden;
}

.rescue-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 193, 7, 0.1);
    animation: rescue-pulse 1.5s infinite;
}

@keyframes rescue-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rescue-variable-input {
        padding: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .template-preview-rescue {
        padding: 1rem;
    }
    
    .message-bubble-preview {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* Success state para rescate enviado */
.rescue-success {
    text-align: center;
    padding: 2rem;
    animation: rescueSuccess 0.6s ease-out;
}

@keyframes rescueSuccess {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.rescue-success .success-icon {
    font-size: 4rem;
    color: #28a745;
    margin-bottom: 1rem;
    animation: bounce 0.8s ease-out;
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0,-20px,0);
    }
    70% {
        transform: translate3d(0,-10px,0);
    }
    90% {
        transform: translate3d(0,-4px,0);
    }
}