/* assets/css/style.css */

:root {
    --haraj-blue: #0066cc;
    --haraj-bg: #f6f6f6;
}
html, body {
    max-width: 100%;
    overflow-x: hidden; 
    position: relative;
    -webkit-overflow-scrolling: touch; 
}
body {
    font-family: 'Cairo', sans-serif;
    background: var(--haraj-bg);
    margin: 0;
}

/* ==========================================
   TOP BAR & NAVIGATION (الهيدر العلوي)
   ========================================== */
.top-bar {
    background: var(--haraj-blue);
    color: #fff;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar a {
    color: #fff;
    text-decoration: none;
}

.top-icons {
    display: flex !important; 
    align-items: center;
    gap: 15px; 
}

.top-icons .icon-link {
    font-size: 18px; 
    padding: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    gap: 6px;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    position: relative;
}

.top-icons .icon-link:active {
    transform: scale(0.9); 
}

.icon-label {
    font-size: 13px;
    font-family: 'Cairo', sans-serif;
}

/* LOGO */
.logo-text {
    font-size: 24px; 
    font-weight: 900;
    color: #fff !important;
    text-decoration: none;
}

/* SEARCH WRAPPER */
.search-wrapper {
    background: #fff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 5px;
    border: 1px solid #ddd;
}

.search-wrapper input {
    border: none;
    background: transparent;
    padding: 5px;
    width: 100%;
    outline: none;
    font-size: 14px;
    color: #333;
}

/* BUTTON ADD AD */
.btn-add-ad {
    background: #ffbc34;
    color: #000 !important;
    font-weight: 700;
    border-radius: 10px;
    padding: 8px 16px;
    text-decoration: none;
    font-size: 14px;
}

.user-avatar-header {
    width: 38px; 
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.badge-notify {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    border: 1px solid #fff;
}

/* ==========================================
   BOTTOM APPLICATION NAVIGATION (شريط الجوال السفلي)
   ========================================== */
.bottom-nav { 
    background: white; 
    height: 60px; 
    display: flex; 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08); 
    z-index: 1000; 
    border-top: 1px solid #eee; 
}

.nav-item { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    color: #757575; 
    text-decoration: none; 
    font-size: 11px; 
    font-weight: 600; 
    position: relative; 
}

.nav-item i { font-size: 28px; margin-bottom: 4px; }
.nav-item.active { color: var(--haraj-blue); }

.nav-center-add {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.fab-add-center { 
    width: 52px; 
    height: 52px; 
    background: #ffbc34; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: black !important; 
    font-size: 22px; 
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2); 
    text-decoration: none; 
    position: absolute;
    top: -18px; 
    border: 4px solid white;
    transition: transform 0.2s;
}

.fab-add-center:active {
    transform: scale(0.9);
}

/* ==========================================
   SIDEBAR & OFFCANVAS (القائمة الجانبية والعمود الجانبي)
   ========================================== */
.sidebar-user-header {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.offcanvas-body .nav-link {
    color: #333;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    transition: 0.2s;
}

.offcanvas-body .nav-link:hover {
    background-color: #f1f3f5;
    color: #0d6efd;
}

.offcanvas-body .nav-link i {
    font-size: 18px;
    width: 25px;
    text-align: center;
}

.sidebar-wrapper {
    position: sticky;
    top: 80px; 
}

.sidebar-card-box {
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.sidebar-card-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 12px;
    color: #333;
    border-right: 3px solid var(--haraj-blue);
    padding-right: 8px;
}

/* ==========================================
   CATEGORIES ROW (شريط الأقسام)
   ========================================== */
.sub-cats-area {
    background: #fff;
    border-bottom: 1px solid #eee;
    width: 100%;
    position: relative;
}

.cats-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 5px;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    cursor: grab; 
    user-select: none; 
    -webkit-user-select: none;
}

.cats-row:active { cursor: grabbing; }
.cats-row::-webkit-scrollbar { display: none; }

.cat-item {
    background: #f0f2f5;
    color: #555;
    padding: 8px 20px;
    border-radius: 25px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: 0.2s;
    text-decoration: none;
    display: inline-block;
}

.cat-item:hover {
    background: #e9eef5;
    color: #555;
    text-decoration: none;
}

.cat-item.active {
    background: var(--haraj-blue);
    color: #fff;
    border-color: var(--haraj-blue);
    text-decoration: none;
}

.btn-follow-cat {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.cat-item-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
}

.cat-follow-inline-btn {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-top: 4px;
    cursor: pointer;
    border: 1px solid #0d6efd;
    background: transparent;
    color: #0d6efd;
}

