/* ==========================================================================
   1. الإعدادات العامة والمتغيرات (Variables & Base)
   ========================================================================== */
   :root {
    --main-color: #FF5C00;
    --main-dark: #242424;
}

body, h1, h2, h3, h4, h5, h6, p, a, span, div, li {
    font-family: 'Cairo', sans-serif;
} 

a {
    text-decoration: none;
    color: var(--main-dark);
}

li.li-no-dot {
    list-style: none;
}

/* ==========================================================================
   2. الخطوط والألوان (Typography & Colors)
   ========================================================================== */
.font-sm { font-size: 12px; }
.font-md { font-size: 14px; }
.font-lg { font-size: 16px; }
.font-xl { font-size: 18px; }

.icon-primary { color: var(--main-color); }
.text-main { color: var(--main-color) !important; }
.text-warning { color: var(--main-color) !important; }
.bg-main { background-color: var(--main-color) !important; }

/* ==========================================================================
   3. مكونات Bootstrap المعدلة والأزرار (Buttons & Overrides)
   ========================================================================== */
.btn-main {
    background-color: var(--main-color);
    color: #fff;
    border: none;
}

.btn-main:hover {
    background-color: var(--main-dark);
    color: #fff;
}

.btn-warning, .bg-warning {
    background-color: var(--main-color) !important;
    border-color: var(--main-color) !important;
}

.btn-warning {
    transition: transform 0.2s ease;
}

.btn-warning:hover {
    transform: translateY(-2px);
    background-color: #eab000 !important;
}

.border-warning {
    border-color: var(--main-color) !important;
}

.btn-danger {
    background-color: red !important;
}

.btn-white {
    background-color: white;
    border: none;
}

.btn-light {
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* زر إضافة إعلان القديم */
.add-btn {
    background-color: var(--main-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    margin: 0 50px;
    transition: background 0.2s;
}

.add-btn:hover {
    background-color: var(--main-dark);
    color: #fff;
}

/* ==========================================================================
   4. الهيدر والبحث (Navbar & Search)
   ========================================================================== */
.navbar .container {
    justify-content: flex-start;
}

.dropdown-toggle::after {
    display: none;
}

.search-box {
    max-width: 600px;
    border-radius: 25px;
}

.search-wrapper {
    max-width: 500px; 
    width: 100%; 
    margin: 0 auto; 
}

.search-wrapper .btn {
    border-radius: 30px;
    padding: 10px 15px;
    background-color: var(--main-color);
    border-color: var(--main-color);
}

.search-input {
    background-color: #f1f3f5;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.search-input:focus {
    background-color: #fff;
    border-color: var(--main-color);
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.15);
}

/* القوائم المنسدلة */
.dropdown-menu {
    border-radius: 12px;
    padding: 8px;
    margin-top: 10px !important;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background-color: #fffbeb; 
    color: #856404;
}

.dropdown-item.active {
    background-color: #ffc107 !important;
    color: #000;
}

/* ==========================================================================
   5. الكاردات والأنيميشن (Cards, Slider & Animations)
   ========================================================================== */
.featured-card {
    border-color: var(--main-color) !important;
}

.category-card {
    border: 1px solid #eee !important;
}

.category-card:hover {
    border-color: var(--main-color) !important;
    background-color: #f8f9fa !important;
}

.item-card {
    transition: all 0.3s ease;
}

.item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.transition-hover {
    transition: transform 0.2s ease-in-out;
}

.transition-hover:hover {
    transform: translateY(-5px);
}

.image-buttons {
    position: absolute;
    top: 10px;      
    right: 10px;    
    z-index: 10;
}

/* تفاصيل الإعلان الجداول */
.ad-details .item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    border-radius: 6px;
}

