/**
 * Estilos para Widget de Soporte con Chat en Tiempo Real
 * Doctor Frontera
 */

/* ========== BOTÓN FLOTANTE ========== */
.soporte-btn-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.soporte-btn-float:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.soporte-btn-float:active {
    transform: scale(0.95);
}

.soporte-btn-icon {
    color: white;
    font-size: 28px;
    position: relative;
    z-index: 2;
    animation: bounceIcon 2s ease-in-out infinite;
}

@keyframes bounceIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Pulso animado */
.soporte-btn-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.6;
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Badge de notificaciones */
.soporte-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ========== PANEL DE SOPORTE ========== */
.soporte-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.soporte-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header del panel */
.soporte-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.soporte-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.soporte-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.soporte-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.soporte-header-text p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.soporte-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.soporte-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ========== CONTENIDO ========== */
.soporte-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.soporte-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.soporte-view.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.soporte-view-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.soporte-back-btn {
    background: #f5f7fa;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #667eea;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.soporte-back-btn:hover {
    background: #e3e8ef;
    transform: translateX(-2px);
}

.soporte-view-header h4 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

/* ========== ACCIONES RÁPIDAS ========== */
.soporte-quick-actions h4 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #2c3e50;
}

.soporte-action-btn {
    width: 100%;
    background: white;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    text-align: left;
}

.soporte-action-btn:hover {
    background: #f5f7fa;
    border-color: #667eea;
    transform: translateX(4px);
}

.action-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.action-text {
    flex: 1;
}

.action-text strong {
    display: block;
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 4px;
}

.action-text small {
    color: #8898aa;
    font-size: 12px;
}

.soporte-action-btn > i.fa-chevron-right {
    color: #c3cfe2;
    font-size: 14px;
}

/* Botón especial para Chat con IA */
.soporte-action-ia {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea;
    position: relative;
    overflow: hidden;
}

.soporte-action-ia::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.soporte-action-ia:hover {
    background: linear-gradient(135deg, #667eea25 0%, #764ba225 100%);
    border-color: #764ba2;
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.soporte-action-ia .action-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: pulse-ai 2s ease-in-out infinite;
}

@keyframes pulse-ai {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

.soporte-action-ia .action-text strong {
    color: #667eea;
    font-weight: 600;
}

.soporte-horarios {
    text-align: center;
    padding: 16px;
    background: #f5f7fa;
    border-radius: 8px;
    color: #8898aa;
    font-size: 13px;
    margin-top: 16px;
}

/* ========== FAQs ========== */
.soporte-search {
    position: relative;
    margin-bottom: 16px;
}

.soporte-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8898aa;
}

.soporte-search input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.soporte-search input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.soporte-faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: white;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.faq-item:hover {
    border-color: #667eea;
}

.faq-question {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.faq-question i {
    color: #667eea;
    transition: transform 0.2s;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 300px;
}

.faq-answer-content {
    padding: 0 16px 16px 16px;
    color: #5a6c7d;
    font-size: 13px;
    line-height: 1.6;
}

/* ========== FORMULARIO ========== */
.soporte-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.soporte-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.soporte-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.soporte-submit-btn:active {
    transform: translateY(0);
}

/* ========== CHAT ========== */
.soporte-chat-header {
    background: #f5f7fa;
    padding: 12px 16px;
    border-bottom: 1px solid #e3e8ef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-info strong {
    display: block;
    font-size: 14px;
    color: #2c3e50;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8898aa;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-action-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #8898aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: #e3e8ef;
    color: #667eea;
}

/* Mensajes */
.soporte-chat-mensajes {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-mensaje {
    display: flex;
    gap: 8px;
    animation: slideInMessage 0.3s ease;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-mensaje.enviado {
    flex-direction: row-reverse;
}

.mensaje-avatar {
    width: 32px;
    height: 32px;
    background: #e3e8ef;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #667eea;
}

.chat-mensaje.enviado .mensaje-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mensaje-content {
    max-width: 70%;
}

.mensaje-bubble {
    background: #f5f7fa;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
    word-wrap: break-word;
}

.chat-mensaje.enviado .mensaje-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mensaje-tiempo {
    font-size: 11px;
    color: #8898aa;
    margin-top: 4px;
    padding: 0 4px;
}

/* Indicador de escritura */
.chat-typing {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8898aa;
    font-size: 12px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #8898aa;
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Input de chat */
.soporte-chat-input {
    border-top: 1px solid #e3e8ef;
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    background: white;
}

.chat-attach-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #8898aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-attach-btn:hover {
    background: #f5f7fa;
    color: #667eea;
}

.soporte-chat-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.soporte-chat-input input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* ========== CONTACTO ========== */
.soporte-contacto-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contacto-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: #f5f7fa;
    border-radius: 12px;
}

.contacto-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.contacto-text strong {
    display: block;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.contacto-text a,
.contacto-text p {
    font-size: 13px;
    color: #667eea;
    text-decoration: none;
    margin: 0;
}

.contacto-text a:hover {
    text-decoration: underline;
}

.contacto-text p {
    color: #5a6c7d;
    line-height: 1.5;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    .soporte-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .soporte-btn-float {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .soporte-btn-icon {
        font-size: 24px;
    }
}

/* Scrollbar personalizada */
.soporte-view::-webkit-scrollbar,
.soporte-chat-mensajes::-webkit-scrollbar {
    width: 6px;
}

.soporte-view::-webkit-scrollbar-track,
.soporte-chat-mensajes::-webkit-scrollbar-track {
    background: transparent;
}

.soporte-view::-webkit-scrollbar-thumb,
.soporte-chat-mensajes::-webkit-scrollbar-thumb {
    background: #e3e8ef;
    border-radius: 3px;
}

.soporte-view::-webkit-scrollbar-thumb:hover,
.soporte-chat-mensajes::-webkit-scrollbar-thumb:hover {
    background: #c3cfe2;
}
