      * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg,rgb(32, 36, 42) 0%,rgb(37, 38, 41) 100%);
            color: #333;
            line-height: 1.6;
            direction: ltr;
            text-align: left;
        }

        .main-container {
            display: flex;
            max-width: 1200px;
            margin: 0 auto;
            gap: 20px;
            padding: 20px;
            min-height: 100vh;
        }
        /* إخفاء الفوتر في الشاشات الكبيرة */
@media (min-width: 769px) {
    .mobile-footer-nav {
        display: none !important;
    }
}
/* تنسيق الفوتر للجوال */
@media (max-width: 768px) {
.mobile-footer-nav {
        display: flex;
        justify-content: space-around;
        align-items: center; /* 💡 توسيط عمودي للأيقونات */
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px; /* ارتفاع ثابت ومناسب */
        background: #ffffff;
        border-top: 1px solid #efefef;
        z-index: 2000;
        
        /* ⚠️ تأكد من أن هذه القيم صفر إذا كانت الأيقونات نازلة للأسفل */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #262626;
        text-decoration: none;
        font-size: 10px;
        flex: 1;
    }

    .nav-item i {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .nav-item.active {
        color: #0095f6;  /* لونك الأخضر المفضل */
    }

    .footer-avatar {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        object-fit: cover;
    }

    /* تنسيق زر الإضافة العائم (اختياري) */
    .add-btn-main .add-inner {
        background : #0095f6; 
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 18px;
        box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
        margin-bottom: 5px;
    }
}

        /* الشريط الجانبي الأيسر */
        .sidebar-left {
            width: 250px;
            background: white;
            border-radius: 15px;
            padding: 20px;
            height: fit-content;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            position: sticky;
            top: 20px;
        }

        .sidebar-profile {
            text-align: center;
            margin-bottom: 25px;
            padding-bottom: 20px;
            border-bottom: 2px solid #f0f0f0;
        }

        .sidebar-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            object-fit: cover;
            margin-bottom: 15px;
            border: 4px solid #1da1f2;
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
        }

        .sidebar-username {
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
        }

        .sidebar-menu {
            list-style: none;
        }

        .sidebar-menu li {
            margin-bottom: 8px;
        }

        .sidebar-menu a {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 15px;
            color: #666;
            text-decoration: none;
            border-radius: 10px;
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .sidebar-menu a:hover {
            background: linear-gradient(135deg, #4cadaf 0%, #4cadaf 100%);
            color: white;
            transform: translateX(5px);
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
        }

        .sidebar-menu a.active {
            background: linear-gradient(135deg, #4cadaf 0%, #4cadaf 100%);
            color: white;
        }

        /* المحتوى الرئيسي */
        .main-content {
            flex: 1;
            max-width: 600px;
        }

        /* ================================================= */
/* قسم القصص (Story List - الشريط العلوي) */
/* ================================================= */

.stories-section {
    /* أساس القسم الخارجي */
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.stories-container {
    /* حاوية القصص (شريط التمرير الأفقي) */
    display: flex;
    gap: 15px; /* المسافة بين كل قصة */
    overflow-x: auto; /* تفعيل التمرير الأفقي */
    padding: 10px 0;
    /* إخفاء شريط التمرير الأفقي (اختياري) */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}
.stories-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.story-item {
    flex-shrink: 0; 
    flex-basis: 80px; /* عرض 80 بكسل لكل قصة */
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.story-item:hover {
    transform: scale(1.05);
}

/* ================================================= */
/* أنماط صورة البروفايل في قائمة القصص (Story List) */
/* ================================================= */

.story-avatar {
    /* الصورة الرمزية في القصص */
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #4cadaf; /* حدود خضراء للقصص النشطة */
    margin-bottom: 5px;
}

.story-username {
    font-size: 0.8em;
    color: #666;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* أنماط أيقونة إضافة قصة */
.add-story {
    position: relative;
}
.add-story-icon {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: #009cbb;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    font-size: 0.7em; 
}


/* ================================================= */
/* تنسيق شاشة عرض القصة المنبثقة (#story-viewer-modal) */
/* ================================================= */


/* ================================================= */
/* تنسيق معلومات المستخدم وزر الحذف داخل العرض */
/* ================================================= */


.nav-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    padding: 20px 10px;
    cursor: pointer;
    pointer-events: auto; /* يجعل الأزرار قابلة للنقر */
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-btn:disabled {
    opacity: 0.2;
    cursor: default;
}

.nav-btn:hover:not(:disabled) {
    opacity: 1;
}

        /* زر إضافة المنشور */
        .create-post-btn {
            background: linear-gradient(135deg,#4cadaf 0%, #4cadaf 100%);
            color: white;
            border: none;
            padding: 15px 25px;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            font-size: 1.1em;
            width: 100%;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
        }

        .create-post-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
        }

        /* منطقة المنشورات */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px; /* 🚨 تعديل: تقليل الـ padding العمودي (من 20px إلى 10px) لتقليل الارتفاع العام */
    border-bottom: 1px solid #f0f0f0;
    /* 💡 الحل الإضافي: فرض أقصى ارتفاع إذا كان الـ padding وحده غير كافٍ، لكن يفضل الاعتماد على الـ padding */
    /* max-height: 80px; */ 
}

.post-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4CAF50;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.post-time {
    color: #666;
    font-size: 0.9em;
}

.post-content {
    padding: 0 20px 20px;
}

.post-text {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #333;
}

.post-media {
    width: 100%;
    /* ❌ قم بإزالة max-height: 400px; */
    /* ❌ قم بإزالة object-fit: cover; */
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.post-action-buttons {
    display: flex;
    gap: 20px;
}

.post-action {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.post-action:hover {
    background: #f0f0f0;
    color: #4CAF50;
}

.post-action.liked {
    color: #e91e63;
}

.post-stats {
    color: #666;
    font-size: 0.9em;
}

/* 💡 تنسيقات الخيارات المنسدلة المصححة (ضرورية لعدم تضخيم الرأس) */
.post-actions-dropdown {
    position: relative; 
    /* 🚨 إضافة: هذا يضمن أن ارتفاع الزر لا يسبب ارتفاعًا إضافيًا */
    align-self: flex-start; 
}

.post-options-btn {
    /* 🚨 إضافة: لتقليل الحجم حول النقاط الثلاث */
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.post-options-menu {
    position: absolute; 
    top: 100%; 
    right: 0;
    
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
    min-width: 150px;
    padding: 5px 0;
}


/* 1. الحاوية: تبقى القيود الأساسية هنا */
.post-video-wrapper {
    /* 🚨 يجب أن نضع الحد الأقصى للارتفاع هنا */
    max-height: 400px; 
    
    /* 🔑 الحل: لا نحتاج إلى overflow: hidden الآن لأننا سنضبط object-fit على وسم الفيديو */
    /* قم بالتأكد من إزالة overflow: hidden; */ 

    position: relative;
    border-radius: 10px;
    margin-bottom: 15px;
    width: 100%; /* للتأكيد */
}

/* 2. وسم الفيديو: يملأ الحاوية ويعرض نفسه بشكل "لائق" (Cover) */
.post-video-element {
    width: 100%;
    height: 100%;
    display: block;
    
    /* 💡 في الوضع العادي: نستخدم cover لملء الإطار (يتم القص من الأعلى والأسفل إذا كان الفيديو أطول) */
    object-fit: cover; 
    
    /* 🚨 هذا يضمن أن ارتفاع الفيديو لا يتجاوز ارتفاع الحاوية */
    max-height: 400px;
}

/* 3. 🔑 التعديل الحاسم: إجبار سلوك ملء الشاشة */
/* عندما يدخل المتصفح في وضع ملء الشاشة، نتجاهل كل القيود ونستخدم object-fit: contain */
.post-video-element:fullscreen {
    width: 100%;
    height: 100%;
    
    /* 🛑 هذا هو مفتاح حل مشكلة "الجزء الظاهر فقط": يجبر المتصفح على عرض الفيديو كاملاً */
    object-fit: contain; 
    
    /* 🛑 إزالة أي قيود ارتفاع سابقة قد تكون موروثة */
    max-height: none; 
}

/* 4. لإعادة ظهور أيقونة ملء الشاشة الأصلية */
.post-video-element::-webkit-media-controls-fullscreen-button {
    display: block !important;
}


      /* للتأكد من أن الإعلان داخل الخلاصة يتجاوب مع عرض المنشور */
.ad-card-in-feed {
    width: 100%;
    /* تأكد من أن أي محتوى داخله لا يتجاوز 100% */
}

.ad-card-in-feed iframe,
.ad-card-in-feed img {
    max-width: 100% !important; 
    height: auto; 
}

        /* الشريط الجانبي الأيمن */
        .sidebar-right {
            width: 300px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .widget {
            background: white;
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        }

        .widget-title {
            font-weight: bold;
            margin-bottom: 15px;
            color: #333;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .suggested-user {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .suggested-user:last-child {
            border-bottom: none;
        }

        .suggested-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            object-fit: cover;
        }

        .suggested-info {
            flex: 1;
        }

        .suggested-username {
            font-weight: 600;
            color: #333;
            margin-bottom: 2px;
        }

        .suggested-mutual {
            color: #666;
            font-size: 0.8em;
        }

        .follow-btn {
            background: #4cadaf;
            color: white;
            border: none;
            padding: 6px 15px;
            border-radius: 15px;
            cursor: pointer;
            font-size: 0.9em;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .follow-btn:hover {
            background: #33c9dde4;
            transform: scale(1.05);
        }

        .follow-btn.following {
            background: #666;
        }

        /* النوافذ المنبثقة */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            justify-content: center;
            align-items: center;
            z-index: 1000;
            backdrop-filter: blur(5px);
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 15px;
            width: 90%;
            max-width: 600px;
            max-height: 90vh;
            overflow-y: auto;
            animation: modalSlide 0.3s ease-out;
        }

        @keyframes modalSlide {
            from {
                opacity: 0;
                transform: translateY(-50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 2px solid #f0f0f0;
        }

        .modal-title {
            font-size: 1.3em;
            font-weight: bold;
            color: #333;
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 1.5em;
            cursor: pointer;
            color: #666;
            padding: 5px;
            border-radius: 50%;
            transition: all 0.3s ease;
        }

        .modal-close:hover {
            background: #f0f0f0;
            color: #333;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #333;
        }

        .form-control {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 16px;
            transition: all 0.3s ease;
            outline: none;
        }

        .form-control:focus {
            border-color: #4CAF50;
            box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
        }

        textarea.form-control {
            resize: vertical;
            min-height: 100px;
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s ease;
            font-size: 0.95em;
        }

        .btn-primary {
            background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
        }

        .btn-outline {
            background: transparent;
            color: #4CAF50;
            border: 2px solid #4CAF50;
        }

        .btn-outline:hover {
            background: #4CAF50;
            color: white;
        }

       /* نافذة التعليقات */
        .comments-modal-content {
            max-width: 800px;
            width: 95%;
        }

        .comments-section {
            max-height: 400px;
            overflow-y: auto;
            margin: 20px 0;
        }

.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    position: relative; /* إضافة هذه الخاصية */
}


        .comment-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }

        .comment-content {
            flex: 1;
        }

        .comment-username {
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
        }

        .comment-text {
            color: #666;
            line-height: 1.4;
        }

        .add-comment {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .add-comment textarea {
            flex: 1;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 20px;
            resize: none;
            outline: none;
            min-height: 40px;
        }

        .add-comment button {
            background: #4CAF50;
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: 500;
        }

        /* رسائل التنبيه */
        .alert {
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 20px;
            animation: slideDown 0.3s ease-out;
        }

        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .alert-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* تصميم متجاوب */
        @media (max-width: 768px) {
            .main-container {
                flex-direction: column;
                padding: 10px;
                gap: 15px;
            }

            .sidebar-left {
                width: 100%;
                order: 3;
                position: static;
            }

            .main-content {
                order: 1;
                max-width: 100%;
            }

            .sidebar-right {
                width: 100%;
                order: 2;
            }

            .story-avatar {
                width: 50px;
                height: 50px;
            }

            .post-header {
                padding: 15px;
            }

            .post-content {
                padding: 0 15px 15px;
            }

            .post-actions {
                padding: 12px 15px;
            }

            .post-action-buttons {
                gap: 15px;
            }

            .modal-content {
                width: 95%;
                padding: 20px;
                margin: 10px;
            }

            .sidebar-menu a {
                padding: 10px 12px;
                font-size: 0.9em;
            }

            .sidebar-avatar {
                width: 60px;
                height: 60px;
            }
        }

        @media (max-width: 480px) {
            .main-container {
                padding: 5px;
            }

            .stories-section {
                padding: 15px;
            }

            .post-header {
                padding: 12px;
            }

            .post-content {
                padding: 0 12px 12px;
            }

            .post-actions {
                padding: 10px 12px;
            }

            .post-action-buttons {
                gap: 10px;
            }

            .post-action {
                padding: 6px 10px;
                font-size: 0.9em;
            }

            .create-post-btn {
                padding: 12px 20px;
                font-size: 1em;
            }
        }

        /* تحسينات إضافية */
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid #f3f3f3;
            border-top: 3px solid #4CAF50;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .no-posts {
            text-align: center;
            padding: 60px 20px;
            color: #666;
        }

        .no-posts i {
            font-size: 4em;
            margin-bottom: 20px;
            color: #ddd;
        }
                /* أنماط جديدة للقصص */


        
        /* زر حذف المنشور */
        .delete-post {
            background:rgb(182, 205, 208);
            color: white;
            border: none;
            padding: 5px 10px;
            border-radius: 5px;
            cursor: pointer;
            margin-left: 10px;
        }
        

        
        /* بروفايل صغير للمستخدم */
        .profile.php {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px;
            background: white;
            border-radius: 10px;
            margin-bottom: 15px;
        }
        
        .mini-profile-img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
        }
.options-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.options-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.options-list li:last-child {
    border-bottom: none;
}

.options-list a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.options-list a:hover {
    color: #4267B2;
}
/* تنسيقات قائمة خيارات المنشور */
.post-actions-dropdown {
    position: relative;
    margin-left: auto;
}

.post-options-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    font-size: 16px;
    outline: none;
}

.post-options-btn:hover {
    color: #333;
}

.post-options-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000; /* تأكد من أن هذه القيمة أعلى من أي عنصر آخر */
    min-width: 150px;
    overflow: hidden;
}

.delete-post-btn {
    width: 100%;
    padding: 8px 12px;
    text-align: right;
    background: none;
    border: none;
    cursor: pointer;
    color: #ff4444;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-post-btn:hover {
    background: #ffeeee;
}

.delete-post-btn i {
    font-size: 12px;
}
.delete-comment-btn {
    display: inline-block !important;
    color: red;
}
 
        /* زر حذف التعليق */
.delete-comment-btn {
    position: absolute; /* تغيير إلى absolute */
    left: auto; /* إلغاء أي قيمة لـ left */
    right: 12px; /* تحديد المسافة من اليمين */
    top: 12px; /* تحديد المسافة من الأعلى */
    background: none;
    border: none;
    color:rgb(162, 151, 151);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.delete-comment-btn:hover {
    color: #cc0000;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* ======================================= */
/* 1. تنسيق النافذة ومحتواها (MODAL STRUCTURE) */
/* ======================================= */

/* المودال الأساسي: خلفية داكنة لتسليط الضوء على المحتوى */
.modal {
    background-color: rgba(0, 0, 0, 0.8); /* خلفية سوداء شفافة أنيقة */
    transition: opacity 0.3s ease; /* إضافة حركة سلسة عند الفتح/الإغلاق */
}

/* محتوى المودال: جعله مستديراً وجذاباً */
.modal-content {
    background-color: #ffffff; /* خلفية بيضاء نقية */
    padding: 25px 30px;
    border-radius: 12px; /* حواف مستديرة أكثر */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* ظل ناعم */
    animation: fadeIn 0.3s ease-out; /* حركة ظهور صغيرة */
}

/* حركة ظهور للمودال */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ======================================= */
/* 2. تنسيق العنوان والإغلاق (HEADER & CLOSE) */
/* ======================================= */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee; /* خط فاصل خفيف */
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: #333; /* لون نص داكن وواضح */
    font-size: 1.5em;
    font-weight: 600; /* خط سميك قليلاً */
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8em;
    color: #aaa; /* لون رمادي فاتح وأنيق */
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #e74c3c; /* لون أحمر خفيف عند التمرير */
}

/* ======================================= */
/* 3. تنسيق النموذج وحقل الملف (FORM & INPUT) */
/* ======================================= */

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #555;
}

/* 💡 تنسيق حقل رفع الملفات ليكون أكثر جمالاً */
.form-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px dashed #ccc; /* حدود متقطعة جذابة */
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    background-color: #f9f9f9;
    transition: all 0.3s;
}

.form-group input[type="file"]:hover {
    border-color: #3498db; /* تغيير اللون عند التمرير */
    background-color: #f0faff;
}

/* ======================================= */
/* 4. تنسيق زر الإرسال (SUBMIT BUTTON) */
/* ======================================= */

.btn-primary {
    display: block;
    width: 100%; /* زر بعرض كامل */
    padding: 12px;
    background-color: #3498db; /* لون أزرق جذاب */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #2980b9; /* لون أغمق قليلاً عند التمرير */
}

.btn-primary:active {
    transform: scale(0.99); /* تأثير ضغطة بسيطة */
}


/* 1. إعدادات المودال العام (story-viewer-modal) */
/* =================================================== */
/* 1. الحاوية الكبرى التي تجمع الأيقونات والستوريات */
.stories-section {
    padding-top: 0 !important;   /* إزالة أي مسافة علوية في القسم بالكامل */
    margin-top: 0 !important;
}

/* 2. شريط الأيقونات العلوي */
.mobile-top-bar {
    display: flex;
    width: 100%;
    padding: 10px 15px 0 15px; /* قللنا المسافة السفلية (الرقم الثالث 0) */
    margin-bottom: 0 !important; /* التأكد من عدم وجود هامش سفلي */
    background: transparent;
    box-sizing: border-box;
}

/* 3. حاوية الستوريات نفسها */

/* دفع الأيقونات لليمين (كما فعلنا سابقاً) */
.top-actions {
    display: flex;
    gap: 20px;
    margin-left: auto;
    align-items: center;
}

#story-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* خلفية سوداء شبه شفافة */
    display: flex;
    justify-content: center; /* توسيط أفقي */
    align-items: center; /* توسيط عمودي */
    z-index: 9999;
}

/* 2. حاوية محتوى القصة (story-content-viewer) */
.story-content-viewer {
    max-width: 400px; /* لتقريبها من شكل الهاتف */
    width: 100%;
    height: 90vh; /* نسبة 90% من ارتفاع الشاشة */
    padding: 0;
    overflow: hidden;
    position: relative;
    background-color: black; /* خلفية سوداء للتركيز على المحتوى */
    border-radius: 12px; /* إضافة حواف مستديرة */
}

/* 3. تنسيق الوسائط (لضمان العرض اللائق) */
#story-media-display {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.story-media-content {
    width: 100%;
    height: 100%;
    /* 💡 التنسيق الأهم: يجعل الصورة/الفيديو يتناسب داخل الحاوية */
    object-fit: contain; 
}


/* =================================================== */
/* 4. شريط التقدم في الأعلى (Story Progress Bar) */
/* =================================================== */
.story-progress-bar {
    position: absolute;
    top: 5px; /* مسافة بسيطة من الأعلى */
    left: 5px;
    right: 5px;
    width: calc(100% - 10px);
    height: 4px;
    display: flex; /* لتقسيم الشريط إلى شرائح */
    gap: 2px;
    z-index: 1001; 
}

.story-progress-segment {
    flex-grow: 1; /* جعل كل جزء يأخذ مساحة متساوية */
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

/* الشريط الأبيض الذي يمثل التقدم داخل الشريحة */
.story-progress-segment::before {
    content: '';
    display: block;
    height: 100%;
    background-color: white;
    width: 0%; /* يبدأ بصفر */
    /* 💡 مهم: التخلص من الـ transition هنا، لأننا نستخدمه في JS لـ width */
}


/* =================================================== */
/* 5. منطقة معلومات المستخدم والإغلاق (story-user-info) */
/* =================================================== */
#story-user-info {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    z-index: 1002;
    color: white;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), rgba(0,0,0,0));
}

