/* ================================================================
   استایل صفحه‌ی چت و پشتیبانی
   ================================================================ */

.chat-container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 20px;
    width: 100%;
    flex: 1;
}

.chat-header {
    text-align: center;
    margin-bottom: 24px;
}

.chat-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.chat-header h1 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ساختار اصلی */
.chat-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    min-height: 520px;
}

body.light .chat-wrapper {
    background: #ffffff;
    border: 1px solid #e8ecf1;
}

/* سایدبار */
.chat-sidebar {
    padding: 20px 18px;
    overflow-y: auto;
    max-height: 600px;
    background: var(--bg-input);
    border-left: 1px solid var(--border-color);
}

body.light .chat-sidebar {
    background: #f5f7fc;
    border-left: 1px solid #e8ecf1;
}

.chat-sidebar h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

body.light .chat-sidebar h3 {
    color: var(--purple);
}

.chat-info,
.chat-topics,
.chat-rules,
.contact-info,
.hours-info {
    margin-bottom: 18px;
}

.chat-sidebar p {
    margin: 4px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-sidebar p i {
    width: 18px;
    color: var(--text-muted);
}

.status-online {
    font-weight: 700;
    padding: 2px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--green);
    background: rgba(0, 184, 148, 0.1);
    display: inline-block;
}

/* دکمه‌های موضوعات */
.topic-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 14px;
    margin-bottom: 5px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    text-align: right;
    transition: all var(--transition);
}

.topic-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: translateX(-4px);
}

.topic-btn i {
    margin-left: 6px;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* قوانین */
.chat-rules ul {
    padding: 0;
}

.chat-rules li {
    padding: 3px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.chat-rules li:last-child {
    border-bottom: none;
}

.chat-rules li::before {
    content: "◆";
    color: var(--gold);
    font-size: 0.6rem;
}

body.light .chat-rules li::before {
    color: var(--purple);
}

/* تماس و ساعات */
.contact-info,
.hours-info {
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.contact-info p,
.hours-info p {
    font-size: 0.75rem;
    margin: 2px 0;
}

/* بخش اصلی چت */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

body.light .chat-main {
    background: #f8f9fe;
}

/* پیام‌ها */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 480px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--purple);
    border-radius: 10px;
}

.message {
    max-width: 78%;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
    border: 1px solid transparent;
}

.message.user {
    align-self: flex-start;
    background: rgba(108, 92, 231, 0.08);
    border-color: rgba(108, 92, 231, 0.12);
    border-bottom-left-radius: 4px;
}

.message.bot {
    align-self: flex-end;
    background: var(--bg-input);
    border-color: var(--border-color);
    border-bottom-right-radius: 4px;
}

body.light .message.user {
    background: #e8ecf1;
    border-color: #d5dae3;
}

body.light .message.bot {
    background: #ffffff;
    border-color: #e8ecf1;
}

.message-content {
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.message-content strong {
    color: var(--gold);
    font-weight: 700;
}

body.light .message-content strong {
    color: var(--purple);
}

.message.user .message-content strong {
    color: var(--gold);
}

body.light .message.user .message-content strong {
    color: var(--purple);
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message.user .message-time {
    text-align: right;
}

.delete-msg-btn {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
    color: var(--red);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 9px;
    cursor: pointer;
    transition: all var(--transition);
}

.delete-msg-btn:hover {
    background: rgba(231, 76, 60, 0.25);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ورودی */
.chat-input-area {
    padding: 14px 20px 18px;
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
}

body.light .chat-input-area {
    background: #f5f7fc;
    border-top: 1px solid #e8ecf1;
}

.input-group {
    display: flex;
    gap: 10px;
    position: relative;
    margin-bottom: 12px;
}

.input-group input {
    flex: 1;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition);
}

body.light .input-group input {
    background: #ffffff;
}

.input-group input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    padding: 10px 28px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}

/* دکمه‌های پایین */
.chat-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 5px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ایموجی پیکر */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    z-index: 1000;
    box-shadow: var(--shadow-card);
    max-width: 260px;
}

.emoji-picker.show {
    display: grid;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.emoji-btn:hover {
    background: rgba(108, 92, 231, 0.1);
    transform: scale(1.15);
}

/* ریسپانسیو */
@media (max-width: 992px) {
    .chat-wrapper {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .chat-sidebar {
        max-height: 260px;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }
    .chat-messages {
        max-height: 350px;
    }
    .message {
        max-width: 88%;
    }
}

@media (max-width: 768px) {
    .chat-container {
        padding: 0 12px;
    }
    .chat-header h1 {
        font-size: 1.4rem;
    }
    .chat-sidebar {
        padding: 14px 16px;
        max-height: 230px;
    }
    .chat-messages {
        padding: 14px;
        max-height: 300px;
        gap: 10px;
    }
    .message {
        max-width: 92%;
        padding: 8px 14px;
    }
    .input-group {
        flex-direction: column;
        gap: 8px;
    }
    .send-btn {
        justify-content: center;
        padding: 10px;
    }
    .chat-actions {
        justify-content: center;
    }
    .emoji-picker {
        max-width: 200px;
        grid-template-columns: repeat(5, 1fr);
        right: 10px;
        bottom: 110px;
    }
}

@media (max-width: 480px) {
    .chat-header h1 {
        font-size: 1.2rem;
    }
    .chat-sidebar {
        padding: 10px 12px;
        max-height: 200px;
    }
    .chat-sidebar h3 {
        font-size: 0.8rem;
    }
    .chat-sidebar p {
        font-size: 0.7rem;
    }
    .chat-messages {
        padding: 10px;
        max-height: 260px;
    }
    .message {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    .message-content {
        font-size: 0.8rem;
    }
}