/* style.css */
/* هذا الملف يحتوي على جميع الأنماط المخصصة التي لا توفرها Tailwind مباشرة */

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: rgb(18, 18, 18);
    /* #121212 */
}

.dark {
    color-scheme: dark;
}

/* ألوان النص */
.text-gray-100 {
    color: rgb(243 244 246);
}

.text-gray-300 {
    color: rgb(209 213 219);
}

.text-gray-400 {
    color: rgb(156 163 175);
}

/* ألوان المكونات (Zinc) */
.bg-zinc-950 {
    background-color: rgb(9 9 11);
}

.bg-zinc-900 {
    background-color: rgb(24 24 27);
}

.bg-zinc-800 {
    background-color: rgb(39 39 42);
}

.border-zinc-800 {
    border-color: rgb(39 39 42);
}

.border-zinc-700 {
    border-color: rgb(63 63 70);
}

/* ألوان العلامة (Purple) */
.text-purple-500 {
    color: rgb(168 85 247);
}

.text-purple-400 {
    color: rgb(192 132 252);
}

.border-purple-400 {
    border-color: rgb(192 132 252);
}

.text-purple-300 {
    color: rgb(216 180 254);
}

.bg-purple-600 {
    background-color: rgb(147 51 234);
}

.hover\:bg-purple-700:hover {
    background-color: rgb(126 34 206);
}

.border-purple-500 {
    border-color: rgb(168 85 247);
}

.focus\:ring-purple-500 {
    --tw-ring-color: rgb(168 85 247);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
}

/* اللون الثانوي (Gold) */
.bg-yellow-600 {
    background-color: rgb(202 138 4);
}

.hover\:bg-yellow-700:hover {
    background-color: rgb(180 83 9);
}

.text-yellow-400 {
    color: rgb(250 204 21);
}

.text-red-500 {
    color: rgb(239 68 68);
}

.text-red-400 {
    color: rgb(248 113 113);
}

.hover\:bg-red-500:hover {
    background-color: rgb(239 68 68);
}

/* تأثير الظل المتوهج */
.shadow-glow-lg {
    box-shadow: 0 0 25px -5px rgba(168, 85, 247, 0.4), 0 0 15px -5px rgba(168, 85, 247, 0.3);
}

/* تأثير البطاقة بالرفع */
.card-lift {
    background-color: rgb(24 24 27);
    border: 1px solid rgb(39 39 42);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(168, 85, 247, 0.4);
}

/* روابط التنقل (Header Nav) */
.nav-link {
    position: relative;
    color: rgb(156 163 175);
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 8px 0;
}

.nav-link:hover {
    color: rgb(243 244 246);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgb(168 85 247);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-link.active {
    color: rgb(243 244 246);
}

/* روابط التنقل للموبايل */
.mobile-nav-link {
    display: block;
    padding: 10px 24px;
    font-size: 1.125rem;
    font-weight: 500;
    color: rgb(209 213 219);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-nav-link:hover {
    background-color: rgb(39 39 42);
    color: white;
}

.mobile-nav-link.active {
    color: rgb(192 132 252);
}

/* شريط التنقل السفلي (Bottom Nav Bar) */
.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgb(156 163 175);
    transition: color 0.2s ease, border-color 0.2s ease;
    padding: 4px;
    flex-grow: 1;
    height: 100%;
}

.bottom-nav-link:hover {
    color: white;
}

.bottom-nav-link.active {
    color: rgb(192 132 252);
}

.bottom-nav-profile.active img {
    border-color: rgb(192 132 252);
}

.bottom-nav-profile img {
    transition: border-color 0.2s ease;
}

/* تبويبات البروفايل (Profile Tabs) */
#profile-tab-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgb(39 39 42);
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#profile-tab-container::-webkit-scrollbar {
    display: none;
}

.profile-tab {
    position: relative;
    padding: 12px 4px;
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(156 163 175);
    transition: color 0.3s ease;
    border: none;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.profile-tab:hover {
    color: rgb(243 244 246);
}

.profile-tab.active {
    color: rgb(243 244 246);
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: rgb(168 85 247);
}

/* عناصر القائمة المنسدلة والنوافذ */
.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    font-weight: 500;
    color: rgb(156 163 175);
    transition: all 0.2s ease;
    text-align: right;
}

.dropdown-item:hover {
    background-color: rgb(147 51 234);
    color: white;
}

/* [FIX] رفع طبقة النوافذ المنبثقة لتظهر فوق الشات في الموبايل */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    /* تم الرفع من 50 إلى 3000 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal-container.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    position: relative;
    z-index: 3001;
    /* تم الرفع من 51 إلى 3001 */
    background-color: rgb(24 24 27);
    border: 1px solid rgb(39 39 42);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 32rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(168, 85, 247, 0.2);
    animation: modalIn 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    margin-top: auto;
    margin-bottom: auto;
}

.modal-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: rgb(156 163 175);
}

.modal-input {
    display: block;
    width: 100%;
    background-color: rgb(39 39 42);
    border: 1px solid rgb(63 63 70);
    color: rgb(243 244 246);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: rgb(168 85 247);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
}

.file-input {
    padding: 0.5rem;
    cursor: pointer;
}