.story-user-info-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid white;
}

.delete-story-btn {
    position: absolute;
    bottom: 15px; /* تثبيته بجانب الإحصائيات أو فوقها بقليل */
    right: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    padding: 8px;
    z-index: 1002;
}


/* =================================================== */
/* 6. منطقة إرسال الرسالة والتفاعل (story-reply-area) */
/* =================================================== */
/* الحاوية الرئيسية التي تجمع الثلاثة في صف واحد */
#story-reply-area {
    position: absolute;
    bottom: 20px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 12px; /* المسافة بين الحقل والقلب */
    z-index: 1010;
}

/* غلاف الحقل وزر الإرسال */
.reply-wrapper {
    position: relative;
    flex-grow: 1; /* يجعل الحقل يأخذ كل المساحة المتبقية */
    display: flex;
    align-items: center;
}

#story-reply-input {
    width: 100%;
    padding: 12px 45px 12px 15px; /* مسافة لليمين لزر الإرسال */
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: white;
    font-size: 0.95em;
    outline: none;
}

/* زر الإرسال (الطائرة الورقية) - يبقى داخل الحقل */
#story-reply-btn {
    position: absolute;
    right: 10px; 
    background: none;
    border: none;
    color: #3498db;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
}

/* زر القلب - الآن أصبح بجانبهم في نفس الصف */
#story-like-btn {
    position: static; /* ألغينا التموضع المطلق ليصبح في الصف */
    background: none;
    border: none;
    color: white;
    font-size: 1.6em;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
}

