/* HOTFIX: Disable raw Tailwind imports on production.
    These lines trigger HTTP requests to /base, /components, /utilities (404).
    Proper fix is to compile Tailwind and deploy built CSS. */
/* @import 'tailwindcss/base'; */
/* @import 'tailwindcss/components'; */
/* @import 'tailwindcss/utilities'; */

/* الخطوط العربية */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* متغيرات الألوان حسب PRD */
:root {
    /* Primary */
    --primary: #1A56DB;
    --primary-hover: #1747B8;
    --primary-light: #2B6ADE;

    /* Secondary / accents */
    --success: #059669;
    --warning: #D97706;

    /* Neutrals */
    --bg-main: #FFFFFF;
    --bg-section: #F9FAFB;
    --border: #E5E7EB;

    --text-title: #111827;
    --text-muted: #6B7280;

    /* UI */
    --shadow: rgba(0,0,0,0.04);
    --card-radius: 14px;
    --btn-radius: 8px;

    /* Legacy compatibility */
    --primary-blue: #1A56DB;
    --primary-blue-light: #2B6ADE;
    --primary-blue-dark: #1747B8;
    --metallic-silver: #c0c0c0;
    --metallic-silver-light: #e5e7eb;
    --metallic-silver-dark: #9ca3af;
    --accent-gold: #f59e0b;
    --success-green: #059669;
    --warning-orange: #D97706;
    --error-red: #ef4444;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-accent: #f3f4f6;
}

/* إعدادات عامة */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* العناوين */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--primary-blue-dark);
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

/* الروابط */
a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(30, 64, 175, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-blue-dark), var(--primary-blue));
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(30, 64, 175, 0.4);
    text-decoration: none;
    color: white;
}

.btn-secondary {
    background: var(--metallic-silver-light);
    color: var(--text-primary);
    border: 1px solid var(--metallic-silver);
}

.btn-secondary:hover {
    background: var(--metallic-silver);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-gold), #fbbf24);
    color: white;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #d97706, var(--accent-gold));
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
}

/* البطاقات */
.card {
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--metallic-silver-light);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    color: white;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--metallic-silver-light);
}

/* شارة الاشتراك */
.subscription-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.subscription-badge.premium {
    background: linear-gradient(135deg, var(--accent-gold), #fbbf24);
    color: white;
}

.subscription-badge.paid {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    color: white;
}

.subscription-badge.free {
    background: var(--metallic-silver-light);
    color: var(--text-secondary);
}

/* النماذج */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--metallic-silver-light);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-control:invalid {
    border-color: var(--error-red);
}

/* التنقل */
.navbar {
    background: linear-gradient(135deg, var(--primary-blue-dark), var(--primary-blue));
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0 0.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* الفلاتر */
.filters-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--metallic-silver-light);
}

/* الشبكة */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* أيقونات قسم لماذا دليل المصانع */
.card-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    transition: transform 0.3s ease;
}

.card-icon i {
    font-size: 1.75rem;
}

.card-icon--blue {
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary-blue);
}

.card-icon--green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.card-icon--amber {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-gold);
}

.card-icon--purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.card-icon--orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--warning-orange);
}

.card-icon--slate {
    background: rgba(156, 163, 175, 0.1);
    color: var(--metallic-silver-dark);
}

.card:hover .card-icon {
    transform: scale(1.1);
}

/* Why Section - Full Bleed Constitution-Compliant */
.why-section {
    background: var(--bg-section);
    padding: 0;
}

/* Bootstrap row.g-0 handles layout - no display property */
.why-grid {
    padding-bottom: 18px;
}

/* Cards - Bootstrap col-6 col-md-3 handles width, CSS for styling only */
.why-card {
    background: var(--bg-main);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
    display: flex;
    gap: 12px;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
    transition: transform .14s ease, box-shadow .14s ease;
}

.why-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.why-card:focus-within {
    outline: 3px solid rgba(26,86,219,0.12);
    outline-offset: 3px;
}

.why-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.why-icon svg {
    width: 60%;
    height: 60%;
    fill: currentColor;
    display: block;
}

.why-icon i {
    font-size: 1.5rem;
}

.icon-primary {
    background: linear-gradient(180deg, rgba(26,86,219,0.12), rgba(26,86,219,0.06));
    color: var(--primary);
}

.icon-success {
    background: linear-gradient(180deg, rgba(5,150,105,0.12), rgba(5,150,105,0.06));
    color: var(--success);
}

.icon-warning {
    background: linear-gradient(180deg, rgba(217,119,6,0.12), rgba(217,119,6,0.06));
    color: var(--warning);
}

