/*
 * MUNTAJ - CSS إضافي للإصلاحات والميزات الجديدة
 * هذا الملف يُضاف بعد style.css في الـ header
 * لا يغير أي ستايل موجود - فقط يضيف إصلاحات وعناصر جديدة
 * آخر تحديث: 2026-06-06 - التعديل 1: الصفحة الرئيسية
 */

/* ===== 1. إصلاح تكرار البانر في الصفحة الرئيسية ===== */
.hero {
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll !important;
}

/* ===== 1-A. تحسين Hero Section ===== */
.hero .hero-content {
    padding-top: 10px;
    padding-bottom: 10px;
}

.hero .search-box {
    margin-top: 8px;
}

.hero .register-link {
    font-size: 16px;
    padding: 8px 20px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.hero .register-link:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.7);
    color: #fff;
}

/* ===== 1-B. إصلاح توسيط عناوين كروت الفئات ===== */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.category-card h3,
.category-card span {
    text-align: center !important;
    width: 100%;
    display: block;
}

/* ===== 1-C. إصلاح الزر العائم (عرض الكل) ===== */
.section-header .view-all {
    flex-shrink: 0;
    padding: 8px 18px;
    border: 1px solid rgba(158, 66, 0, 0.25);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.section-header .view-all:hover {
    background: rgba(158, 66, 0, 0.08);
    border-color: rgba(158, 66, 0, 0.5);
}

@media (max-width: 992px) {
    .section-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
    }
    .section-header .section-text {
        flex: 1;
        min-width: 0;
    }
    .section-header .view-all {
        margin-inline-start: auto;
        order: 0;
    }
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
    }
    .section-header .section-text {
        flex: 1;
        min-width: 0;
    }
    /* عرض الكل دائماً على اليسار في الموبايل */
    .section-header .view-all {
        margin-inline-start: auto;
        order: 0;
    }
    html[dir="rtl"] .section-header .view-all {
        margin-left: auto;
        margin-right: 0;
    }
}

/* ===== 1-D. تحسين قسم النشرة الإخبارية ===== */
.newsletter {
    padding: 48px 0 !important;
}

.newsletter-container {
    max-width: 560px !important;
}

.newsletter h2 {
    font-size: 22px;
}

.newsletter p {
    font-size: 15px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .newsletter {
        padding: 36px 0 !important;
    }
    .newsletter-container {
        max-width: 100% !important;
    }
    .newsletter h2 {
        font-size: 20px;
    }
}

/* ===== 1-E. تحسين وضع الموبايل للـ Hero ===== */
@media (max-width: 992px) {
    .search-box {
        flex-wrap: wrap !important;
    }
    .search-input-wrapper {
        flex: 1 1 100% !important;
        order: -1 !important;
        min-width: 0 !important;
    }
    .search-input-wrapper input {
        padding: 14px 16px !important;
        font-size: 16px !important;
    }
    .search-box > .dropdown {
        flex: 1 1 calc(50% - 8px) !important;
        min-width: 0 !important;
    }
    .search-btn {
        flex: 1 1 100% !important;
        height: auto !important;
        padding: 12px !important;
        width: auto !important;
    }
}

@media (max-width: 768px) {
    .hero {
        min-height: auto !important;
        padding: 36px 0 48px !important;
    }
    .hero h1 {
        font-size: 24px !important;
        line-height: 1.35;
    }
    .hero-subtitle {
        font-size: 15px !important;
        line-height: 1.6;
    }
    .search-input-wrapper input {
        padding: 14px !important;
        font-size: 16px !important;
    }
    .dropdown-toggle {
        padding: 10px 8px !important;
        font-size: 12px !important;
    }
    .dropdown-toggle span {
        font-size: 12px !important;
    }
    .search-btn {
        height: auto !important;
        padding: 12px !important;
        font-size: 15px !important;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 20px !important;
    }
    .hero-subtitle {
        font-size: 14px !important;
    }
    .dropdown-toggle {
        padding: 8px 6px !important;
        font-size: 11px !important;
    }
    .dropdown-toggle span {
        font-size: 11px !important;
    }
}