#story-like-btn:active {
    transform: scale(1.2);
}
.story-stats-owner {
    position: absolute;
    bottom: 10px;
    left: 15px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    z-index: 1002;
    font-size: 0.9em;
}


/* --- إصلاحات الستوري من الداخل --- */
.story-content-viewer {
    height: 95vh !important;
    background: #000;
}

/* زر الإغلاق X في أقصى اليمين بعيداً عن الحذف */
.story-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    font-size: 25px;
    color: white;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* نقل الإحصائيات والقلب للأسفل */
.story-footer-actions {
    position: absolute;
    bottom: 80px; /* فوق حقل الرد */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    z-index: 10;
}

/* زر الحذف بجانب اسم المستخدم في الأعلى يساراً */
#story-user-info {
    justify-content: flex-start !important; /* ليكون الاسم والحذف متجاورين */
    gap: 15px;
}

.story-interactions {
    position: absolute;
    bottom: 15px; /* رفعناه قليلاً ليكون بمحاذاة حقل الرد */
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 1010;
    pointer-events: all; /* التأكد من أن الأزرار قابلة للضغط */
}
/* لمنع تداخل حقل الرد مع الأيقونات */
.story-reply-area {
    margin-left: 10px;
    width: 80%; /* ترك مساحة للقلب على اليسار */
}