.icon-neutral {
    background: linear-gradient(180deg, rgba(107,114,128,0.06), rgba(107,114,128,0.03));
    color: var(--text-muted);
}

.why-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.why-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
    color: var(--text-title);
    font-weight: 700;
}

.why-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Desktop: styling adjustments only */
@media (min-width: 1440px) {
    .why-card {
        padding: 18px;
        border-radius: 14px;
    }
}

/* ============================================
   🎨 Visual Fixes - Constitution Compliant
   ============================================ */

/* 1. Product Images & Placeholders - Fixed Height */
.product-placeholder,
.product-placeholder img,
.card-image,
.card-image img,
.factory-placeholder {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 0;
}

.card-image img,
.product-placeholder img {
    display: block;
}

/* 2. Card Text Spacing - Improved Readability */
.card-title {
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 0.98rem;
    line-height: 1.3;
}

.card-text {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* 3. Button Consistency - Unified Height & Padding */
.btn,
.btn-primary,
.btn-outline,
.btn-secondary,
.btn-accent {
    padding: 8px 14px;
    min-height: 36px;
    font-size: 14px;
    line-height: 1.4;
}

/* 4. Card Internal Spacing - Better Visual Rhythm */
.card-body {
    padding: 12px 14px 8px;
}

.card-footer {
    padding: 8px 14px 12px;
    margin-top: auto;
}

/* 5. Unified Shadow - Constitution Standard */
.card,
.why-card,
.stats-card,
.search-card-custom {
    box-shadow: 0 4px 12px rgba(0,0,0,0.04) !important;
}

.card:hover,
.why-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06) !important;
}

/* 6. Icon Wrapper Alignment */
.icon-wrapper,
.why-icon,
.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 7. Section Spacing Rhythm - Consistent Vertical Flow */
.section,
.stats-section,
.why-section {
    padding: 2.5rem 0;
}

