:root {
    --primary-color: #6e48aa;
    --secondary-color: #9d50bb;
    --accent-color: #4776E6;
    --light-bg: #1e1e1e;
    --dark-bg: #2d3748;
    --dark-text: #f8f9fa;
    --light-text: #f8f9fa;
    --user-bubble: #4776E6;
    --ai-bubble: #2d3748;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

body {
    background: var(--light-bg);
    color: var(--dark-text);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: var(--dark-bg);
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 10px;
}

.logo img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    height: 50px;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 600;
    background: #ffffff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0 5%;
}

.new-chat-btn {
    background: #6e48aa;
    color: white;
    border: none;
    padding: 12px 20px;
    margin: 0 15px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.new-chat-btn i {
    margin-right: 8px;
}

.search-container {
    padding: 0 15px;
    margin: 0 10px 15px;
}

.search-box {
    position: relative;
    background: var(--dark-bg);
    border-radius: 20px;
    border: 1px solid #4a5568;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 15px;
    box-shadow: var(--shadow);
}

.search-box:hover {
    border-color: var(--primary-color);
}

.search-box.focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(110, 72, 170, 0.2);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 14px;
}

.search-input {
    width: 100%;
    padding: 0 0 0 30px;
    background: transparent;
    border: none;
    color: var(--light-text);
    font-size: 0.9rem;
    outline: none;
    height: 100%;
}

.search-input::placeholder {
    color: #a0aec0;
    opacity: 0.8;
    font-weight: 300;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px;
}

.chat-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    position: relative;
    background: rgba(255,255,255,0.05);
}

.chat-item:hover {
    background-color: rgba(113, 128, 185, 0.1);
}

.chat-item.active {
    background-color: rgba(113, 128, 185, 0.2);
    font-weight: 500;
}

.chat-item i {
    margin-left: 10px;
    color: var(--primary-color);
}

.chat-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-chat {
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
    font-size: 12px;
    cursor: pointer;
    color: #a0aec0;
}

.chat-item:hover .edit-chat {
    opacity: 1;
    color: var(--primary-color);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--light-bg);
}

.chat-header {
    padding: 15px 20px;
    background: var(--dark-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    z-index: 5;
}

.chat-title {
    font-weight: 600;
    font-size: 1.2rem;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-left: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: var(--primary-color);
    color: white;
}

.auth-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.auth-btn i {
    margin-left: 8px;
    font-size: 0.9rem;
}

.auth-btn.farsi i {
    margin-left: 0;
    margin-right: 8px;
}

.auth-links {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--light-bg);
}

.message {
    width: fit-content;
    max-width: 65%;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: var(--radius);
    position: relative;
    animation: fadeIn 0.3s ease-out;
    box-shadow: var(--shadow);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: var(--user-bubble);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.ai-message {
    background: var(--ai-bubble);
    border: 1px solid #4a5568;
    margin-right: auto;
    border-bottom-left-radius: 0;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
}

.question-form-container {
    padding: 2%;
    background: var(--dark-bg);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

#question-form {
    display: flex;
    background: var(--dark-bg);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #4a5568;
}

#question-input {
    flex: 1;
    padding: 15px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: var(--light-text);
}

#question-input:focus {
    box-shadow: 0 0 0 2px rgba(110, 72, 170, 0.2);
}

#submit-btn {
    background: #6e48aa;
    color: white;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    font-size: 1.2rem;
}

#submit-btn:hover {
    opacity: 0.9;
}

.guest-warning {
    background: #fff3cd;
    color: #856404;
    padding: 10px 20px;
    margin: 10px 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    animation: slideIn 0.5s ease-out;
    margin-left: 10px;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.guest-warning i {
    margin-right: 10px;
    margin-left: 10px;
}
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    margin-right: 8px;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.user-profile-container {
    position: relative;
    margin-left: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: all 0.3s;
}

.user-profile:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.username {
    font-size: 0.9rem;
    font-weight: 500;
}

.profile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: var(--dark-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 100;
    display: none;
    border: 1px solid #4a5568;
}

.profile-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--light-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.menu-item i {
    margin-right: 10px;
    width: 18px;
    text-align: center;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-item.logout {
    color: #f56565;
}

.divider {
    height: 1px;
    background-color: #4a5568;
    margin: 8px 0;
}

.code-container {
    background: #282c34;
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    direction: ltr;
}

.code-header {
    background: #2d3748;
    color: #fff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.language-tag {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 20px;
}

.copy-btn {
    background: #444;
    color: #fff;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}

.copy-btn:hover {
    background: #555;
}

#edit-title-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--dark-bg);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .chat-container {
        margin-bottom: 80px;
    }

    .message {
        max-width: 85%;
    }
    
    .auth-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
.message.user-message .message-time {
    direction: ltr;
}
.logo {
    text-align: center;
}
/* استایل هدر موبایل */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--dark-bg);
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.hamburger-menu {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.mobile-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.mobile-auth {
    display: flex;
    align-items: center;
    padding:10px ;
}

.mobile-profile {
    display: flex;
    align-items: center;
}

.mobile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-avatar-text {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.mobile-login-btn {
    color: white;
    font-size: 1.2rem;
}
@media (max-width: 768px) {

    .mobile-header {
        display: flex;
    }
    
    .chat-header {
        display: none;
    }
    
    .sidebar {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 80%;
        height: calc(100vh - 60px);
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .chat-container {
        margin-top: 60px;
        margin-bottom: 0;
    }
    .question-form-container {
        padding: 2%;
        background: var(--dark-bg);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        bottom: 0%;
        position: fixed;
        width: 100%;
    }
    .guest-warning {
        background: #fff3cd;
        color: #856404;
        padding: 10px 20px;
        border-radius: var(--radius);
        display: flex;
        align-items: center;
        animation: slideIn 0.5s ease-out;
        margin-top: 2.5%;
        position: fixed;
        width: 95%;
        left: 0.1%;
    }
        .chat-messages {
        padding-bottom: 35%;
    }
}
.profile-menu {
    position: fixed;
    top: 70px;
    width: 200px;
}

@media (min-width: 769px) {
    .profile-menu {
        position: absolute;
        top: 100%;
        left: 0;
    }
}
.mobile-profile-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2d3748;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
}

.mobile-profile-menu.show {
    transform: translateY(0);
}

.mobile-profile-menu .menu-item {
    display: flex;
    align-items: center;
    padding: 15px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid #4a5568;
}

.mobile-profile-menu .menu-item i {
    margin-left: 10px;
    width: 24px;
    text-align: center;
}

.mobile-profile-menu .menu-item:last-child {
    border-bottom: none;
}

.mobile-profile-menu .close-btn {
    position: absolute;
    top: 10px;
    left: 15px;
    color: white;
    font-size: 1.5rem;
    background: none;
    border: none;
}

.mobile-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1099;
    display: none;
}

.mobile-profile-overlay.show {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}