/* استایل‌های سفارشی و بهینه‌سازی شده */
:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    line-height: 1.6;
    min-height: 100vh;
}

/* کارت‌ها */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* دکمه‌ها */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #c62828);
    border: none;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.875rem;
}

/* نوار ناوبری */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 0.8rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* فرم‌ها */
.form-control, .input-group-text {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
    transform: translateY(-1px);
}

/* منطقه چت */
.chat-container {
    height: 65vh;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    margin-bottom: 12px;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

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

.message-sent {
    margin-left: auto;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-received {
    margin-right: auto;
    background: white;
    color: var(--dark-bg);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-content {
    padding: 12px 16px;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 4px;
}

/* لیست دوستان */
.friend-item {
    transition: var(--transition);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.friend-item:hover {
    background: rgba(67, 97, 238, 0.05);
    border-color: var(--border-color);
    transform: translateX(5px);
}

.friend-item.active {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--primary-color);
}

/* نشانگر آنلاین */
.online-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.online-status.online {
    background-color: #4CAF50;
    box-shadow: 0 0 8px #4CAF50;
}

.online-status.offline {
    background-color: #9e9e9e;
}

/* موبایل ریسپانسیو */
@media (max-width: 768px) {
    .chat-container {
        height: 60vh;
    }
    
    .message {
        max-width: 85%;
    }
    
    .friend-item {
        padding: 10px 12px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* انیمیشن لودینگ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* اعلان‌ها */
.alert {
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

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

/* مودال */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
}

/* آواتار */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

/* سرچ باکس */
.search-box {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
}

.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(67, 97, 238, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* پاپ‌آپ اعلان */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* تایپینگ ایندیکیتور */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    width: fit-content;
    margin: 5px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* بهبود سرعت */
img, .card, .btn {
    will-change: transform;
}

/* استایل برای وضعیت آنلاین در لیست */
.user-status {
    font-size: 0.8rem;
    color: #666;
}

.user-status.online {
    color: #4CAF50;
    font-weight: 500;
}

/* استایل‌های خاص برای موبایل */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* استایل برای وضعیت خوانده/نخوانده */
.unread-badge {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}