/* 3. إصلاح تموضع أيقونة الزائد (+) لتظهر دائماً */
.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.add-story-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #0095f6; /* لون أزرق */
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    border: 2px solid white;
    cursor: pointer;
    z-index: 10;
}

/* 4. تمييز أفتار المستخدم الحالي إذا كان لديه ستوري */
.active-story .story-avatar {
    border: 2px solid #e91e63;
    padding: 2px;
}


/* تنسيق الحاوية العلوية داخل قسم الستوري */
.mobile-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: transparent; /* لكي يندمج مع خلفية الستوري */
}

/* حاوية الأيقونات في اليمين */
.top-actions {
    display: flex;
    gap: 20px; /* مسافة بين القلب والرسائل */
    align-items: center;
}

/* تنسيق الأيقونات الفردية */
.action-icon {
    text-decoration: none;
    color: #262626; /* أو white إذا كنت تستخدم الوضع المظلم */
    transition: transform 0.2s ease;
}

.action-icon i {
    font-size: 24px; /* تكبير الحجم */
}

/* تأثير عند الضغط */
.action-icon:active {
    transform: scale(0.9);
    opacity: 0.8;
}

/* لمسة جمالية لأيقونة الرسائل */
.messenger-icon i {
    /* لون متدرج خفيف أو لون مميز إذا أردت */
    color: #0095f6; 
}