@media (min-width: 768px) {
    .section,
    .stats-section,
    .why-section {
        padding: 3.5rem 0;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

/* ============================================
   🎨 PALETTE LOCK (MANDATORY)
   Header / Hero / CTA — color-only overrides
   ============================================ */

/* Header */
.navbar,
nav.navbar,
.navbar.eco {
    background-color: #013B2B !important;
    background-image: none !important;
}

.navbar .navbar-brand,
.navbar .nav-link,
.navbar .navbar-toggler,
.navbar .navbar-toggler-icon,
.navbar i,
.navbar svg {
    color: #FFFFFF !important;
}

.navbar .nav-link:hover,
.navbar .navbar-brand:hover {
    color: #D1FAE5 !important;
    background: transparent !important;
    text-decoration: none !important;
}

/* Hero / Top of page (no green) */
.factories-hero {
    background-color: #FFFFFF !important;
    background-image: none !important;
    color: var(--text-title) !important;
}

.factories-hero h1 {
    color: var(--text-title) !important;
}

.factories-hero p {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

/* CTA (Primary) — Amber muted, no gradients, no heavy shadows */
.btn-primary {
    background-color: #F59E0B !important;
    border-color: #F59E0B !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
    color: #FFFFFF !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
    background-color: #D97706 !important;
    border-color: #D97706 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
}

/* Keep accent buttons consistent with primary CTA */
.btn-accent {
    background-color: #F59E0B !important;
    border-color: #F59E0B !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
    color: #FFFFFF !important;
}

.btn-accent:hover {
    background-color: #D97706 !important;
    border-color: #D97706 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
}

/* Outline primary consistency */
.btn-outline-primary {
    color: #F59E0B !important;
    border-color: #F59E0B !important;
    background: transparent !important;
    box-shadow: none !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #F59E0B !important;
    border-color: #F59E0B !important;
    color: #FFFFFF !important;
    box-shadow: none !important;
    transform: none !important;
    text-decoration: none !important;
}

::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* التبويبات */
.tabs {
    border-bottom: 2px solid var(--metallic-silver-light);
    margin-bottom: 2rem;
}

.tab-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tab-item {
    margin-left: 2rem;
}

.tab-link {
    display: block;
    padding: 1rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-link:hover {
    color: var(--primary-blue);
    text-decoration: none;
}

.tab-link.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

/* الرسائل */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-green);
    color: #065f46;
}

.alert-warning {
    background: rgba(249, 115, 22, 0.1);
    border-color: var(--warning-orange);
    color: #9a3412;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error-red);
    color: #991b1b;
}

/* التحميل */
.loading {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--metallic-silver-light);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* الصور */
.img-responsive {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* المساعدات */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* الاستجابة */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container { padding: 0 2rem; }
}

/* تحسينات الأداء */
.card,
.btn,
.form-control {
    will-change: transform;
}

/* طباعة */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        color: black;
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================
   💎 UNIFIED CARD SYSTEM - Constitution Compliant
   ============================================
   Bootstrap handles width (col-6, col-md-3)
   CSS handles styling only
   No display: grid, No width changes
   ============================================ */

/* 1. Base Card Design */
.card-system {
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 260px; /* Unified card height */
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-system:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* 2. Images & Placeholders - Unified Height */
.card-system img,
.card-system .placeholder,
.card-system .card-image,
.card-system .product-placeholder,
.card-system .factory-placeholder {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* 3. Titles & Descriptions */
.card-system .title,
.card-system .card-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 6px 0 2px 0;
    line-height: 1.3;
}

.card-system .desc,
.card-system .card-text {
    font-size: 13px;
    color: #4B5563;
    margin: 0 0 8px 0; /* Increased from 6px to 8px */
    line-height: 1.5;
}

/* 4. Buttons - Unified Sizing */
.card-system .btn {
    padding: 8px 14px;
    min-height: 36px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    margin-top: auto;
}

/* 5. Icon Wrapper - Activities & Why Section */
.card-system .icon-wrapper,
.card-system .why-icon,
.card-system .card-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.card-system .icon-wrapper svg,
.card-system .why-icon svg {
    width: 32px !important; /* Fixed size for uniform icons */
    height: 32px !important;
    fill: currentColor;
    display: block;
}

.card-system .icon-wrapper i,
.card-system .why-icon i {
    font-size: 1.5rem;
}

/* 6. Section Spacing Rhythm - Unified */
.section,
.stats-section,
.why-section,
section {
    margin-top: 32px;
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .section,
    .stats-section,
    .why-section,
    section {
        margin-top: 40px;
        margin-bottom: 40px;
    }
}

/* 7. Card Body & Footer Spacing */
.card-system .card-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-system .card-footer {
    padding: 0;
    margin-top: auto;
}

/* Desktop Enhancements */
@media (min-width: 1440px) {
    .card-system {
        padding: 16px;
        border-radius: 14px;
    }

    .card-system img,
    .card-system .placeholder {
        height: 180px;
        border-radius: 10px;
    }
}

/* ============================================
   🛠 PRODUCT CARDS - Unified Image & Placeholder
   ============================================ */

/* 1. Unified Image & Placeholder - Same Box, Same Height */
.product-card img,
.product-card .product-placeholder {
    width: 100% !important;
    height: 110px !important;
    object-fit: cover !important;
    display: block;
    border-radius: 0 !important;
    background: #F9FAFB;
    padding: 0 !important;
    margin: 0 !important;
}

/* 2. Placeholder - Expands Like Image */
.product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: #1A56DB;
    line-height: 1 !important;
    height: 110px !important;
}

/* 3. Product Card Structure - Fixed Button at Bottom */
.product-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 260px !important;
    padding: 0 !important;
    padding-bottom: 12px !important;
    overflow: visible !important;
    position: relative;
    border-radius: 0 !important;
}

.product-content {
    flex: 0 0 auto;
    overflow: visible !important;
}

.product-card .card-body {
    padding: 6px 8px !important;
}

.product-footer {
    margin-top: auto !important;
    padding: 6px 8px !important;
    padding-top: 8px !important;
    z-index: 5;
}

.btn-details {
    flex-shrink: 0 !important;
}

/* Compact Button Style for Cards */
.btn-details {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    height: auto !important;
    min-height: unset !important;
    white-space: nowrap !important;
}

/* Desktop Adjustments - Better spacing and sizing */
@media (min-width: 768px) {
    .product-card {
        min-height: 320px !important;
        padding-bottom: 16px !important;
        border-radius: 8px !important;
    }

    .product-card img,
    .product-card .product-placeholder {
        height: 180px !important;
        border-radius: 8px 8px 0 0 !important;
    }

    .product-placeholder {
        height: 180px !important;
    }

    .product-card .card-body {
        padding: 12px 16px !important;
    }

    .product-footer {
        padding: 8px 16px !important;
        padding-top: 12px !important;
    }

    .btn-details {
        padding: 6px 12px !important;
        font-size: 14px !important;
        gap: 4px !important;
    }

    .product-card .card-title {
        font-size: 1rem !important;
    }
}

/* Product Card Title */
.product-card .card-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
}

/* 4. Product Card Text Elements */
.product-card .title {
    margin-top: 10px;
    margin-bottom: 4px;
}

