/**
 * UrologIA - Estilos compartidos para todos los bots/chatbots
 * Usa variables CSS del sistema principal
 */

/* ========== WRAPPER ========== */
.bot-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* ========== PATIENT PANEL ========== */
.bot-patient-panel {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.bot-patient-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.bot-patient-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.bot-patient-avatar i,
.bot-patient-avatar svg {
    width: 24px;
    height: 24px;
}

.bot-patient-details {
    display: flex;
    flex-direction: column;
}

.bot-patient-name {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.bot-patient-phase {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.bot-patient-day {
    background: var(--color-primary);
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.bot-patient-actions {
    display: flex;
    gap: var(--space-2);
}

/* ========== CARD ========== */
.bot-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: botSlideUp 0.4s ease;
}

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

.bot-card-header {
    text-align: center;
    padding: var(--space-8) var(--space-6) var(--space-4);
}

.bot-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    box-shadow: var(--shadow);
}

.bot-logo-icon i,
.bot-logo-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.bot-card-header h2 {
    color: var(--color-secondary);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-1);
}

.bot-card-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.bot-card-body {
    padding: var(--space-6);
}

.bot-card-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--color-warning-light);
    border-top: 1px solid var(--color-warning);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: #92400e;
}

.bot-card-footer i,
.bot-card-footer svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========== DIVIDER ========== */
.bot-divider {
    display: flex;
    align-items: center;
    margin: var(--space-6) 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.bot-divider::before,
.bot-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.bot-divider span {
    padding: 0 var(--space-4);
}

/* ========== CHAT CONTAINER ========== */
.bot-chat-container {
    animation: botSlideUp 0.4s ease;
}

.bot-chat-box {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bot-chat-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--color-gray-50);
}

.bot-chat-header-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.bot-chat-header-info > i,
.bot-chat-header-info > svg {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.bot-chat-header h3 {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.bot-chat-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* ========== CHAT MESSAGES ========== */
.bot-chat-messages {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--color-gray-50);
    min-height: 200px;
}

.bot-msg {
    max-width: 90%;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.bot-msg pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
}

.bot-msg-bot {
    max-width: 95% !important;
    background: var(--color-white);
    align-self: flex-start;
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.bot-msg-user {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: var(--radius-sm);
}

.bot-msg-alerta {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    color: #92400e;
}

.bot-msg-urgencia {
    background: var(--color-danger);
    color: white;
    border: none;
}

/* ========== MESSAGE OPTIONS ========== */
.bot-msg-opciones {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.bot-op-btn {
    background: var(--color-white);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: var(--font-weight-medium);
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    width: 100%;
}

.bot-op-btn i,
.bot-op-btn svg {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.bot-op-btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    transform: translateX(4px);
}

.bot-op-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.bot-op-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-gray-100);
}

/* ========== CHAT INPUT ========== */
.bot-chat-input {
    display: flex;
    padding: var(--space-4);
    border-top: 1px solid var(--border-color);
    gap: var(--space-3);
    background: var(--color-white);
}

.bot-chat-input .form-input {
    flex: 1;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.btn-icon i,
.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* ========== TYPING INDICATOR ========== */
.bot-typing {
    display: flex;
    gap: 5px;
    padding: var(--space-4);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    width: fit-content;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.bot-typing span {
    width: 8px;
    height: 8px;
    background: var(--color-gray-400);
    border-radius: 50%;
    animation: botBounce 1.4s infinite;
}

.bot-typing span:nth-child(1) { animation-delay: -0.32s; }
.bot-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes botBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ========== FLOATING ALERT ========== */
.bot-alerta-flotante {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    background: var(--color-danger);
    color: white;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
    animation: botSlideIn 0.3s ease;
}

@keyframes botSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.bot-alerta-flotante i,
.bot-alerta-flotante svg {
    width: 24px;
    height: 24px;
}

.bot-alerta-flotante span {
    font-weight: var(--font-weight-bold);
}

.bot-alerta-flotante .btn {
    background: white;
    color: var(--color-danger);
    font-weight: var(--font-weight-semibold);
}

.bot-alerta-flotante .btn:hover {
    transform: scale(1.05);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .bot-patient-panel {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .bot-patient-info {
        justify-content: center;
    }

    .bot-patient-actions {
        justify-content: center;
    }

    .bot-card-body {
        padding: var(--space-4);
    }

    .bot-card-body .grid {
        grid-template-columns: 1fr !important;
    }

    .bot-chat-messages {
        min-height: 150px;
    }

    .bot-msg-opciones {
        grid-template-columns: 1fr;
    }

    .bot-alerta-flotante {
        bottom: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .bot-card-header {
        padding: var(--space-6) var(--space-4) var(--space-3);
    }

    .bot-logo-icon {
        width: 60px;
        height: 60px;
    }

    .bot-logo-icon i,
    .bot-logo-icon svg {
        width: 30px;
        height: 30px;
    }

    .bot-chat-input {
        padding: var(--space-3);
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }
}
