/* متغيرات الألوان */
:root {
    --primary: #6c5ce7;
    --primary-dark: #5d4aec;
    --primary-light: #a29bfe;
    --dark: #0f172a;
    --darker: #0d1421;
    --light-dark: #1e293b;
    --gray: #94a3b8;
    --light: #f1f5f9;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

/* إعادة الضبط العامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

/* الهيدر */
.app-header {
    background: rgba(15, 23, 42, 0.85);
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
    position: relative;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(107, 70, 193, 0.4);
}

.brand-name {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.btn {
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(107, 70, 193, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(107, 70, 193, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* المحتوى الرئيسي */
.app-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* الشريط الجانبي */
.sidebar {
    width: 320px;
    background: rgba(15, 23, 42, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-light);
}

.section-title i {
    font-size: 1.2rem;
}

.user-card {
    background: rgba(30, 41, 59, 0.7);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(108, 92, 231, 0.1);
}

.user-card:hover {
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.user-card.active {
    border-left: 4px solid var(--primary);
    background: rgba(30, 41, 59, 0.9);
}

.user-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
}

.user-status.online .status-indicator {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.user-status.offline .status-indicator {
    background: var(--gray);
}

.last-message {
    padding: 15px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
    color: var(--gray);
    line-height: 1.5;
}

/* منطقة المحادثة الرئيسية */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.6);
}

.chat-header {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.current-chat-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chat-info h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.chat-actions {
    margin-left: auto;
    display: flex;
    gap: 15px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    color: var(--light);
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* منطقة الرسائل */
.messages-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png') rgba(15, 23, 42, 0.6);
}

.message {
    max-width: 75%;
    padding: 20px;
    border-radius: 20px;
    position: relative;
    animation: fadeIn 0.4s forwards;
    line-height: 1.6;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.message.received {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.9);
    border-bottom-left-radius: 5px;
}

.message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.new {
    animation: pulse 1.5s;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(108, 92, 231, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(108, 92, 231, 0); }
    100% { box-shadow: 0 0 0 0 rgba(108, 92, 231, 0); }
}

.message-content {
    font-size: 1.1rem;
    line-height: 1.6;
}

.message-time {
    text-align: right;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 10px;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.welcome-message {
    width: 100%;
    display: flex;
    justify-content: center;
}

.welcome-message .message {
    max-width: 85%;
    text-align: center;
    background: rgba(30, 41, 59, 0.9);
}

/* منطقة الإدخال */
.input-area {
    padding: 25px 30px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.message-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    border: 2px solid rgba(108, 92, 231, 0.3);
    border-radius: 16px;
    padding: 18px 25px;
    color: var(--light);
    font-size: 1.1rem;
    resize: none;
    min-height: 60px;
    max-height: 150px;
    transition: all 0.3s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 18px 28px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 60px;
}

.send-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(107, 70, 193, 0.4);
}

/* الفوتر */
.app-footer {
    padding: 18px 30px;
    background: rgba(15, 23, 42, 0.85);
    border-top: 2px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gray);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: var(--primary);
}