.ad-details .item:nth-child(odd) { background: #d6d6d6; }
.ad-details .item:nth-child(even) { background: #ffffff; }

/* ==========================================================================
   6. صفحة إضافة إعلان المرفوعات (Create Ad Form)
   ========================================================================== */
.btn-check:checked + .btn-outline-primary {
    background-color: #e6e6e6;
    color: white;
    border-color: #0d6efd;
    transform: scale(1.05);
}

.btn-outline-warning, .btn-outline-secondary {
    transition: all 0.2s ease;
    border: 2px solid #eee;
}

.step-window {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-wrapper {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.preview-wrapper:hover {
    transform: scale(1.02);
}

.btn-remove-img {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    transition: background 0.2s;
}

.btn-remove-img:hover { background: #cc0000; }

@keyframes fadeOutScale {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

.animate__fadeOutScale {
    animation: fadeOutScale 0.3s forwards;
}

/* ==========================================================================
   7. الإشعارات والفوتر (Notifications & Footer)
   ========================================================================== */
.icon-btn {
    color: var(--main-color);
    font-size: 20px;
    text-decoration: none;
    position: relative;
}

.icon-btn:hover { color: var(--primary-color); }

.badge-notify {
    position: absolute;
    top: -5px;
    right: -8px;
    background: red;
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 50%;
}

.notification-item {
    padding:10px 15px;
    cursor:pointer;
    border-bottom:1px solid #eee;
}

.notification-item:hover { background:#f8f9fa; }
.notification-unread { background:#fff7e6; border-right:4px solid #ff9800; }
.notification-title { font-weight:600; font-size:14px; }
.notification-text { font-size:13px; color:#777; }

.notification-modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.notification-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.notification-modal .close-btn {
    position: absolute;
    top: 10px; left: 15px;
    font-size: 28px; font-weight: bold;
    border: none; background: transparent;
    cursor: pointer; z-index: 10;
}

.notification-modal .close-btn:hover { color: red; }

.footer-links a {
    color: #adb5bd;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: #ffc107 !important; 
    padding-inline-start: 5px;
}

.social-icon {
    color: #fff;
    background: #343a40;
    width: 35px; height: 35px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: 0.3s;
}

.social-icon:hover {
    background: #ffc107;
    color: #212529 !important;
    transform: translateY(-3px);
}

.filter-white {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* ==========================================================================
   8. نظام المحادثات والرسائل (Chat System)
   ========================================================================== */
.chat-wrapper {
    height: 85vh;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fff;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
}

.conversation-list {
    background-color: #f8f9fa;
    height: 75vh;
}

.conversation-item {
    border: none !important;
    border-bottom: 1px solid #f1f1f1 !important;
    padding: 15px 20px;
    transition: all 0.3s ease;
    border-left: 4px solid transparent !important;
}

.conversation-item:hover {
    background-color: #ffffff;
    transform: translateX(-2px);
}

.conversation-item.active {
    background-color: #fff3cd !important;
    border-right: 4px solid #ffc107 !important;
    color: #000 !important;
}

.avatar-circle {
    width: 45px; height: 45px;
    background-color: #e9ecef;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: #6c757d;
    flex-shrink: 0;
}

.avatar-circle img {
    border: 2px solid #fff;
}

#messagesBox {
    flex: 1;
    overflow-y: auto;
    background: #fafafa;
}

.message-content { word-break: break-word; }
.chat-bubble { border-radius: 12px; }

.chat-bubble.me {
    background: #ffc107;
    color: white;
}

.chat-bubble.other {
    background: white;
    border: 1px solid #eee;
}

.unread-badge {
    font-size: 0.7rem;
    padding: 5px 8px;
    border-radius: 20px;
}

.empty-chat-state {
    background: #fff;
    height: 75vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}

.empty-chat-state i {
    font-size: 4rem; color: #dee2e6; margin-bottom: 20px;
}

.chat-menu-btn {
    border: none; background: transparent;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 18px; color: #555;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s ease;
}

.chat-menu-btn:hover { background: #f2f2f2; color: #000; }
.chat-menu { min-width: 190px; border-radius: 12px; border: none; }
.chat-menu .dropdown-item { padding: 10px 15px; font-size: 14px; transition: background .2s; }
.chat-menu .dropdown-item:hover { background: #f8f9fa; }
.chat-actions .dropdown-menu { min-width: 200px; }
.chat-actions button { display: flex; align-items: center; gap: 8px; }

.send-btn {
    background: #ff9800;
    border: none;
    transition: .2s;
}
.send-btn:hover { background: #e68900; }

/* مخصص للسكرول بار */
.custom-scroll { overflow-y: auto; }
.custom-scroll::-webkit-scrollbar { width: 5px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }
#messagesBox::-webkit-scrollbar-thumb { background: #e78b00d8; }

.icons, .icon-group {
    display: flex; align-items: center; gap: 10px; white-space: nowrap;
}

/* ==========================================================================
   9. شاشات التجاوب والـ Breakpoints (Responsive Queries)
   ========================================================================== */

/* شاشات الموبايل الصغيرة جداً */
@media (max-width: 575.98px) {
    .custom-carousel-img {
        height: 240px !important; 
    }
}

/* شاشات التابلت والموبايل المرتفع */
@media (max-width: 768px) {
    .conversation-list {
        position: fixed;
        top: 0; left: -100%;
        width: 80%; height: 100%;
        z-index: 1000;
        background: white;
        transition: .3s;
    }
    .conversation-list.show { left: 0; }
    .chat-wrapper { height: 92vh; }
}

/* شاشات الموبايل المتوسطة والكبيرة (تم تصحيح الـ px هنا) */
@media (max-width: 991.98px) {
    .translate-middle-x { transform: translateX(-50%); }
}

/* شاشات الكمبيوتر الكبيرة */
@media (min-width: 992px) {
    .position-lg-relative { position: relative !important; }
    .start-lg-0 { start: 0 !important; }
    .translate-middle-x-none { transform: none !important; }
}

/* تنسيق صور السلايدر الرئيسي بشكل متجاوب */
.main-banner-img {
  width: 100% !important;
  object-fit: cover !important; /* لملء المساحة وقص الأطراف الزائدة بشكل منسق دون تمطيط */
  object-position: center !important; /* تركيز الصورة في المنتصف */
}

/* 1. في شاشات الموبايل (الهواتف الصغيرة): ارتفاع ملموم لا يستهلك مساحة الشاشة الطولية */
@media (max-width: 575.98px) {
  .main-banner-img {
      height: 180px !important; 
  }
  .custom-carousel-img {
    width: 100% !important;
    height: 180px !important; 
    object-fit: cover !important;
}
}

/* 2. في شاشات التابلت والموبايلات الكبيرة (الشاشات المتوسطة) */
@media (min-width: 576px) and (max-width: 991.98px) {
  .main-banner-img {
      height: 260px !important;
  }
  .custom-carousel-img {
    width: 100% !important;
    height: 250px !important; 
    object-fit: cover !important;
}
}

/* 3. في شاشات الكمبيوتر واللاب توب (الشاشات الكبيرة والمثالية للموقع) */
@media (min-width: 992px) {
  .main-banner-img {
      height: 500px !important; /* ارتفاع ممتاز ليعرض البنرات الترويجية بوضوح */
  }
  .custom-carousel-img {
    width: 100% !important;
    height: 350px !important; 
    object-fit: cover !important;
}
}