/* =============================================
   FAQ CHAT PAGE — ROBOCUTE Interface
   ============================================= */

:root {
    --faq-header-height: 9vh;
    --faq-app-height: 100vh;
    --faq-accent: #42d4d9;
    --faq-accent-glow: rgba(66, 212, 217, 0.25);
    --faq-bg-main: #0d0d0d;
    --faq-bg-sidebar: #141414;
    --faq-bg-chat: #1a1a1a;
    --faq-bg-input: #232323;
    --faq-border-subtle: rgba(255, 255, 255, 0.06);
}

/* =============================================
   LAYOUT
   ============================================= */

#chat-wrapper {
    position: fixed;
    top: var(--faq-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--faq-app-height) - var(--faq-header-height));
    display: flex;
    background-color: var(--faq-bg-main);
    overflow: hidden;
}

body.admin-bar #chat-wrapper {
    top: calc(var(--faq-header-height) + 32px);
    height: calc(var(--faq-app-height) - var(--faq-header-height) - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar #chat-wrapper {
        top: calc(var(--faq-header-height) + 46px);
        height: calc(var(--faq-app-height) - var(--faq-header-height) - 46px);
    }
}

/* =============================================
   SIDEBAR
   ============================================= */

#sidebar {
    width: 260px;
    background-color: var(--faq-bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--faq-border-subtle);
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
}

#sidebar-header {
    padding: 1rem 1rem 0 1.25rem;
    text-align: left;
    position: relative;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding-bottom: 0.5rem;
    margin-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.25rem;
}

/* --- FAQ List --- */
#faq-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0.75rem 0.5rem 1.25rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#faq-list::-webkit-scrollbar {
    display: none;
}

.faq-item {
    padding: 0.5rem 0.75rem;
    margin: 0.1rem 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    width: 100%;
    direction: ltr;
    line-height: 1.3;
    font-size: 0.9rem;
    font-family: inherit;
}

.faq-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.faq-item.active,
.faq-item.active:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 500;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    padding: 0.75rem 1.25rem 1rem;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-contact {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-contact:hover {
    color: var(--faq-accent);
}

.brand-title {
    font-family: 'Audiowide', cursive;
    color: #fff;
    margin-bottom: 0;
    margin-top: 0.75rem;
}

.brand-main {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.1rem;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #fff 60%, var(--faq-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: 0.65rem;
    opacity: 0.45;
    display: block;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- Close Sidebar Button --- */
#close-sidebar-btn {
    display: none;
    position: absolute;
    top: 0.6rem;
    right: 1rem;
    background: none;
    border: none;
    color: #8e8ea0;
    cursor: pointer;
    padding: 4px;
}

#close-sidebar-btn:hover {
    color: #fff;
}

#close-sidebar-btn svg {
    width: 22px;
    height: 22px;
}

/* =============================================
   MAIN CHAT AREA
   ============================================= */

#main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--faq-bg-chat);
    position: relative;
    overflow: hidden;
}

#chat-header {
    height: 3rem;
    background-color: transparent;
    border-bottom: 1px solid var(--faq-border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 1.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
    flex-shrink: 0;
    gap: 12px;
}

.chat-header-title {
    color: rgba(255, 255, 255, 0.4);
}

/* =============================================
   FAQ PILL TOGGLE (Mobile) — Not a hamburger!
   ============================================= */

#faq-pill-toggle {
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(66, 212, 217, 0.08);
    border: 1px solid rgba(66, 212, 217, 0.25);
    border-radius: 20px;
    color: var(--faq-accent);
    padding: 6px 16px 6px 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#faq-pill-toggle:hover {
    background: rgba(66, 212, 217, 0.15);
    border-color: rgba(66, 212, 217, 0.4);
}

#faq-pill-toggle:active {
    transform: scale(0.97);
}

#faq-pill-toggle .pill-label {
    line-height: 1;
}

#faq-pill-toggle .pill-arrow {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
    transition: transform 0.25s ease;
}

#faq-pill-toggle.open .pill-arrow {
    transform: rotate(180deg);
}

/* =============================================
   CHAT WINDOW
   ============================================= */

#chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 0 10rem 0;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#chat-window::-webkit-scrollbar {
    display: none;
}

#chat-messages-container {
    max-width: 48rem;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0 1.5rem;
}

/* =============================================
   MESSAGES
   ============================================= */

