/* ── Padyar Chat Base CSS ──
   Structural styles shared by all chat themes.
   Theme CSS files load AFTER this and override visual properties (colors, backgrounds, borders, shadows).
*/


/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }


/* ── Body ── */
body {
    font-family: var(--font-family, "Vazirmatn", sans-serif);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}


/* ── App Layout ── */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    position: relative;
    z-index: 1;
}


/* ── View Container ── */
.view-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-view {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.tab-view.active {
    display: flex;
}

#text-view {
    height: 100lvh;
}


/* ── Chat Messages ── */
#chat-view-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    scroll-behavior: smooth;
}

#chat-view-content::-webkit-scrollbar {
    display: none;
}

.message {
    max-width: 60%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in-out;
    position: relative;
}

.message:last-child {
    margin-bottom: 80px;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message .bubble {
    word-wrap: break-word;
    position: relative;
}

.message.bot .bubble {
    padding: 15px;
}

.message.user .bubble {
    padding: 12px 18px;
}

/* Bubble content formatting */
.bubble p { margin: 0; }
.bubble ul,
.bubble ol { margin: 5px 0; padding-right: 15px; }
.bubble a { color: var(--secondary-blue, #2b78c5); text-decoration: underline; }

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


/* ── Questions List ── */
.questions-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.questions-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.92rem;
    line-height: 1.6;
}

.questions-list li::before {
    content: "▶";
    font-size: 0.65rem;
    flex-shrink: 0;
}

.show-more-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-family, "Vazirmatn", sans-serif);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.message.bot.questions-msg {
    max-width: 85%;
}


/* ── Typing Indicator ── */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

#loading-bubble {
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40%            { transform: scale(1); }
}


/* ── Video View ── */
#video-view {
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.avatar-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#avatar-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-actions {
    position: absolute;
    bottom: 120px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 0 20px;
    z-index: 20;
    flex-wrap: wrap;
}

.action-btn {
    cursor: pointer;
    transition: all 0.3s ease;
}


/* ── Input Area ── */
.wrapper {
    padding: 0.5rem 1rem;
}

#input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    flex-shrink: 0;
    width: 100%;
    max-width: 800px;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0.5rem;
    transition: border-color 0.2s;
}

#user-input {
    flex: 1;
    border: none;
    background-color: transparent;
    font-family: var(--font-family, "Vazirmatn", sans-serif);
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    resize: none;
    overflow-y: auto;
    min-height: 40px;
    max-height: 100px;
}

#user-input:focus {
    outline: none;
}

.mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mic-btn.recording {
    animation: pulse 1.5s infinite;
}

.mic-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

#send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:disabled {
    cursor: not-allowed !important;
}

@keyframes pulse {
    0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.7); }
    70%  { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(214, 69, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 69, 69, 0); }
}


/* ── Accessibility Controls ── */
.accessibility-controls {
    position: relative;
}

.a11y-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    pointer-events: none;
}

.a11y-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

body.video-mode .a11y-dropdown-content .a11y-btn:nth-child(1),
body.video-mode .a11y-dropdown-content .a11y-btn:nth-child(2) {
    display: none;
}

.a11y-btn .dark,
.a11y-btn .light {
    display: none;
    cursor: pointer;
    justify-content: center;
    align-content: center;
}

body.high-contrast .light { display: flex; }
body:not(.high-contrast) .dark { display: flex; }


/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }

    .message.user {
        max-width: 85%;
    }

    .the-slogan {
        display: none;
    }

    .video-actions {
        bottom: 90px;
        gap: 10px;
    }

    body.video-mode #video-view {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100dvh;
        z-index: 50;
    }

    body.video-mode #avatar-video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    #input-area {
        position: fixed;
        bottom: 10px;
        left: 0;
        width: 100%;
        z-index: 100;
        padding: 0 15px;
    }

    body.video-mode .video-actions {
        bottom: 145px;
        z-index: 100;
    }
}


/* ── Desktop Optimization ── */
@media (min-width: 769px) {
    body {
        align-items: center;
        justify-content: center;
    }

    .app-layout {
        max-width: 100vw;
        width: 100%;
        height: 100vh;
        overflow: hidden;
    }

    .message {
        max-width: 50%;
    }

    #input-area {
        position: absolute;
        bottom: 7px;
        left: 50%;
        transform: translateX(-50%);
    }

    .video-actions {
        bottom: 134px;
    }

    .accessibility-controls {
        display: flex;
        justify-content: end;
        position: relative;
        width: 108px;
    }
}