/* ===== 1-F. تحسين Swiper الكروت في الموبايل ===== */
@media (max-width: 768px) {
    .category-card {
        padding: 16px;
    }
    .category-icon {
        width: 64px !important;
        height: 64px !important;
        font-size: 24px !important;
        border-radius: 14px !important;
    }
    .category-card h3 {
        font-size: 15px !important;
    }
    .category-card span {
        font-size: 12px !important;
    }
}

/* ===== 2. إصلاح تكرار أسماء الدروب داون (Bootstrap caret) ===== */
.search-box .dropdown-toggle::after,
.dropdown-toggle[data-dropdown-button]::after {
    display: none !important;
    content: none !important;
}

/* ===== 3. إصلاح قائمة البحث المنسدلة ===== */
[data-dropdown] {
    position: relative;
}

[data-dropdown] .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    min-width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
    margin-top: 4px;
}

[dir="ltr"] [data-dropdown] .dropdown-menu {
    right: auto;
    left: 0;
}

[data-dropdown].active .dropdown-menu {
    display: block;
}

[data-dropdown] .dropdown-menu li {
    list-style: none;
}

[data-dropdown] .dropdown-menu li a {
    display: block;
    padding: 10px 16px;
    color: var(--text-dark, #14213B);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
    cursor: pointer;
}

[data-dropdown] .dropdown-menu li a:hover {
    background: var(--bg-light, #F5F2FB);
    color: var(--primary, #1A237E);
}

/* ===== 3. شارة الخصم على بطاقات المنتجات ===== */
.product-card {
    position: relative;
}

/* ===== 4. قسم العروض الخاصة ===== */
.special-offers-section .section-header h2 {
    position: relative;
    display: inline-block;
}

/* ===== 5. تحسين عرض بطاقة المنتج مع الخصم ===== */
.price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 13px;
}

.price-discounted {
    color: #E53935;
    font-weight: 700;
    font-size: 16px;
}

/* ===== 6. شارة العرض الخاص في بطاقة المنتج ===== */
.special-offer-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #E53935;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    z-index: 5;
}

[dir="ltr"] .special-offer-badge {
    left: auto;
    right: 12px;
}

/* ===== 7. تحسين الـ dropdown في صفحة البحث ===== */
.search-box [data-dropdown] .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--border-color, #C6C5D4);
    border-radius: 8px;
    color: var(--text-main, #454652);
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.2s;
}

.search-box [data-dropdown] .dropdown-toggle:hover {
    background: var(--bg-light, #F5F2FB);
    border-color: var(--primary, #1A237E);
}

.search-box [data-dropdown] .dropdown-menu {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 200px;
}

.search-box [data-dropdown] .dropdown-menu li a {
    color: var(--text-dark, #14213B);
    padding: 10px 16px;
}

/* ===== 8. إصلاح الهيدر في الموبايل ===== */
@media (max-width: 992px) {
    .header-container {
        height: 64px;
    }
    .logo img {
        height: 40px;
    }
    .mobile-menu-btn {
        display: flex !important;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        transition: background 0.2s;
    }
    .mobile-menu-btn:hover {
        background: rgba(26, 35, 126, 0.08);
    }
    /* إخفاء عناصر الهيدر في الموبايل ماعدا زر القائمة */
    .header-actions .lang-toggle,
    .header-actions .btn {
        display: none !important;
    }
    /* عرض أزرار الموبايل داخل القائمة */
    .mobile-nav-actions {
        display: block;
        margin-top: 24px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .header-container {
        height: 56px;
    }
    .logo img {
        height: 32px;
    }
    .main-nav {
        top: 56px;
        height: calc(100vh - 56px);
    }
    .mobile-menu-overlay {
        top: 56px;
    }
}

/* ===== 9. تحسين بطاقات الشركات ===== */
.company-card .card-image {
    position: relative;
    min-height: 180px;
    background: #f5f5f5;
}

.company-card .card-image .no-image-placeholder {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E8EAF6, #C5CAE9);
}

.company-card .card-image .no-image-placeholder i {
    font-size: 48px;
    color: #1A237E;
    opacity: 0.4;
}

/* ===== 10. إصلاح زر الحذف في الداشبورد ===== */
.sidebar-cta form {
    width: 100%;
}

.sidebar-cta .btn-outline[onclick] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--danger, #F44336);
    color: var(--danger, #F44336);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    background: transparent;
}

.sidebar-cta .btn-outline[onclick]:hover {
    background: var(--danger, #F44336);
    color: white;
}

/* ===== 11. تحسين صفحة التواصل في الموبايل ===== */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }
    .contact-hero h1 {
        font-size: 24px;
    }
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
}

/* ===== 12. إصلاح About Us mobile menu ===== */
@media (max-width: 992px) {
    .mission-vision .mv-container {
        flex-direction: column;
    }
    .mv-image {
        width: 100%;
        min-height: 200px;
    }
    .mv-cards {
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .values-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .values-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== 13. تحسين فلاتر الشركات في الموبايل ===== */
@media (max-width: 992px) {
    .content-wrapper {
        flex-direction: column;
    }
    .content-wrapper .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 85%;
        max-width: 360px;
        height: 100vh;
        z-index: 999;
        background: white;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    }
    [dir="rtl"] .content-wrapper .sidebar {
        left: auto;
        right: -100%;
        transition: right 0.3s ease;
    }
    .content-wrapper .sidebar.active {
        left: 0;
    }
    [dir="rtl"] .content-wrapper .sidebar.active {
        left: auto;
        right: 0;
    }
    .mobile-filter-btn {
        display: inline-flex !important;
    }
}

/* ===== 14. تحسين أزرار tabs في الموبايل ===== */
@media (max-width: 768px) {
    .listing-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .listing-tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* ===== 15. تحسين ملف تعريف المستخدم ===== */
@media (max-width: 768px) {
    .my-profile-content {
        flex-direction: column;
    }
    .profile-sidebar {
        width: 100%;
    }
}

/* ===== 16. أيقونة البروفايل في الهيدر ===== */
.profile-icon-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.profile-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary, #1A237E);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    transition: opacity 0.2s ease;
}

.profile-icon-circle i {
    font-size: 16px;
    color: #fff;
}

.profile-icon-link:hover .profile-icon-circle {
    opacity: 0.8;
}

/* Keep profile icon visible on mobile (override the hide rule) */
@media (max-width: 992px) {
    .header-actions a.profile-icon-link {
        display: flex !important;
    }
}

/* ===== 17. Mobile Bottom Navigation (Public Site) ===== */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 992px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: #fff;
        border-top: 1px solid var(--dash-border, #dce3ed);
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
        z-index: 1001;
        justify-content: space-around;
        align-items: center;
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none !important;
        color: var(--text-muted, #858796);
        font-family: 'Cairo', sans-serif;
        font-size: 10px;
        font-weight: 600;
        padding: 4px 0;
        flex: 1;
        max-width: 72px;
        transition: color 0.2s ease;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-bottom-nav__item i {
        font-size: 20px;
        color: var(--text-muted, #858796);
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .mobile-bottom-nav__item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        line-height: 1.2;
    }

    .mobile-bottom-nav__item.active {
        color: var(--primary, #1A237E);
    }
    .mobile-bottom-nav__item.active i {
        color: var(--primary, #1A237E);
        transform: scale(1.1);
    }
    .mobile-bottom-nav__item.active::after {
        content: '';
        position: absolute;
        top: -1px;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        background: var(--orange, #FB6D00);
        border-radius: 0 0 4px 4px;
    }

    .mobile-bottom-nav__item--cta {
        color: var(--orange, #FB6D00);
        margin-top: -12px;
    }
    .mobile-bottom-nav__item--cta .mobile-bottom-nav__cta-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--orange, #FB6D00), #FF8F00);
        color: #fff;
        box-shadow: 0 3px 10px rgba(251,109,0,0.4);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    .mobile-bottom-nav__item--cta .mobile-bottom-nav__cta-icon i {
        font-size: 20px;
        color: #fff;
    }
    .mobile-bottom-nav__item--cta.active::after {
        display: none;
    }

    /* Push page content up so bottom nav doesn't overlap */
    body {
        padding-bottom: 64px;
    }

    /* Adjust scroll-to-top */
    .scroll_btn, .scroll-to-top {
        bottom: 80px !important;
    }
}

/* ===== 18. Mobile Grids: 2 columns instead of 1 ===== */
@media (max-width: 768px) {
    .companies-grid,
    .products-grid,
    .articles-grid,
    .results-grid,
    [class*="companies-grid"],
    [class*="products-grid"],
    [class*="articles-grid"],
    [class*="results-grid"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .companies-grid,
    .products-grid,
    .articles-grid,
    .results-grid,
    [class*="companies-grid"],
    [class*="products-grid"],
    [class*="articles-grid"],
    [class*="results-grid"] {
        gap: 8px;
    }
}

/* ===== 19. Professional Mobile Spacing ===== */
@media (max-width: 768px) {
    .section-padding {
        padding: 28px 0 !important;
    }

    .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .section-header {
        margin-bottom: 14px !important;
    }

    .section-header h2 {
        font-size: 18px !important;
    }
}

@media (max-width: 480px) {
    .section-padding {
        padding: 22px 0 !important;
    }

    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .section-header h2 {
        font-size: 16px !important;
    }
}

/* ===== 19-B. Company/Product Card Mobile Fixes ===== */
@media (max-width: 768px) {
    .company-card,
    .product-card,
    [class*="company-card"],
    [class*="product-card"] {
        max-width: 100% !important;
    }

    .company-card .card-image,
    .product-card .card-image {
        height: 120px !important;
    }

    .company-card .card-body,
    .product-card .card-body {
        padding: 10px !important;
    }

    .company-card h3,
    .product-card h3 {
        font-size: 14px !important;
    }

    .company-card .card-body p,
    .product-card .card-body p {
        font-size: 12px !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
    }
}

/* ===== 20. Category Swiper Mobile ===== */
@media (max-width: 768px) {
    .categories-swiper .swiper-slide {
        width: 100px !important;
    }

    .category-card {
        padding: 12px 8px !important;
    }

    .category-icon {
        width: 56px !important;
        height: 56px !important;
        font-size: 20px !important;
    }

    .category-card h3 {
        font-size: 13px !important;
    }
}

/* ===== 21. Search Type Dropdown ===== */
#searchForm .dropdown-menu a.active-type {
    background: var(--primary, #1A237E);
    color: #fff !important;
}

/* ===== 22-A. Product card image fill fix ===== */
.product-card .card-image,
.company-card .card-image {
    position: relative;
    height: 180px;
    background: #f0f2f5;
    overflow: hidden;
}

.product-card .card-image img,
.company-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== 22. Mobile Search: type+location row1, category+input row2, btn row3 ===== */
@media (max-width: 992px) {
    #searchForm .search-input-wrapper {
        order: 2 !important;
        flex: 1 1 calc(50% - 8px) !important;
    }
    #searchForm .search-input-wrapper input {
        padding: 10px 12px;
        font-size: 14px;
    }
    #searchForm > .dropdown {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
    #searchForm > .dropdown:nth-child(2) { order: 1 !important; }
    #searchForm > .dropdown:nth-child(3) { order: 1 !important; }
    #searchForm > .dropdown:nth-child(4) { order: 2 !important; }
    #searchForm .search-btn {
        order: 3 !important;
        flex: 1 1 100% !important;
        margin-top: 4px;
    }
}
