/**
 * Chat Assistant Styles - ICO Compuingles
 */

:root {
    --chat-primary: #2B5A99;
    --chat-secondary: #3B6BA3;
    --chat-background: #FFFFFF;
    --chat-border: #D9E1ED;
    --chat-text: #5C4B45;
    --chat-text-light: #8B7A6F;
    --chat-user-bg: #DE386D;
    --chat-bot-bg: #E8E4D8;
    --chat-user-text: #ffffff;
    --chat-shadow: rgba(43, 90, 153, 0.1);
}

#chat-assistant-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: 'Inter', 'Poppins', sans-serif;
}

/* Chat Button */
.chat-assistant-btn {
    position: relative;
    min-width: 220px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(180deg, #e7eefa 0%, #e7eefa 70%, #d9e2f3 100%);
    border: 2px solid #C8D5EB;
    color: #2d3a7a;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(99, 102, 184, 0.4), 0 4px 15px rgba(50, 80, 150, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    letter-spacing: 0.3px;
    animation: glow-continuous 3s ease-in-out infinite;
}

@keyframes glow-continuous {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 184, 0.4), 0 4px 15px rgba(50, 80, 150, 0.25);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(99, 102, 184, 0), 0 4px 15px rgba(50, 80, 150, 0.4);
    }
}

.chat-assistant-btn:hover {
    animation: pulse-btn 0.6s ease-out;
    box-shadow: 0 0 0 0 rgba(99, 102, 184, 0), 0 6px 25px rgba(50, 80, 150, 0.45);
}

.chat-assistant-btn:active {
    transform: scale(0.97);
}

@keyframes pulse-btn {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 184, 0), 0 4px 15px rgba(50, 80, 150, 0.25);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 15px rgba(99, 102, 184, 0), 0 8px 35px rgba(100, 150, 255, 0.5);
    }
    100% {
        transform: scale(1.05);
        box-shadow: 0 0 0 0 rgba(99, 102, 184, 0), 0 6px 25px rgba(50, 80, 150, 0.45);
    }
}

.chat-assistant-btn.active {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.chat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.chat-label {
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    line-height: 1.2;
    white-space: normal;
    max-width: 170px;
    text-overflow: clip;
    overflow: visible;
    letter-spacing: 0.3px;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 400px;
    height: 600px;
    background: #FFFFFF !important;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(30, 74, 122, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    border: 1px solid #D9E1ED;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #EEF3FA 0%, #E8EFF8 100%);
    color: #2B5A99;
    padding: 16px 16px 12px 16px;
    text-align: left;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(43, 90, 153, 0.08);
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: #2B5A99;
}

.copilot-powered {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    opacity: 0.85;
    margin-top: 6px;
    color: #677A95;
}

.copilot-powered img {
    height: 14px;
    width: auto;
    display: block;
}

.chat-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.95;
    font-weight: 400;
}

.chat-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(43, 90, 153, 0.1);
    border: none;
    color: #2B5A99;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close-btn:hover {
    background: rgba(43, 90, 153, 0.2);
}

.chat-close-btn .material-icons {
    font-size: 20px;
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #FFFFFF;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Messages */
.chat-message {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.user-message .message-content {
    background: var(--chat-user-bg);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: #d8d8d8;
    color: #464545;
    border-bottom-left-radius: 4px;
    border: 1px solid #D9E1ED;
}

.message-content p {
    margin: 0;
    display: block;
}

.message-content p:not(:last-child) {
    margin-bottom: 8px;
}

.message-content ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style-type: disc;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.user-message .message-content a {
    opacity: 0.9;
}

.bot-message .message-content a {
    color: var(--chat-secondary);
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 12px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-text-light);
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Area */
.chat-input-area {
    flex-shrink: 0;
    border-top: 1px solid #D9E1ED;
    padding: 12px 16px;
    background: #FFFFFF !important;
    backdrop-filter: blur(10px);
}

.chat-form {
    margin: 0;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid #D0DDED;
    border-radius: 24px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #6366B8;
    box-shadow: 0 0 0 3px rgba(99, 102, 184, 0.1);
}

.chat-input::placeholder {
    color: var(--chat-text-light);
}

.chat-send-btn {
    background: linear-gradient(135deg, #2B5A99 0%, #3B6BA3 100%);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(43, 90, 153, 0.3);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn .material-icons {
    font-size: 18px;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disclaimer */
.chat-disclaimer {
    margin: 8px 0 0 0;
    font-size: 11px;
    color: var(--chat-text-light);
    text-align: center;
    line-height: 1.3;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chat-assistant-container {
        bottom: 15px;
        left: 15px;
    }

    .chat-assistant-btn {
        min-width: 180px;
        height: 55px;
        gap: 8px;
        padding: 0 12px;
    }

    .chat-icon {
        width: 24px;
        height: 24px;
    }

    .chat-label {
        font-size: 10px;
    }

    .chat-window {
        position: fixed;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        transform: translateY(100%) !important;
        max-height: 100vh;
    }

    .chat-window.active {
        transform: translateY(0) !important;
    }

    .message-content {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .chat-input {
        font-size: 16px; /* Previene zoom en iOS */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --chat-background: #2D2D2D;
        --chat-text: #E0E0E0;
        --chat-text-light: #999999;
        --chat-bot-bg: #404040;
        --chat-border: #555555;
    }

    .chat-window {
        background: linear-gradient(180deg, #3a4555 0%, #3a4555 70%, #2d3547 100%);
    }

    .chat-messages {
        background: transparent;
    }

    .chat-input-area {
        background: rgba(60, 70, 85, 0.8);
        border-top: 1px solid rgba(100, 110, 125, 0.5);
    }
}

/* Print Styles */
@media print {
    #chat-assistant-container {
        display: none !important;
    }
}