.cat-follow-inline-btn.is-following {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

/* ==========================================
   ADS LIST & CARDS (قائمة العروض والبطاقات)
   ========================================== */
.ad-list-container { 
    background: white; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
}

.ad-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    padding: 3px;
    border-bottom: 1px solid #f1f1f1;
}
.ad-row:hover { background: #f9f9f9; }

.ad-img-box {
    width: 80px;
    height: 80px;
    min-width: 80px;
    max-width: 80px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.ad-img-box img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-img-box { background-color: #eaeaea; }
.placeholder-img-box i { font-size: 24px; color: #a0a0a0; }
.ad-currency-style { font-size: 11px; font-weight: normal; opacity: 0.85; }
.ad-info-box { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0 !important;}

.ad-item-title { 
    font-size: 14px; 
    font-weight: 600; 
    color: #244668; 
    margin-bottom: 10px; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    white-space: nowrap;  
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-item-meta { 
    display: flex; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 8px; 
    font-size: 11px; 
    color: #888; 
}
.ad-item-meta i { font-size: 11px; }

.ad-meta-link {
    color: #666;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}
.ad-meta-link:hover { color: #0066cc; text-decoration: underline; }

.ad-item-price { 
    font-size: 14px; 
    font-weight: 800; 
    color: #2ecc71; 
    text-align: left; 
    margin-top: 3px; 
}

/* ==========================================
   AD DETAILS PAGE (تفاصيل الإعلان وعناصر التفاعل)
   ========================================== */
.main-wrapper { margin-top: 15px; padding-bottom: 90px; }
.content-card { background: white; border-radius: 12px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 15px; }
.ad-title-detail { font-size: 20px; font-weight: 800; color: #333; margin-bottom: 15px; line-height: 1.4; }

/* زر الرجوع والتسميات */
.detail-back-container {
    display: flex;
    justify-content: flex-start;
}
.btn-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #555;
    background: #f1f3f5;
    padding: 5px 14px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}
.btn-detail-back:hover {
    background: #e2e6ea;
    color: var(--haraj-blue);
}

.btn-follow-ad {
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 15px;
    transition: all 0.3s ease;
}

.user-rating-mini {
    background: #fffde7;
    border: 1px solid #fff59d;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    color: #f57f17;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-decoration: none;
}
.user-rating-mini:hover {
    background: #fff9c4;
}

@keyframes highlightComment {
    0% { background-color: #fff9c4; }
    100% { background-color: transparent; }
}
.comment-target-active {
    animation: highlightComment 4s ease-in-out forwards !important;
    border-right: 4px solid #fbc02d !important;
    padding-right: 8px !important;
}

/* خيارات التحكم للمالك المعلن */
.owner-actions-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
}
.btn-owner-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    margin-bottom: 8px;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-owner-edit { background-color: #fff3e0; color: #ef6c00; }
.btn-owner-edit:hover { background-color: #ffe0b2; }
.btn-owner-refresh { background-color: #e8f5e9; color: #2e7d32; }
.btn-owner-refresh:hover { background-color: #c8e6c9; }
.btn-owner-delete { background-color: #ffebee; color: #c62828; }
.btn-owner-delete:hover { background-color: #ffcdd2; }

.btn-sidebar-fav {
    background: white;
    color: #e91e63 !important;
    border: 2px solid #e91e63;
    border-radius: 10px;
    padding: 9px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 100%;
    font-size: 15px;
    transition: all 0.2s ease;
}
.btn-sidebar-fav.active {
    background: #e91e63;
    color: white !important;
}

/* USER DATA */
.user-row { display: flex; align-items: center; gap: 10px; }
.user-img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 1px solid #eee; }
.user-name { font-weight: 700; font-size: 15px; flex-grow: 1; }
.btn-follow { color: var(--haraj-blue); font-weight: 700; text-decoration: none; font-size: 13px; border: 1px solid var(--haraj-blue); padding: 3px 12px; border-radius: 20px; }
.meta-row { margin-right: 55px; font-size: 12px; color: #757575; margin-top: -5px; margin-bottom: 15px; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 8px; }
.section-header .fs-5 { font-size: 16px !important; }
.price-text { color: #2E7D32; font-weight: 800; font-size: 20px; }
.ad-desc { font-size: 15px; color: #444; line-height: 1.7; margin-top: 15px; white-space: pre-wrap; }
.image-stack img { width: 100%; border-radius: 10px; margin-bottom: 10px; border: 1px solid #f0f0f0; }

/* SIDEBAR CARD DETAIL */
.sidebar-card { background: white; border-radius: 12px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: sticky; top: 150px; }
.sidebar-title { font-weight: 800; font-size: 15px; margin-bottom: 15px; display: block; border-right: 4px solid var(--haraj-blue); padding-right: 8px; }
.btn-call { background: var(--haraj-blue); color: white !important; border-radius: 10px; padding: 10px; font-weight: 700; text-align: center; text-decoration: none; display: block; margin-bottom: 10px; width: 100%; font-size: 15px; }
.btn-wa { background: white; color: #25D366 !important; border: 2px solid #25D366; border-radius: 10px; padding: 9px; font-weight: 700; text-align: center; text-decoration: none; display: block; width: 100%; font-size: 15px; }

/* المصغرات للإعلانات المشابهة */
.related-ad-thumb {
    width: 65px;
    height: 65px;
    min-width: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eaeded;
}
.related-ad-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* COMMENTS */
.comment-container { margin-bottom: 15px; }
.comment-box { border-bottom: 1px solid #f5f5f5; padding: 12px 0; display: flex; gap: 10px; }
.comment-avatar { width: 35px; height: 35px; border-radius: 50%; background: #eee; object-fit: cover; }
.reply-box { margin-right: 45px; border-right: 2px solid #ddd; padding-right: 15px; background: #fafafa; border-radius: 0 8px 8px 0; }
.btn-reply-link { background: none; border: none; color: #757575; font-size: 12px; font-weight: bold; padding: 0; margin-top: 5px; cursor: pointer; }
.btn-reply-link:hover { color: var(--haraj-blue); text-decoration: underline; }

/* MISC PAGES & LAYOUTS */
.main-content-layout { margin: 10px auto; }
#loader { padding: 40px; }
.user-profile-header { background: white; border-radius: 12px; border: 1px solid #eee; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.profile-avatar { width: 65px; height: 65px; display: flex; align-items: center; justify-content: center; }

/* DROPDOWN MENU */
.custom-dropdown-menu {
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border: 1px solid #e1e8ed !important;
    padding: 8px 0 !important;
    min-width: 180px !important;
}

.custom-dropdown-menu .dropdown-item {
    font-size: 15px !important;       
    font-weight: 700 !important;      
    color: #333333 !important;        
    padding: 10px 16px !important;    
    text-align: right !important;
    display: flex !important;
    align-items: center;
    gap: 10px;                                                                                                                                                                                                                                                                                                      
    transition: background 0.2s, color 0.2s;
}

.custom-dropdown-menu .dropdown-item:hover { background-color: #f0f7ff !important; color: var(--haraj-blue) !important; }
.custom-dropdown-menu .dropdown-item.text-danger-custom { color: #e74c3c !important; }
.custom-dropdown-menu .dropdown-item.text-danger-custom:hover { background-color: #fdf2f2 !important; color: #c0392b !important; }

/* ==========================================
   MEDIA QUERIES (التجاوب الذكي والشاشات)
   ========================================== */

/* 1. الشاشات الصغيرة جداً والدعم العام */
@media (max-width: 576px) {
    .container { padding-left: 6px; padding-right: 6px; }
}

/* 2. الشاشات المتوسطة والكبيرة (الكمبيوتر) */
@media (min-width: 576px) {
    .logo-text { font-size: 30px; }
    .btn-add-ad { padding: 10px 25px; font-size: 16px; }
    .ad-list-container { border-radius: 12px; }
    .ad-img-box { width: 110px; height: 110px; min-width: 110px; border-radius: 12px; }
    .ad-item-title { font-size: 16px; }
    .ad-item-meta { gap: 15px; font-size: 13px; }
    .ad-item-meta i { font-size: 12px; }
    .ad-item-price { font-size: 16px; margin-top: 0; }
}

@media (min-width: 768px) {
    .content-card, .sidebar-card { padding: 25px; }
    .ad-title-detail { font-size: 24px; }
    .price-text { font-size: 24px; }
    .section-header .fs-5 { font-size: 1.25rem !important; }
    .user-img { width: 55px; height: 55px; }
    .meta-row { margin-right: 67px; font-size: 13px; }
}

@media (min-width: 992px) {
    .main-content-layout { margin: 25px auto; }
    .search-wrapper { max-width: 450px; }
    .bottom-nav { display: none !important; } /* إخفاء فوتر الجوال في الكمبيوتر */
}
/* ==========================================
   MEDIA QUERIES (التجاوب الذكي والشاشات)
   ========================================== */

/* للشاشات الكبيرة (الكمبيوتر واللاب توب) */
@media (min-width: 992px) {
    .search-wrapper { max-width: 450px; }
    
    /* إخفاء شريط الجوال السفلي نهائياً في الكمبيوتر */
    .bottom-nav-mobile { 
        display: none !important; 
    } 
    
    /* إلغاء الهامش السفلي الاحتياطي في الكمبيوتر */
    .main-wrapper {
        margin-bottom: 15px; 
    }
}

/* لشاشات الجوال والتابلت (الأجهزة المحمولة) */
@media (max-width: 991px) {
    .top-icons, .header-add-btn {
        display: none !important;
    }
    
    .top-bar .container {
        flex-wrap: nowrap !important;
    }
    
    .search-wrapper {
        max-width: 60%;
    }
    
    .sidebar-col { 
        width: 100% !important;
    }
    
    /* تنسيق ذكي ومظهر أنيق لأزرار الجوال السفلي */
    .bottom-nav-mobile {
        display: flex !important;
        direction: rtl;
        background: #ffffff;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.08) !important;
        padding: 10px 8px !important;
    }
    
    .bottom-nav-mobile .btn {
        white-space: nowrap; 
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .main-wrapper {
        margin-bottom: 80px; /* مسافة أمان لكي لا يغطي شريط الأزرار محتوى الصفحة السفلي */
    }
}

    .main-content-layout {
        padding-bottom: 85px !important; 
    }
}

.bottom-nav-mobile {
    display: flex !important;
    direction: rtl;
}
.bottom-nav-mobile .btn {
    white-space: nowrap; /* لمنع انقسام النص إلى سطرين */
    overflow: hidden;
    text-truncate: true;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 6px 4px !important; /* تقليل الحواف الداخلية لكي تتسع الشاشة لجميع الأزرار */
}