/* ============================================
   LILIBOT AI CHAT - Techlife Core Light Theme
   Brand: Primary #1E488F | Secondary #DBE64C
   Background #F6F7ED | Foreground #001F3F
   ============================================ */

/* Container */
#lilibot-container {
    z-index: 9999;
    font-family: 'Open Sans', 'Inter', sans-serif;
    pointer-events: none;
}

/* Permitir interacción solo en elementos visibles */
#lilibot-window,
#chat-launcher,
#chat-tooltip {
    pointer-events: auto;
}

/* ============================================
   GLASSMORPHISM & WINDOW
   ============================================ */

#lilibot-window {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    border: 1px solid rgba(30, 72, 143, 0.12);
    box-shadow:
        0 20px 60px -10px rgba(0, 31, 63, 0.12),
        0 8px 24px -5px rgba(30, 72, 143, 0.08),
        0 0 0 1px rgba(246, 247, 237, 0.9) inset;
}

/* Ultra Glass Effect - Light crema panel */
.glass-panel {
    background: rgba(246, 247, 237, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

#lilibot-window.chat-hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

#lilibot-window.chat-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ============================================
   HEADER GRADIENT — Techlife Core Primary
   ============================================ */

.lilibot-header-gradient {
    background: linear-gradient(135deg, #1E488F 0%, #001F3F 100%);
}

/* ============================================
   MESSAGES AREA
   ============================================ */

#chat-messages {
    background: rgba(246, 247, 237, 0.6);
    scrollbar-width: thin;
    scrollbar-color: rgba(30, 72, 143, 0.2) transparent;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(30, 72, 143, 0.2);
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* ============================================
   CHAT BUBBLES
   ============================================ */

.chat-bubble-user {
    background: linear-gradient(135deg, #1E488F 0%, #001F3F 100%);
    color: #F6F7ED;
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 14px rgba(30, 72, 143, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-bubble-bot {
    background: rgba(255, 255, 255, 0.92);
    color: #001F3F;
    border-radius: 20px 20px 20px 4px;
    border: 1px solid rgba(30, 72, 143, 0.10);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 12px rgba(30, 72, 143, 0.06);

    /* Overflow handling */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
}

/* ============================================
   INPUT AREA
   ============================================ */

.lilibot-input-area {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(30, 72, 143, 0.08);
}

/* ============================================
   SUGGESTION CHIPS
   ============================================ */

.lilibot-suggestions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    background: rgba(246, 247, 237, 0.5);
}

.lilibot-suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    color: #1E488F;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(30, 72, 143, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(30, 72, 143, 0.05);
}

.suggestion-chip:hover {
    transform: translateY(-2px);
    background: #1E488F;
    border-color: #1E488F;
    color: #F6F7ED;
    box-shadow: 0 6px 16px rgba(30, 72, 143, 0.25);
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
    width: fit-content;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: #1E488F;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   LAUNCHER BUTTON — Techlife Core
   ============================================ */

#chat-launcher {
    background: linear-gradient(135deg, #1E488F 0%, #001F3F 100%);
    box-shadow: 0 8px 28px rgba(30, 72, 143, 0.4),
        0 2px 8px rgba(0, 31, 63, 0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#chat-launcher:hover {
    box-shadow: 0 12px 36px rgba(30, 72, 143, 0.55),
        0 4px 12px rgba(0, 31, 63, 0.25);
    transform: scale(1.1);
}

#chat-launcher:active {
    transform: scale(0.95);
}

/* Pulse Ring for Launcher */
.launcher-pulse::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(30, 72, 143, 0.35);
    animation: launcherRing 2.5s ease-out infinite;
}

@keyframes launcherRing {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ============================================
   TOOLTIP
   ============================================ */

#chat-tooltip {
    background: rgba(255, 255, 255, 0.98);
    color: #001F3F;
    border: 1px solid rgba(30, 72, 143, 0.12);
    box-shadow: 0 8px 24px rgba(30, 72, 143, 0.1);
    backdrop-filter: blur(12px);
}

/* ============================================
   MARKDOWN STYLES
   ============================================ */

.bot-markdown p {
    margin-bottom: 0.5em;
    color: #001F3F;
}

.bot-markdown p:last-child {
    margin-bottom: 0;
}

.bot-markdown ul {
    margin-left: 1.25em;
    list-style-type: disc;
}

.bot-markdown ol {
    margin-left: 1.25em;
    list-style-type: decimal;
}

.bot-markdown li {
    margin-bottom: 0.25em;
    color: #001F3F;
}

.bot-markdown strong {
    font-weight: 700;
    color: #1E488F;
}

.bot-markdown code {
    background: rgba(30, 72, 143, 0.07);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Menlo', 'Monaco', monospace;
    color: #1E488F;
}

/* Tables inside chat */
.bot-markdown table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin: 0.5em 0;
    display: block;
    overflow-x: auto;
}

.bot-markdown th,
.bot-markdown td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid rgba(30, 72, 143, 0.1);
    white-space: nowrap;
}

.bot-markdown th {
    background: rgba(30, 72, 143, 0.08);
    font-weight: 700;
    color: #1E488F;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-enter {
    animation: messageSlideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Footer Link */
.lilibot-footer-link {
    transition: color 0.2s;
    font-weight: 700;
    color: #1E488F;
}

.lilibot-footer-link:hover {
    color: #00804C;
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    #lilibot-window {
        width: calc(100vw - 32px) !important;
        height: calc(100vh - 100px) !important;
        right: 16px;
        bottom: 80px;
    }
}