.file-input::file-selector-button {
    background-color: rgb(147 51 234);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 0.5rem;
}

.file-input::file-selector-button:hover {
    background-color: rgb(126 34 206);
}

/* Lightbox */
.carousel-nav-btn {
    background-color: rgba(24, 24, 27, 0.5);
    color: white;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3002;
    /* تم الرفع لتكون فوق النافذة */
}

.carousel-nav-btn:hover {
    background-color: rgba(24, 24, 27, 0.8);
}

#lightbox-thumbnail-strip {
    scrollbar-width: thin;
    scrollbar-color: rgb(168 85 247) rgb(18 18 18);
}

#lightbox-thumbnail-strip::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#lightbox-thumbnail-strip::-webkit-scrollbar-track {
    background: rgb(18 18 18);
}

#lightbox-thumbnail-strip::-webkit-scrollbar-thumb {
    background-color: rgb(168 85 247);
    border-radius: 3px;
}

.lightbox-thumbnail {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    aspect-ratio: 1 / 1;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
    margin-right: 0.5rem;
}

.lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.375rem;
}

.lightbox-thumbnail:hover {
    opacity: 1;
    border-color: rgb(63 63 70);
}

.lightbox-thumbnail.active {
    opacity: 1;
    border-color: rgb(168 85 247);
    transform: scale(1.05);
}

@media (min-width: 768px) {
    .lightbox-thumbnail {
        width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}

/* أزرار */
.modal-btn-cancel {
    padding: 0.75rem 1.25rem;
    background-color: rgb(63 63 70);
    color: rgb(243 244 246);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.modal-btn-cancel:hover {
    background-color: rgb(82 82 91);
}

.modal-btn-submit {
    padding: 0.75rem 1.25rem;
    background-color: rgb(147 51 234);
    color: white;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.modal-btn-submit:hover {
    background-color: rgb(126 34 206);
}

.modal-btn-pending {
    padding: 0.75rem 1.25rem;
    background-color: rgb(39 39 42);
    color: rgb(156 163 175);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgb(63 63 70);
    cursor: pointer;
}

.modal-btn-pending:hover {
    background-color: rgb(63 63 70);
    color: white;
}

/* [FIX] رفع طبقة رسائل التنبيه لتكون أعلى شيء */
.toast-message {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 3005;
    /* تم الرفع من 100 إلى 3005 */
    animation: toastIn 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.toast-message.hidden {
    display: none;
}

@media (max-width: 767px) {
    .toast-message {
        bottom: 5rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.modal-container.hidden .modal-backdrop {
    opacity: 0;
}

.modal-container.hidden .modal-content {
    animation: modalOut 0.3s ease-in forwards;
}

/* ==================================================================
   [تحديث جذري] تنسيقات المراسلة للموبايل (ملء الشاشة + كيبورد)
================================================================== */
@media (max-width: 767px) {
    /* md: */

    /* الوضع الافتراضي (قائمة المحادثات) */
    #chat-container {
        height: calc(100vh - 140px);
        /* ارتفاع تقريبي */
        border-radius: 0;
        border: none;
    }

    /* --- [تحديث] الوضع النشط (داخل المحادثة) --- */
    /* استخدام position: fixed لفرض ملء الشاشة فوق كل شيء */
    #chat-container.chat-view-active {
        position: fixed;
        /* يخرج العنصر من تدفق الصفحة */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;

        /* استخدام 100dvh للمتصفحات الحديثة لتجاهل شريط العنوان */
        height: 100vh;
        height: 100dvh;

        z-index: 2000;
        /* قيمة عالية جداً لتغطية الهيدر والفوتر */
        background-color: rgb(9 9 11);
        /* bg-zinc-950 */
        margin: 0;
        padding: 0;
        border: none;
        overflow: hidden;
        /* لمنع التمرير الخارجي */
    }

    /* إخفاء الشريط الجانبي تماماً عند فتح المحادثة */
    #chat-container.chat-view-active #chat-sidebar {
        display: none;
    }

    /* نافذة الشات الرئيسية تأخذ كامل المساحة */
    #chat-container.chat-view-active #chat-main {
        width: 100%;
        height: 100%;
        transform: translateX(0);
        display: flex;
        flex-direction: column;
    }

    /* الهيدر داخل الشات */
    #chat-main header {
        flex-shrink: 0;
        /* منع الانكماش */
        background-color: rgb(9 9 11);
        z-index: 10;
    }

    /* حاوية الرسائل: يجب أن تكون مرنة وتسمح بالتمرير */
    #chat-messages-container {
        flex: 1 1 auto;
        /* تنمو وتتقلص */
        overflow-y: auto;
        overscroll-behavior-y: contain;
        /* منع سحب الصفحة */
        height: 0;
        /* مهم جداً لعمل الـ flex scroll */
        min-height: 0;
    }

    /* صندوق الكتابة: ثابت في الأسفل */
    #chat-form {
        flex-shrink: 0;
        /* منع الانكماش */
        background-color: rgb(24 24 27);
        z-index: 10;
        /* سيتم التعامل مع الارتفاع بواسطة JS (visualViewport) */
    }

    /* إظهار زر الرجوع */
    #chat-back-button {
        display: flex;
    }
}