/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tahoma', 'Vazir', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* صفحه ورود */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-weight: 500;
}

.required {
    color: #e74c3c;
}

.optional {
    color: #7f8c8d;
    font-size: 12px;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.hint {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 5px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.alert.error {
    background: #fee;
    color: #c0392b;
    border: 1px solid #fbb;
}

.alert.success {
    background: #e8f8f5;
    color: #27ae60;
    border: 1px solid #a3e4d7;
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
    color: #7f8c8d;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

/* صفحه چت */
.chat-page {
    height: 100vh;
    overflow: hidden;
}

.chat-app {
    display: flex;
    height: 100vh;
    position: relative;
}

/* هدر */
.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-btn, .theme-toggle, .logout-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.menu-btn:hover, .theme-toggle:hover, .logout-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 30px;
    color: #667eea;
}

.user-details {
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-status {
    font-size: 12px;
    color: #27ae60;
    display: block;
}

/* منوی کناری */
.sidebar {
    position: fixed;
    top: 70px;
    right: -300px;
    width: 280px;
    height: calc(100vh - 70px);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 90;
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: #666;
    text-decoration: none;
    transition: background 0.3s;
    position: relative;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item.active {
    background: #e8f0fe;
    color: #667eea;
    border-right: 3px solid #667eea;
}

.coming-soon {
    position: absolute;
    left: 20px;
    background: #f39c12;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
}

/* منطقه اصلی چت */
.chat-main {
    margin-top: 70px;
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* پیام‌ها */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.bot-message .message-avatar {
    background: #2c3e50;
}

.message-content-wrapper {
    max-width: 70%;
}

.message-header {
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
}

.user-message .message-header {
    text-align: left;
}

.message-sender {
    font-weight: 600;
    color: #333;
    margin-left: 10px;
}

.message-time {
    color: #999;
    font-size: 11px;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    border-bottom-left-radius: 5px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* پیام خوش‌آمدگویی */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.bot-avatar {
    width: 80px;
    height: 80px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 40px;
}

.welcome-message h2 {
    margin-bottom: 10px;
    color: #333;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.suggestion-chip {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.suggestion-chip:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ناحیه ورودی */
.input-area {
    background: white;
    border-top: 1px solid #eee;
    padding: 20px;
    position: relative;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f5f5f5;
    border-radius: 25px;
    padding: 10px;
}

.media-buttons {
    display: flex;
    gap: 5px;
}

.media-btn {
    background: none;
    border: none;
    padding: 10px;
    color: #666;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    position: relative;
}

.media-btn:hover:not(.disabled) {
    background: #e0e0e0;
    color: #333;
}

.media-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.soon-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #f39c12;
    color: white;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 10px;
}

#messageInput {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 0;
    max-height: 120px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
}

#messageInput:focus {
    outline: none;
}

.send-btn {
    background: #667eea;
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 18px;
}

.send-btn:hover {
    background: #5a67d8;
}

/* پیش‌نمایش آپلود */
.upload-preview {
    margin-top: 10px;
}

.preview-content {
    position: relative;
    display: inline-block;
}

#previewImage {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
}

.remove-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
}

/* مودال تصویر */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

/* تم تیره */
.theme-dark .chat-page {
    background: #1a1a1a;
}

.theme-dark .chat-header {
    background: #2d2d2d;
    color: #e0e0e0;
}

.theme-dark .user-name,
.theme-dark .message-header,
.theme-dark .message-sender {
    color: #e0e0e0;
}

.theme-dark .bot-message .message-content {
    background: #363636;
    color: #e0e0e0;
}

.theme-dark .input-area {
    background: #2d2d2d;
    border-top-color: #404040;
}

.theme-dark .input-wrapper {
    background: #363636;
}

.theme-dark #messageInput {
    color: #e0e0e0;
}

/* واکنش‌گرایی موبایل */
@media (max-width: 768px) {
    .message-content-wrapper {
        max-width: 85%;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
    
    .media-buttons {
        gap: 2px;
    }
    
    .media-btn {
        padding: 8px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .user-info .user-details {
        display: none;
    }
    
    .message-content-wrapper {
        max-width: 90%;
    }
    
    .input-wrapper {
        padding: 5px;
    }
}
