/* Chatbot Floating Bubble Styles */

:root {
    --chatbot-primary: #7a0a0a;
    --chatbot-secondary: #5a0505;
    --chatbot-accent: #8b0000;
}

.chatbot-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(122, 10, 10, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    border: 3px solid white;
    font-family: Arial, sans-serif;
}

.chatbot-bubble:hover {
    transform: scale(1.12) translateY(-4px);
    box-shadow: 0 12px 32px rgba(122, 10, 10, 0.5);
}

.chatbot-bubble.active {
    background: linear-gradient(135deg, #5a0505 0%, var(--chatbot-primary) 100%);
}

/* Colores según la página */
body:has(.header_section) .chatbot-bubble:not(.active) {
    background: linear-gradient(135deg, #5a0505 0%, #4a0404 100%);
    box-shadow: 0 8px 24px rgba(122, 10, 10, 0.35);
}

body:has(.header_section) .chatbot-bubble:hover {
    box-shadow: 0 12px 32px rgba(122, 10, 10, 0.5);
}

.dashboard-user .chatbot-bubble:not(.active) {
    background: linear-gradient(135deg, #5a0505 0%, #4a0404 100%);
    box-shadow: 0 8px 24px rgba(122, 10, 10, 0.35);
}

.dashboard-user .chatbot-bubble:hover {
    box-shadow: 0 12px 32px rgba(122, 10, 10, 0.5);
}

.dashboard-instructor .chatbot-bubble:not(.active) {
    background: linear-gradient(135deg, #5a0505 0%, #4a0404 100%);
    box-shadow: 0 8px 24px rgba(122, 10, 10, 0.35);
}

.dashboard-instructor .chatbot-bubble:hover {
    box-shadow: 0 12px 32px rgba(122, 10, 10, 0.5);
}

.dashboard-admin .chatbot-bubble:not(.active) {
    background: linear-gradient(135deg, #5a0505 0%, #4a0404 100%);
    box-shadow: 0 8px 24px rgba(122, 10, 10, 0.35);
}

.dashboard-admin .chatbot-bubble:hover {
    box-shadow: 0 12px 32px rgba(122, 10, 10, 0.5);
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 25px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(255, 255, 255, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    transform: scale(0.92) translateY(20px);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-window.active {
    display: flex;
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.2);
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-reset {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.chatbot-reset:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(-25deg);
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #e0e5ed;
}

.chatbot-header p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.95;
    font-weight: 500;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 6px 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

/* Chat Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(to bottom, #f8f9fd 0%, #f3f4f9 100%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--chatbot-primary), #8b0000);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #8b0000, var(--chatbot-primary));
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.bot {
    justify-content: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-bubble.user {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    color: white;
    border-bottom-right-radius: 2px;
}

.message-bubble.bot {
    background: #e9ecf0;
    color: #1f1f1f;
    border-bottom-left-radius: 2px;
}

.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px 0;
}

.chatbot-quick-action-btn {
    border: 1px solid rgba(122, 10, 10, 0.25);
    background: #fff;
    color: var(--chatbot-primary);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-quick-action-btn:hover {
    background: var(--chatbot-primary);
    color: #fff;
    border-color: var(--chatbot-primary);
}

/* Chat Input */
.chatbot-input-container {
    padding: 14px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 8px;
    background: #fafbfc;
    border-radius: 0 0 16px 16px;
}

.chatbot-input {
    flex: 1;
    border: 2px solid #e0e5ed;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Poppins', Arial, sans-serif;
    outline: none;
    transition: all 0.2s ease;
    background: white;
}

.chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(122, 10, 10, 0.1);
}

.chatbot-input::placeholder {
    color: #999;
}

.chatbot-send {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    font-family: Arial, sans-serif;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.25);
}

.chatbot-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(122, 10, 10, 0.35);
}

.chatbot-send:active {
    transform: scale(0.96);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    animation: typing 1.4s infinite;
    opacity: 0.7;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* Todos los dashboards usan rojo oscuro */

/* Dashboard Student - Rojo Oscuro */
.dashboard-user .chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.2);
}

.dashboard-user .message-bubble.user {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
}

.dashboard-user .chatbot-send {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.25);
}

.dashboard-user .chatbot-send:hover {
    box-shadow: 0 6px 16px rgba(122, 10, 10, 0.35);
}

.dashboard-user .chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(122, 10, 10, 0.1);
}

.dashboard-user .typing-dot {
    background: var(--chatbot-primary);
}

/* Dashboard Instructor - Rojo Oscuro */
.dashboard-instructor .chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.2);
}

.dashboard-instructor .message-bubble.user {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
}

.dashboard-instructor .chatbot-send {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.25);
}

.dashboard-instructor .chatbot-send:hover {
    box-shadow: 0 6px 16px rgba(122, 10, 10, 0.35);
}

.dashboard-instructor .chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(122, 10, 10, 0.1);
}

.dashboard-instructor .typing-dot {
    background: var(--chatbot-primary);
}

/* Dashboard Admin - Rojo Oscuro */
.dashboard-admin .chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.2);
}

.dashboard-admin .message-bubble.user {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
}

.dashboard-admin .chatbot-send {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #8b0000 100%);
    box-shadow: 0 4px 12px rgba(122, 10, 10, 0.25);
}

.dashboard-admin .chatbot-send:hover {
    box-shadow: 0 6px 16px rgba(122, 10, 10, 0.35);
}

.dashboard-admin .chatbot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(122, 10, 10, 0.1);
}

.dashboard-admin .typing-dot {
    background: var(--chatbot-primary);
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        max-width: 400px;
        height: 70vh;
        bottom: 85px;
        right: 10px;
    }

    .chatbot-bubble {
        bottom: 15px;
        right: 15px;
        width: 60px;
        height: 60px;
        font-size: 26px;
    }

    .message-bubble {
        max-width: 90%;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-header h3 {
        font-size: 16px;
    }

    .chatbot-header p {
        font-size: 11px;
    }
}
