/* ============================================
   MOBILE JOB CARD - COMPLETE REDESIGN
   Targeting ACTUAL HTML structure: .job-item
   ============================================ */

@media (max-width: 768px) {

    /* RESET EVERYTHING - Start fresh */
    .job-item,
    .jobs-list .job-item,
    .section .job-item {
        /* Remove all existing styles */
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 0 1.25rem 0 !important;

        /* Modern card design */
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
        overflow: hidden !important;

        /* Reset flex/grid */
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;

        /* Remove floats */
        float: none !important;
        clear: both !important;
    }

    /* Job Item Content - الحاوية الداخلية */
    .job-item-content,
    .job-item .job-item-content {
        display: block !important;
        width: 100% !important;
        padding: 1.25rem !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    /* ============================================
       JOB TITLE - العنصر الأهم
       ============================================ */
    .job-item h3,
    .job-item h3.job-title,
    .job-item .job-title,
    h3.job-title {
        /* FORCE full width and large size */
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 0 1rem 0 !important;

        /* Large, bold text */
        font-size: 1.4rem !important;
        font-weight: 700 !important;
        line-height: 1.4 !important;
        color: #1f2937 !important;
        text-align: right !important;

        /* Reset positioning */
        position: relative !important;
        float: none !important;
        clear: both !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;

        /* Remove transforms */
        transform: none !important;
    }

    .job-item h3 a,
    .job-item h3.job-title a,
    .job-item .job-title a {
        display: block !important;
        width: 100% !important;
        color: #1f2937 !important;
        text-decoration: none !important;
        font-size: inherit !important;
        font-weight: inherit !important;
        line-height: inherit !important;
    }

    .job-item h3 a:active,
    .job-title a:active {
        color: #2563eb !important;
    }

    /* For LTR (English) */
    [dir="ltr"] .job-item h3,
    [dir="ltr"] .job-title {
        text-align: left !important;
    }

    /* ============================================
       JOB META - معلومات الوظيفة
       ============================================ */
    .job-item .job-meta,
    .job-meta {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    /* Each meta item (company, location, type) */
    .job-meta > span,
    .job-meta .job-company,
    .job-meta .job-location,
    .job-meta .job-type {
        display: flex !important;
        flex-direction: row-reverse !important;
        align-items: center !important;
        gap: 0.625rem !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 0 0.75rem 0 !important;

        font-size: 0.95rem !important;
        color: #6b7280 !important;
        line-height: 1.5 !important;

        /* Reset */
        float: none !important;
        clear: both !important;
    }

    /* Icons styling */
    .job-meta .job-company i,
    .job-company i.fas {
        color: #3b82f6 !important;
        font-size: 1.1rem !important;
        width: 20px !important;
        min-width: 20px !important;
        text-align: center !important;
        margin: 0 !important;
    }

    .job-meta .job-location i,
    .job-location i.fas {
        color: #10b981 !important;
        font-size: 1.1rem !important;
        width: 20px !important;
        min-width: 20px !important;
        text-align: center !important;
        margin: 0 !important;
    }

    .job-meta .job-type i,
    .job-type i.fas {
        color: #f59e0b !important;
        font-size: 1.1rem !important;
        width: 20px !important;
        min-width: 20px !important;
        text-align: center !important;
        margin: 0 !important;
    }

    /* For LTR */
    [dir="ltr"] .job-meta > span,
    [dir="ltr"] .job-meta .job-company,
    [dir="ltr"] .job-meta .job-location,
    [dir="ltr"] .job-meta .job-type {
        flex-direction: row !important;
    }

    /* ============================================
       JOB ACTIONS - الإجراءات (footer)
       ============================================ */
    .job-item-actions,
    .job-item .job-item-actions {
        display: flex !important;
        flex-direction: row-reverse !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 1rem 1.25rem !important;
        margin: 1rem 0 0 0 !important;

        background: #f9fafb !important;
        border-top: 1px solid #e5e7eb !important;
    }

    [dir="ltr"] .job-item-actions {
        flex-direction: row !important;
    }

    /* Hide date/time on mobile */
    .job-item-actions .job-date,
    .job-date,
    .time-ago,
    span.job-date {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }

    /* View count */
    .job-item-actions .job-views,
    .job-views {
        display: flex !important;
        flex-direction: row-reverse !important;
        align-items: center !important;
        gap: 0.5rem !important;

        font-size: 0.85rem !important;
        color: #6b7280 !important;
    }

    .job-views i {
        color: #9ca3af !important;
        font-size: 0.9rem !important;
    }

    [dir="ltr"] .job-views {
        flex-direction: row !important;
    }

    /* View button */
    .job-item-actions .btn,
    .job-item-actions a.btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.375rem !important;

        padding: 0.625rem 1.25rem !important;
        background: #2563eb !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 8px !important;

        font-size: 0.9rem !important;
        font-weight: 600 !important;
        text-decoration: none !important;

        transition: all 0.2s ease !important;
    }

    .job-item-actions .btn:active {
        background: #1d4ed8 !important;
        transform: scale(0.96) !important;
    }

    /* ============================================
       FEATURED JOBS - الوظائف المميزة
       ============================================ */
    .job-item.featured {
        border-right: 4px solid #f59e0b !important;
        background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%) !important;
    }

    [dir="ltr"] .job-item.featured {
        border-right: none !important;
        border-left: 4px solid #f59e0b !important;
    }

    /* ============================================
       TOUCH INTERACTIONS
       ============================================ */
    .job-item:active {
        transform: scale(0.99) !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
    }

    /* ============================================
       CONTAINER & GRID
       ============================================ */
    .jobs-list,
    .section.section-gray {
        padding: 1rem !important;
    }

    /* Remove any conflicting box model */
    .job-item *,
    .job-item *::before,
    .job-item *::after {
        box-sizing: border-box !important;
    }
}

/* ============================================
   ULTRA SMALL SCREENS (< 375px)
   ============================================ */
@media (max-width: 374px) {
    .job-item {
        border-radius: 8px !important;
        margin-bottom: 1rem !important;
    }

    .job-item-content {
        padding: 1rem !important;
    }

    .job-item h3,
    .job-item .job-title {
        font-size: 1.25rem !important;
        margin-bottom: 0.875rem !important;
    }

    .job-meta > span {
        font-size: 0.875rem !important;
        margin-bottom: 0.625rem !important;
    }

    .job-item-actions {
        padding: 0.875rem 1rem !important;
    }
}

/* ============================================
   LARGER TABLETS (769px - 1024px)
   Keep responsive but adjust sizing
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .job-item h3,
    .job-item .job-title {
        font-size: 1.5rem !important;
    }
}
