/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('../fonts/IRANYekanXVF.woff2') format('woff2'),
         url('../fonts/IRANYekanXVF.woff') format('woff');
    font-weight: 100 900;
    font-style: normal;
}

body {
    font-family: 'IRANYekan', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    align-items: stretch;
    width: 100%;
    justify-content: space-evenly;
    flex-direction: column;
}

        .chat-container {
            display: flex;
            height: 100vh;
        }
        
        /* Sidebar Styles */
        .sidebar {
            width: 300px;
            background: white;
            border-right: 1px solid #e0e0e0;
            display: flex;
            flex-direction: column;
        }
        
        .user-info {
            padding: 20px;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .user-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid #667eea;
        }
        
        .user-avatar-small {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .user-details h3 {
            color: #333;
            margin-bottom: 5px;
        }
        
        .user-details small {
            color: #4CAF50;
            font-size: 12px;
        }
        
        .menu {
            padding: 15px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .menu-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 15px;
            color: #555;
            text-decoration: none;
            border-radius: 8px;
            margin-bottom: 5px;
            transition: all 0.3s;
        }
        
        .menu-item:hover {
            background: #f0f0f0;
            color: #667eea;
        }
        
        .menu-item.active {
            background: #667eea;
            color: white;
        }
        
        .users-list {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }
        
        .user-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .user-item:hover {
            background: #f0f0f0;
        }
        
        .user-item.active {
            background: #e3f2fd;
            border-left: 4px solid #667eea;
        }
        
        /* Chat Area Styles */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .chat-header {
            padding: 20px;
            background: white;
            border-bottom: 1px solid #e0e0e0;
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .messages-container {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            background: #fafafa;
        }
        
        .message {
            display: flex;
            margin-bottom: 20px;
            max-width: 70%;
        }
        
        .message.sent {
            margin-left: auto;
            flex-direction: row-reverse;
        }
        
        .message.received {
            margin-right: auto;
        }
        
        .message-content {
            background: white;
            padding: 12px 16px;
            border-radius: 18px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.1);
        }
        
        .message.sent .message-content {
            background: #667eea;
            color: white;
            border-bottom-right-radius: 4px;
        }
        
        .message.received .message-content {
            background: white;
            border-bottom-left-radius: 4px;
        }
        
        .message-text {
            margin-bottom: 5px;
        }
        
        .message-file {
            margin-top: 10px;
            padding: 10px;
            background: #f5f5f5;
            border-radius: 8px;
        }
        
        .file-link {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #667eea;
            text-decoration: none;
        }
        
        .message-time {
            font-size: 11px;
            color: #999;
            text-align: right;
            margin-top: 5px;
        }
        
        .message-input-container {
            padding: 20px;
            background: white;
            border-top: 1px solid #e0e0e0;
        }
        
        .input-group {
            display: flex;
            gap: 10px;
            align-items: flex-end;
        }
        
        .message-input {
            flex: 1;
            padding: 12px 15px;
            border: 1px solid #ddd;
            border-radius: 25px;
            resize: none;
            height: 50px;
            font-size: 14px;
        }
        
        .message-input:focus {
            outline: none;
            border-color: #667eea;
        }
        
        .file-input-label {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 50px;
            height: 50px;
            background: #f0f0f0;
            border-radius: 50%;
            cursor: pointer;
            font-size: 20px;
        }
        
        .file-input {
            display: none;
        }
        
        .no-chat-selected {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #999;
            text-align: center;
        }
        
        /* Modal Styles */
        .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.active {
            display: flex;
        }
        
        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 10px;
            width: 90%;
            max-width: 400px;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .close-modal {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #999;
        }
        
        .profile-images {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
            margin-bottom: 20px;
        }
        
        .profile-image-option {
            width: 100%;
            aspect-ratio: 1;
            border-radius: 50%;
            object-fit: cover;
            cursor: pointer;
            border: 3px solid transparent;
            transition: all 0.3s;
        }
        
        .profile-image-option.selected {
            border-color: #667eea;
            transform: scale(1.1);
        }
        
        /* Responsive */
        @media (max-width: 768px) {
            .chat-container {
                flex-direction: column;
            }
            
            .sidebar {
                width: 100%;
                height: 60px;
                flex-direction: row;
                align-items: center;
                padding: 0 15px;
            }
            
            .user-info {
                padding: 0;
                border: none;
            }
            
            .menu {
                display: flex;
                gap: 10px;
                padding: 0;
                border: none;
                margin-left: auto;
            }
            
            .menu-item span:last-child {
                display: none;
            }
            
            .users-list {
                display: none;
                position: absolute;
                top: 60px;
                left: 0;
                width: 100%;
                height: calc(100vh - 60px);
                background: white;
                z-index: 100;
            }
            
            .users-list.active {
                display: block;
            }
        }

            .login-container {
                width: 100%;
                max-width: 400px;
                padding: 20px;
                    text-align: center;
    margin: 0 auto;
            }
            
            .login-box {
                background: white;
                padding: 40px;
                border-radius: 10px;
                box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            }
            
            .login-box h1 {
                text-align: center;
                color: #333;
                margin-bottom: 30px;
                font-size: 24px;
            }
            
            .form-group {
                margin-bottom: 20px;
            }
            
            .form-group label {
                display: block;
                margin-bottom: 8px;
                color: #555;
                font-weight: 500;
            }
            
            .form-group input {
                width: 100%;
                padding: 12px 15px;
                border: 1px solid #ddd;
                border-radius: 5px;
                font-size: 16px;
                transition: border-color 0.3s;
            }
            
            .form-group input:focus {
                outline: none;
                border-color: #667eea;
            }
            
            .btn {
                    font-family: 'IRANYekan';
                width: 100%;
                padding: 12px;
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                color: white;
                border: none;
                border-radius: 5px;
                font-size: 16px;
                cursor: pointer;
                transition: transform 0.2s;
            }
            
            .btn:hover {
                transform: translateY(-2px);
            }
            
            .login_btn{
                    width: 100%!important;
            }
            
            .error {
                background: #ffebee;
                color: #c62828;
                padding: 10px;
                border-radius: 5px;
                margin-bottom: 20px;
                text-align: center;
            }
/* Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    display: block;
    width: 10%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}



.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Chat layout */
.chat-container {
    display: flex;
    height: 100vh;
    background: #f5f5f5;
}

.pass_change_btn
 {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pass_change_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.profile_change_btn
 {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}
.profile_change_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.user-info {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
}

.user-details h3 {
    margin-bottom: 5px;
    font-weight: 700;
}

.menu {
    padding: 20px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    color: #333;
    text-decoration: none;
}

.menu-item:hover {
    background: #f0f0f0;
}

.menu-item.active {
    background: #667eea;
    color: white;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.user-item:hover {
    background: #f0f0f0;
}

.user-item.active {
    background: #e3f2fd;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Chat area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

.message {
    display: flex;
    margin-bottom: 20px;
    max-width: 70%;
}

.message.sent {
    margin-right: auto;
    flex-direction: row-reverse;
}

.message.received {
    margin-left: auto;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 10px;
}

.message-content {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.message.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-text {
    margin-bottom: 10px;
    line-height: 1.5;
}

.message-file {
    margin-top: 10px;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f0f0f0;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s;
}

.file-link:hover {
    background: #e0e0e0;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    text-align: left;
}

.message.sent .message-time {
    color: rgba(255,255,255,0.8);
}

/* Message input */
.message-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.input-group {
    display: flex;
    gap: 10px;
}

.message-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    height: 60px;
}

.message-input:focus {
    outline: none;
    border-color: #667eea;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.file-input-label:hover {
    background: #e0e0e0;
}

.file-input {
    display: none;
}

/* Modal */
.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.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.profile-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.profile-image-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.3s;
}

.profile-image-option:hover {
    border-color: #667eea;
}

.profile-image-option.selected {
    border-color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 70px;
        flex-direction: row;
        border-left: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .user-info {
        width: 200px;
        padding: 10px;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .menu {
        display: flex;
        flex: 1;
        padding: 0;
        justify-content: space-around;
    }
    
    .menu-item {
        margin: 0;
        padding: 10px;
        flex-direction: column;
        text-align: center;
        font-size: 12px;
    }
    
    .users-list {
        position: fixed;
        top: 70px;
        right: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: white;
        z-index: 100;
        display: none;
    }
    
    .users-list.active {
        display: block;
    }
    
    .message {
        max-width: 85%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
