:root {
    --bg-main: #0b1220;
    --bg-widget: #111827;
    --bg-secondary: #1f2937;

    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;

    --accent: #22c55e;
    --accent-hover: #16a34a;

    --border: #374151;
}

/* THEME SELECTOR */

/* CONTAINER PRO */

.theme-configurator {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 99999;

    padding: 16px;

    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(24px);

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;

    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);

    transition: .3s;

    opacity: 0.6;
    

}

.theme-configurator:hover {
    opacity: 1;
}

.theme-grid-v2 {
    display: grid;
    grid-template-columns: repeat(2, 110px);
    gap: 14px;

    padding: 16px;

    justify-content: center;
}


/* CARD */

.theme-card-v2 {

    width: 110px;
    border-radius: 14px;
    overflow: hidden;

    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);

    cursor: pointer;
    transition: all .25s ease;

    position: relative;
}

.theme-card-v2:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ACTIVE PRO */

.theme-card-v2.active {
    border-color: #22c55e;
    box-shadow:
        0 0 0 1px #22c55e,
        0 8px 20px rgba(34, 197, 94, 0.25);
}

.theme-card-v2.active::after {
    content: "✓";
    position: absolute;
    top: 6px;
    right: 6px;

    width: 18px;
    height: 18px;

    font-size: 11px;
    font-weight: bold;

    background: #22c55e;
    color: #022c22;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-card-v2 span {
    font-size: 11px;
    color: #9ca3af;
    transition: .2s;
}

.theme-card-v2:hover span {
    color: white;
}

/* PREVIEW SKELETON */

.card-preview {
    height: 80px;
    position: relative;
}

/* FAKE CHAT UI */

.card-preview::before {
    content: "";
    position: absolute;
    top: 12px;
    left: 10px;
    right: 10px;
    height: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
}

.card-preview::after {
    content: "";
    position: absolute;
    top: 30px;
    left: 10px;
    width: 60%;
    height: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
}

/* THEMES */

.card-preview.default {
    background: linear-gradient(180deg, #111827, #020617);
}

.card-preview.minimal {
    background: linear-gradient(180deg, #ffffff, #f5f1eb);
}

.card-preview.luxury {
    background: linear-gradient(180deg, #0f172a, #1e293b);
}

.card-preview.modern {
    background: linear-gradient(180deg, #0ea5e9, #1e293b);
}

.card-preview.zen {
    background: linear-gradient(180deg, #f0fdf4, #bbf7d0);
}

.card-preview.zen-noir {
    background: linear-gradient(180deg, #020617, #0f172a);
}

/* LABEL */

.theme-card-v2 span {
    display: block;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: #e5e7eb;
}

#theme-toggle-btn {
    display: none;

    position: fixed;
    bottom: 110px;
    right: 20px;
    /* 🔥 CAMBIO lado contrario */

    z-index: 10000;

    width: 50px;
    /* 🔥 ligeramente más grande */
    height: 50px;

    border-radius: 50%;
    border: none;

    background: rgba(31, 41, 55, 0.9);
    color: white;

    cursor: pointer;

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);

    transition: all .25s ease;
}

#theme-toggle-btn.idle {
    opacity: 0.55;
    transform: scale(0.95);
}

#theme-toggle-btn.active {
    opacity: 1;
    transform: scale(1);
}

.theme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 8px 12px 0 12px;
}

.theme-header span {
    font-size: 13px;
    font-weight: 500;
    color: #e5e7eb;
}

#close-theme {
    display: none;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
}

#close-theme:hover {
    color: white;
}

/* END THEME SELECTOR */



body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
    background: #0b1220;
    margin: 0;
    height: 100vh;
}

/* BOTÓN */

#chat-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: .25s;
}

#chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

/* MORE BTM */
.more-btn {

    background: transparent;
    border: none;
    color: #4ade80;
    cursor: pointer;
    font-weight: 600;
    margin-top: 6px;

}

/* WIDGET */

#chat-widget {
    display: flex;
    position: fixed;

    width: 380px;
    height: 560px;

    background: #111827;
    border-radius: 14px;

    flex-direction: column;
    overflow: hidden;

    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);

    /* ✅ POSICIÓN REAL (PRODUCCIÓN) */
    bottom: 90px;
    right: 25px;

    /* estado inicial */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(.96);

    transition:
        opacity .25s ease,
        transform .25s ease;
}

#chat-widget.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

@keyframes chatOpen {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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


/* HEADER */

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1f2937;
    padding: 16px 18px;
    border-bottom: 1px solid #1f2937;
}