@keyframes slideInFromLeft {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.message-wrapper {
    display: flex;
    max-width: 100%;
    animation-duration: 0.4s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

.bubble-content {
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #ffffff;
    direction: ltr;
}

/* --- Assistant Messages --- */
.message-wrapper.assistant {
    animation-name: slideInFromLeft;
    flex-direction: column;
}

.message-wrapper.assistant .bubble-content {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 100%;
    font-size: 16px;
    line-height: 28px;
    font-weight: 400;
}

/* --- User Messages --- */
.message-wrapper.user {
    animation-name: slideInFromRight;
    justify-content: flex-end;
}

.message-wrapper.user .bubble-content {
    background-color: #2a2a2a;
    padding: 0.75rem 1rem;
    max-width: 70%;
    border-radius: 1.25rem;
}

/* --- Message Actions (Like/Dislike) --- */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-start;
}

.action-btn {
    background: none;
    border: none;
    color: #8e8ea0;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
}

.action-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.action-btn.liked,
.action-btn.disliked {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.2);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Links --- */
.link {
    color: var(--faq-accent);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.15s ease;
}

.link:hover {
    color: #5ae3e8;
}

/* --- Typing Indicator --- */
.typing-indicator {
    display: inline-block;
    font-size: 1.5rem;
    line-height: 1;
    vertical-align: middle;
}

@keyframes typing {
    0% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

.bubble-content .typing-indicator::after {
    content: ".";
    animation: typing 1.5s steps(3, end) infinite;
    display: inline-block;
}

/* =============================================
   INPUT AREA
   ============================================= */

#input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, var(--faq-bg-chat) 80%, transparent);
    border-top: none;
    z-index: 10;
}

#input-wrapper {
    max-width: 48rem;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    background-color: var(--faq-bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.75rem 3.5rem 0.75rem 1rem;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 200px;
    overflow-y: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    direction: ltr;
}

#user-input:focus {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

#user-input::placeholder {
    color: #8e8ea0;
}

#send-btn {
    position: absolute;
    right: 0.5rem;
    bottom: 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    padding: 0.45rem;
    cursor: pointer;
    color: #8e8ea0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

#send-btn:hover:not(:disabled) {
    color: #fff;
    background: var(--faq-accent);
}

#send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#send-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* =============================================
   RTL / HEBREW SUPPORT
   ============================================= */

body[dir="rtl"] #chat-wrapper {
    direction: rtl;
}

body[dir="rtl"] #sidebar {
    border-right: none;
    border-left: 1px solid var(--faq-border-subtle);
    order: 2;
}

body[dir="rtl"] #main-chat {
    order: 1;
}

body[dir="rtl"] #sidebar-header {
    text-align: right;
    padding: 1.5rem 1.5rem 1rem 1rem;
}

body[dir="rtl"] .sidebar-subtitle {
    text-align: right;
}

body[dir="rtl"] .faq-item {
    text-align: right;
    direction: rtl;
}

body[dir="rtl"] #chat-header {
    justify-content: flex-end;
    padding-right: 1.5rem;
    padding-left: 0;
}

body[dir="rtl"] .message-wrapper.assistant {
    justify-content: flex-end;
    animation-name: slideInFromRight;
}

body[dir="rtl"] .message-wrapper.assistant .bubble-content {
    text-align: right;
    direction: rtl;
}

body[dir="rtl"] .message-wrapper.user {
    justify-content: flex-start;
    animation-name: slideInFromLeft;
}

body[dir="rtl"] .message-wrapper.user .bubble-content {
    text-align: right;
    direction: rtl;
}

body[dir="rtl"] #user-input {
    direction: rtl;
    text-align: right;
    padding: 0.75rem 1rem 0.75rem 3.5rem;
}

body[dir="rtl"] #send-btn {
    right: auto;
    left: 0.5rem;
}

body[dir="rtl"] #faq-pill-toggle {
    margin-right: 0;
    margin-left: 1rem;
}

body[dir="rtl"] #close-sidebar-btn {
    right: auto;
    left: 1rem;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .faq-item {
        padding: 0.4rem 0.6rem;
        margin: 0.1rem 0;
        line-height: 1.3;
        font-size: 0.9rem;
    }

    /* Show pill toggle, hide sidebar by default */
    #faq-pill-toggle {
        display: flex;
    }

    #close-sidebar-btn {
        display: block;
    }

    #chat-header {
        padding-left: 0.75rem;
    }

    /* Sidebar slides in from left */
    #sidebar {
        position: absolute;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
    }

    #sidebar.sidebar-open {
        transform: translateX(0);
    }

    /* RTL: Sidebar slides from right */
    body[dir="rtl"] #sidebar {
        transform: translateX(100%);
    }

    body[dir="rtl"] #sidebar.sidebar-open {
        transform: translateX(0);
    }

    body[dir="rtl"] #chat-header {
        padding-right: 0.75rem;
        padding-left: 0;
    }

    #chat-messages-container {
        max-width: 100%;
        padding: 0 1rem;
    }

    #input-wrapper {
        max-width: 100%;
    }
}

/* =============================================
   SCROLLBAR (Global for this page)
   ============================================= */

#chat-wrapper ::-webkit-scrollbar {
    width: 8px;
}

#chat-wrapper ::-webkit-scrollbar-track {
    background: transparent;
}

#chat-wrapper ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* ========================================
   ACTION CARDS — Tool result UI (lead capture, WhatsApp, portfolio)
   ======================================== */

.chat-action-card {
    margin: 8px 0;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(201, 168, 76, 0.3);
    background: rgba(201, 168, 76, 0.08);
    font-size: 13px;
    line-height: 1.5;
    animation: actionFadeIn 0.3s ease-out;
}

.chat-action-card .action-icon {
    margin-right: 8px;
    font-size: 16px;
}

.chat-action-card .action-text {
    color: rgba(255, 255, 255, 0.9);
}

.chat-action-confirm {
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.1);
}

.chat-action-confirm .action-icon {
    color: #4CAF50;
}

.chat-action-whatsapp .chat-action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 20px;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s, transform 0.15s;
}

.chat-action-whatsapp .chat-action-link:hover {
    background: #1DA851;
    transform: scale(1.03);
}


@keyframes actionFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
