﻿@import url(fontiran.css);

html {
    font-size: 18px;
}

@media (min-width: 768px) {
    html {
        font-size: 20px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

html, body {
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    margin-bottom: 60px;
    background-color: #f9f9f9;
}


body * {
    font-family: iranyekanwebregular;
    font-family: iranyekanwebnum;
    direction: rtl;
}

.persian-number {
    font-family: iranyekanwebnum;
}

.main-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row;
    padding: 0.75rem 1rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
}

.header-title {
    font-weight: bold;
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.survey-btn {
    background-color: #ff7a3d;
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

/* Date badge */
.date-badge {
    background-color: #3e3e3e;
    color: white;
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    margin: 1rem auto;
    width: fit-content;
}

/* Chat section */
.chat-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
    padding: 0 1rem 4rem;
    flex: 1;
    overflow-y: auto;
}

.conversation-per-date {
    display: contents;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    max-width: 90%;
    margin: 5px -10px;
}

.bot-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message {
    align-self: flex-start;
    flex-direction: row;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.message-content {
    background-color: inherit;
    color: inherit;
    padding: 0.6rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.bot-message .message-content {
    background-color: #f1f5f7;
}

.user-message .message-content {
    background-color: #4BBD94;
    color: white;
}

.time {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.2rem;
}

.input-container {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background-color: white;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-top: 1px solid #e0e0e0;
    z-index: 10;
}

.chat-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    margin-left: 0.5rem;
}

.send-button {
    background-color: #4BBD94;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

/* لودینگ */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 14px;
    color: #555;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.page-loader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex; /* flex بمونه */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: tahoma, sans-serif;
    font-size: 16px;
    color: #333;
    visibility: hidden; /* پیشفرض مخفی */
    opacity: 0;
    transition: opacity 0.2s ease;
}

.page-loader.active {
    visibility: visible;
    opacity: 1;
}

.page-loader .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

/* ===================== Voice Recording UI ===================== */
.record-button {
    background: transparent;
    border: 1px solid #ccc;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.record-button.recording {
    background: #ff4d4d;
    border-color: #ff4d4d;
    color: white;
    box-shadow: 0 0 6px rgba(255,77,77,0.3);
}

.record-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 0.5rem;
}

/* وقتی preview نمایان است، کمی از input فاصله می‌گیره */
.input-container .record-preview audio {
    max-width: 180px;
    border-radius: 6px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}