.chat-header h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
    color: #f9fafb;
    font-weight: 500;
}

#close-chat {

    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
}

#close-chat:hover {
    color: white;
}

#chat-widget h3 {
    margin: 0;
    padding: 14px 16px;
    background: #1f2937;
    font-size: 15px;
    color: #f9fafb;
    font-weight: 500;
    letter-spacing: .2px;
}

/* MENSAJES */

#messages {
    padding: 20px;
    gap: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-size: 14px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    margin-bottom: 0;
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.5;
    font-size: 14.5px;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

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

.message,
.bot-wrapper {
    animation: messageIn 0.25s ease;
}

.user {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 14px;
    color: white;
    margin-left: auto;
}

.bot {
    background: #1f2937;
    color: #e5e7eb;
}

/* BOT AVATAR */

.bot-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 2px;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* typing animation */

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 12px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: .4;
    }

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

}

.bot-message {
    background: #1f2937;
    border: 1px solid #2a3441;
    border-radius: 14px;
    color: #e5e7eb;
    padding: 10px 12px;
    max-width: 85%;
    line-height: 1.4;
}

/* QUICK ACTIONS (MEJORADOS) */

#quick-actions,
#proactive-actions {

    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    margin-bottom: 4px;

}

#quick-actions button,
#proactive-actions button {
    background: #0f172a;
    border: 1px solid #2a3441;
    color: #e5e7eb;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
    will-change: transform;
}

#quick-actions button:hover,
#proactive-actions button:hover {
    background: #1f2937;
    border-color: #4ade80;
    transform: translateY(-2px);
}

#quick-actions button:active,
#proactive-actions button:active {

    transform: scale(.96);

}

/* GOOGLE MAPS BTN */
.maps-btn {

    display: inline-block;

    margin-top: 6px;

    background: #22c55e;

    color: white;

    padding: 6px 12px;

    border-radius: 6px;

    font-size: 12px;

    text-decoration: none;

    transition: .2s;

}

.maps-btn:hover {

    background: #16a34a;

}

/* SCROLLBAR */

#messages::-webkit-scrollbar {
    width: 6px;
}

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

#messages::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 10px;
}

#messages::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

#messages {
    scrollbar-width: thin;
    scrollbar-color: #374151 transparent;
}



/* INPUT */

.input-area {
    display: flex;
    padding: 12px;
    gap: 8px;
    background: #0f172a;
    border-top: 1px solid #1f2937;
}

input {
    flex: 1;
    padding: 12px;
    border: 1px solid #2a3441;
    border-radius: 10px;
    background: #1f2937;
    color: white;
    outline: none;
    font-size: 14px;
}

input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

button.send {

    margin-left: 8px;
    width: 46px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: #22c55e;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

button.send:hover {
    background: #16a34a;
    transform: scale(1.05);

}

button.send svg {
    width: 18px;
    height: 18px;

}

/* MOBILE */

@media (max-width:600px) {

    #chat-button {
        bottom: 20px;
        right: 20px;
    }

    #chat-widget {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 1000;
    }

    #messages {
        font-size: 15px;
    }

    input {
        font-size: 16px;
    }

    #languageButtons {
        flex-direction: column;
    }

    #quick-actions button,
    #proactive-actions button {
        font-size: 14px;
        padding: 10px 16px;
    }

}

@media (max-width: 768px) {

    .theme-configurator {
        bottom: 120px;
        top: auto;
        left: 50%;

        width: auto;
        max-width: none;

        padding: 10px;

        transform: translateX(-50%) scale(0.9);
        opacity: 0;
        pointer-events: none;

        transition: all .25s ease;

        z-index: 10000;
        opacity: 0;
    }

    .theme-configurator.open {
        opacity: 1;
        transform: translateX(-50%) scale(1);
        pointer-events: auto;
    }

    #chat-widget {
        z-index: 1000;
    }

    .theme-grid-v2 {
        grid-template-columns: repeat(3, 1fr);
    }

    .card-preview {
        height: 60px;
    }

    #theme-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;

        background: rgba(31, 41, 55, 0.9);
        backdrop-filter: blur(10px);
    }

    #close-theme {
        display: block;
    }
}

/* WIDGET MODE */

body.embed-mode {
    background: transparent;
}

body.embed-mode #chat-widget {

    position: relative;

    top: auto;
    left: auto;

    transform: none;

    opacity: 1;
    visibility: visible;

    width: 100%;
    height: 100%;

    box-shadow: none;

}