/* لضمان اختفاء هذا الترتيب في الشاشات الكبيرة إذا كنت لا تريده */
@media (min-width: 769px) {
    .mobile-header-top {
        display: none;
    }
}

/* الحاوية الرئيسية للهيدر العلوي */
/* الحاوية العلوية */
.mobile-top-bar {
    display: flex;
    width: 100%;
    padding: 15px 15px 15px 15px; /* مسافة من الحواف */
    background: transparent;
    box-sizing: border-box; /* لضمان عدم خروج العناصر عن الشاشة */
}

/* دفع مجموعة الأيقونات لليمين تماماً */
.top-actions {
    display: flex;
    gap: 20px; /* المسافة بين القلب والرسائل */
    margin-left: auto; /* 💡 هذا السطر هو السر، يدفع العناصر لليمين */
    align-items: center;
}

/* تنسيق الأيقونات */
.action-icon i {
    font-size: 24px;
    color: #262626; /* لون إنستغرام المعتاد */
    display: block;
}

/* لون أيقونة المسنجر (اختياري) */
.messenger-icon i {
    color: #0095f6; 
}

/* الشاشات الكبيرة */
@media (min-width: 769px) {
    .mobile-top-bar {
        display: none;
    }
}
.notification-badge-red {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #ff3b30; /* لون أحمر صارخ مثل إنستجرام */
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    border: 2px solid white; /* ليفصل الشارة عن الخلفية */
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
/* تنسيق الشارة الحمراء للهواتف */
.notification-badge-mobile {
    position: absolute;
    top: -5px;      /* لرفع الدائرة للأعلى قليلاً */
    right: -5px;    /* لتحريك الدائرة لليمين قليلاً */
    background-color: #ff3b30; /* اللون الأحمر الرسمي للإشعارات */
    color: white;
    font-size: 10px; /* حجم الخط صغير ليناسب الهاتف */
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%; /* لجعلها دائرية */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: 2px solid white; /* إطار أبيض ليفصلها عن أيقونة القلب */
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    line-height: 1;
}

/* لضمان أن الأيقونة الأب لا تخرج عن الحدود */


@keyframes slideIn {

    from { transform: translateY(20px); opacity: 0; }

    to { transform: translateY(0); opacity: 1; }

}



/* رأس النافذة */

.modal-header {

    padding: 15px 20px;

    border-bottom: 1px solid #eee;

    display: flex;

    justify-content: space-between;

    align-items: center;

}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}
.close-modal {

    font-size: 24px;

    cursor: pointer;

    color: #888;

    transition: 0.3s;
}