.product-card .desc {
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   🎯 ACTIVITY CARDS - Unified Icons
   ============================================ */

/* Activity Card Icon Wrapper - Unified Size */
.activity-card .icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Force All SVG Icons To Same Size */
.activity-card .icon-wrapper svg {
    width: 28px !important;
    height: 28px !important;
    display: block;
}

/* Mobile-Only Adjustments for Activity Cards */
@media (max-width: 767px) {
    /* Prevent equal-height stretch in Industrial Activities on mobile only */
    .industries-section .card-grid-row {
        align-items: flex-start !important;
    }

    /* Keep anchors/cards allowed to fill their column; do NOT force height:auto here */

    /* Ensure the card body can stretch so the footer can stick to the bottom */
    .industries-section .activity-card .card-body {
        flex: 1 1 auto !important;
    }

    /* Unified mobile height baseline for industrial activities only */
    .industries-section .activity-card {
        min-height: 200px !important;
    }

    /* إلغاء أي min-height أو ارتفاع إجباري */
    .activity-card {
        min-height: auto !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Force card-body to be Block (NOT Flex) */
    .activity-card .card-body {
        display: flex !important;
        flex-direction: column !important;
        padding: 8px 10px 4px 10px !important;
    }

    /* منع تمدد الجزء العلوي */
    .activity-card .activity-card-main {
        flex-grow: 0 !important;
    }

    /* الزر يأخذ مكانه الطبيعي فقط */
    .activity-card .activity-card-footer {
        margin-top: auto !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        align-self: stretch !important;
    }

    .activity-card .card-title {
        margin-top: 6px !important;
        margin-bottom: 2px !important;
    }

    .activity-card .btn-details {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 4px 10px !important;
        font-size: 13px !important;
    }
}

/* ============================================
   📏 SECTION SPACING - Latest Products
   ============================================ */

/* 6. Latest Products Section - Breathing Space */
#latest-products-section {
    margin-top: 32px !important;
}

/* ============================================
   🏭 FACTORIES PAGE STYLES
   ============================================ */

/* Hero Section */
.factories-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1747B8 100%);
    color: #fff;
    padding: 1.5rem 0 1rem;
    margin-bottom: 0;
    margin-top: 0;
    position: relative;
    overflow: hidden;
}

.factories-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: 0;
}

.factories-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    z-index: 0;
}

.factories-hero .container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
}

.factories-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #fff;
}

.factories-hero p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0;
}

/* Search Section */
.search-section {
    background: #E5E5E5;
    padding: 1.5rem 0 1rem;
    margin-top: -1rem;
    z-index: 2;
    position: relative;
}

.search-section .container {
    max-width: 1200px;
}

.search-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: -1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
}

/* Advanced Filters Toggle */
.advanced-filters-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.advanced-filters-toggle .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    max-width: 100%;
    overflow: hidden;
}

.search-card form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.search-card .row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
    margin: 0;
}

.search-card .col-12,
.search-card .col-md-3,
.search-card .col-md-2,
.search-card .col-md-1,
.search-card [class*="col-"] {
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 100%;
    margin-bottom: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.search-card .col-12.col-md-3 {
    flex: 1.5 1 200px;
}

.search-card .col-6.col-md-2,
.search-card .col-6.col-md-1 {
    flex: 1 1 150px;
}

.search-card .col-12.col-md-2:last-of-type,
.search-card .d-grid {
    flex: 0 1 auto;
    min-width: 120px;
    padding: 0 !important;
}

.search-card .form-label {
    color: #2C2C2C;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.search-card .form-control,
.search-card .form-select {
    border: 2px solid #E5E5E5;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    background: #fafafa;
    height: 46px;
    width: 100%;
    max-width: 100%;
}

.search-card .form-control:hover,
.search-card .form-select:hover {
    border-color: var(--warning);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.15);
    background: #fff;
}

.search-card .form-control:focus,
.search-card .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 18px rgba(26, 86, 219, 0.25);
    background: #fff;
    outline: none;
}