.close-modal:hover {

    color: #ff4d4d;

}



/* قائمة الأصدقاء داخل النافذة */

#friendsListContainer {

    max-height: 400px;

    overflow-y: auto;

    padding: 10px;

}



.friend-item {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 12px 15px;

    border-radius: 10px;

    transition: background 0.2s;

}



.friend-item:hover {

    background-color: #f9f9f9;

}



.friend-info {

    display: flex;

    align-items: center;

    gap: 12px;

}



.friend-info img {

    width: 40px;

    height: 40px;

    border-radius: 50%;

    object-fit: cover;

}



.friend-name {

    font-weight: 600;

    color: #262626;

}



/* زر الإرسال */

.btn-send-share {

    background-color: #4e54c8;

    color: white;

    border: none;

    padding: 8px 16px;

    border-radius: 8px;

    cursor: pointer;

    font-weight: 500;

    transition: background 0.3s;

}



.btn-send-share:hover {

    background-color: #3d4199;

}



.btn-send-share.sent {

    background-color: #28a745; /* أخضر عند النجاح */

}



/* تصميم شريط البحث عن صديق (اختياري لكنه احترافي) */

.share-search {

    padding: 10px 15px;

}



.share-search input {

    width: 100%;

    padding: 10px;

    border: 1px solid #ddd;

    border-radius: 8px;

    background-color: #efefef;

}

.external-options {

    display: flex;

    gap: 10px;

    justify-content: center;

    padding-bottom: 10px;

}
.share-option-btn {
    background: #f0f2f5;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.share-option-btn:hover {

    background: #e4e6eb;

}
.friend-info img {

    width: 45px; /* حجم صورة البروفايل */
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
   border: 1px solid #ddd;

} 
.story-nav-star {
    position: absolute;
    right: 15px; /* مسافة من الحافة اليمنى */
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px; /* حجم النجمة الصغيرة */
    color: rgba(255, 255, 255, 0.5); /* شفافة قليلاً */
    cursor: pointer;
    z-index: 2000;
    transition: all 0.3s ease;
    padding: 10px;
}

.story-nav-star:hover {
    color: #1c99a4; /* تتحول للذهبي عند الحوم فوقها */
    text-shadow: 0 0 10px #1c8881;
    transform: translateY(-50%) scale(1.3);
}

/* إخفاء النجمة في الهواتف لأن المستخدم سيستخدم Swipe */
@media (max-width: 768px) {
    .story-nav-star {
        display: none;
    }
}
/* 7. تسيود وتبييض السايدبار (الأيمن والأيسر) والقصص والويدجت */
body.dark-mode .sidebar-left,
body.dark-mode .sidebar-right,
body.dark-mode .stories-section,
body.dark-mode .widget,
body.dark-mode .modal-content,
body.dark-mode .post-options-menu {
    background-color: #1e1e1e !important;
    background: #1e1e1e !important;
    color: #ffffff !important;
    border-color: #333 !important;
}

/* 8. تبييض روابط القوائم الجانبية وأسمائها */
body.dark-mode .sidebar-username,
body.dark-mode .sidebar-menu a {
    color: #ffffff !important;
}

body.dark-mode .sidebar-profile {
    border-bottom-color: #333 !important;
}

/* 9. الحل النهائي للفوتر (Mobile Footer) - إجباره على السواد */
body.dark-mode footer,
body.dark-mode .mobile-footer,
body.dark-mode .footer-mobile,
body.dark-mode .bottom-nav {
    background-color: #1e1e1e !important;
    background: #1e1e1e !important;
    border-top: 1px solid #333 !important;
}

/* تبييض أيقونات ونصوص الفوتر */
body.dark-mode footer i,
body.dark-mode .mobile-footer i,
body.dark-mode .bottom-nav i,
body.dark-mode .mobile-footer span {
    color: #ffffff !important;
}

/* 10. تبييض التعليقات ومنطقة الكتابة */
body.dark-mode .comment {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

body.dark-mode .add-comment textarea {
    background: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

/* 11. إخفاء البياض المزعج في المودل */
body.dark-mode .modal-header {
    border-bottom-color: #333 !important;
}