.search-card .btn-primary {
    background: linear-gradient(135deg, var(--warning) 0%, #C45817 100%);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 46px;
    width: 100%;
    max-width: 180px;
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    color: #fff;
    cursor: pointer;
}

.search-card .btn-primary:hover {
    background: linear-gradient(135deg, #B8581A 0%, #A64814 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
}

.search-card .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.search-card .d-grid {
    display: flex !important;
    align-items: flex-end;
}

/* Search Chips */
.search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.search-chip {
    background: #E5E5E5;
    color: #2C2C2C;
    border: 2px solid #d0d0d0;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.search-chip:hover {
    background: #d0d0d0;
    color: #2C2C2C;
}

.search-chip.clear-all {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.search-chip.clear-all:hover {
    background: #c82333;
    border-color: #c82333;
    color: #fff;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Results Container */
.container.my-4 {
    max-width: 1200px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #E5E5E5;
}

.results-count {
    font-size: 1rem;
    font-weight: 600;
    color: #2C2C2C;
}

.results-count span {
    font-size: 1.3rem;
    color: var(--warning);
    font-weight: 800;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 2rem;
    color: var(--warning);
}

.empty-state-title {
    color: #2C2C2C;
}

.empty-state-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.empty-state-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Factory Cards - Vertical Grid Layout */
.factory-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.factory-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    border-color: var(--primary);
}

.factory-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #F9FAFB;
}

.factory-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(26,86,219,0.25);
}

.factory-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.factory-card-body {
    flex: 1;
    margin-bottom: 1rem;
}

.factory-name {
    font-weight: 700;
    color: #2C2C2C;
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.factory-name a {
    color: inherit;
    transition: color 0.3s ease;
}

.factory-name a:hover {
    color: var(--primary);
}

.factory-info {
    color: #666;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.factory-info i {
    color: var(--primary);
    margin-left: 0.25rem;
}

.addr-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #E5E5E5;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    color: #2C2C2C;
    font-size: 0.8rem;
    margin-top: 0.75rem;
    line-height: 1.4;
}

.addr-box i {
    color: var(--success);
    margin-left: 0.25rem;
}

.factory-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 2px solid #F9FAFB;
}

.phone-chip {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26,86,219,0.2);
    width: 100%;
    justify-content: center;
}

.phone-chip:hover {
    background: var(--success);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5,150,105,0.3);
    color: #fff;
}

.badge-tier {
    border-radius: 9999px;
    padding: 0.25rem 0.6rem;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-tier.premium {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #7a4c00;
    box-shadow: 0 2px 6px rgba(255,215,0,0.25);
}

.badge-tier.paid {
    background: linear-gradient(135deg, var(--success) 0%, #45a049 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(5,150,105,0.25);
}

.badge-tier.free {
    background: #E5E5E5;
    color: #666;
}

/* Mobile Styles */
@media (max-width: 767px) {
    .factories-hero {
        padding: 1.25rem 0 1rem;
    }

    .factories-hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.4rem;
    }

    .factories-hero p {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    .search-section {
        padding: 1rem 0 0.75rem;
        margin-top: -0.5rem;
    }

    .search-section .container {
        padding-left: 0;
        padding-right: 0;
        max-width: 100%;
    }

    .search-card {
        padding: 0.75rem;
        margin-top: -1rem;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
    }

    .search-card .form-label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
        font-weight: 600;
    }

    .search-card .form-control,
    .search-card .form-select {
        height: 40px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .search-card .btn-primary {
        height: 40px;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        max-width: 100%;
    }

    .search-card .row {
        gap: 0.5rem;
    }

    .search-card .row.g-3 {
        --bs-gutter-y: 0.5rem;
    }

    /* ترتيب خاص للموبايل: كلمة مفتاحية وزر البحث في صف */
    .search-card .row > .col-12.col-md-3:first-child {
        flex: 1 1 60%;
        min-width: 60%;
    }

    .search-card .row > .col-12.col-md-3.d-grid {
        flex: 1 1 38%;
        min-width: 38%;
    }

    .search-card .row > .col-6 {
        flex: 1 1 48%;
        min-width: 48%;
    }

    .search-card [class*="col-"] {
        margin-bottom: 0;
    }

    .advanced-filters-toggle {
        margin-top: 0.5rem;
    }

    .factory-avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }

    .factory-card {
        padding: 1rem;
    }

    .factory-card-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .factory-name {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .factory-info {
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .phone-chip {
        font-size: 0.8rem;
        padding: 0.45rem 0.75rem;
    }

    .factory-card-footer {
        padding-top: 0.75rem;
    }

    /* Pagination - عربي على الموبايل */
    .pagination .page-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }

    .pagination .page-item:first-child .page-link::before {
        content: "السابق";
    }

    .pagination .page-item:first-child .page-link {
        font-size: 0;
    }

    .pagination .page-item:first-child .page-link::before {
        font-size: 0.85rem;
    }

    .pagination .page-item:last-child .page-link::before {
        content: "التالي";
    }

    .pagination .page-item:last-child .page-link {
        font-size: 0;
    }

    .pagination .page-item:last-child .page-link::before {
        font-size: 0.85rem;
    }
}
