/* =========================================================
   🎓 SOVINI CARDS ARCHITECTURE (DESKTOP & MOBILE)
========================================================= */

/* 🚀 إخفاء إعلانات الموبايل من شاشة الديسكتوب بشكل قاطع */
.mobile-only { display: none !important; }

/* --- 1. Base Job Card --- */
.job-card {
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    background: var(--surface-color, #ffffff);
    border: 1px solid var(--border-color, #cbd5e1);
    overflow: hidden;
    height: 100%;
}
.job-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-color: #2563eb;
}

/* --- 2. Cover & Images --- */
.job-cover-wrapper {
    position: relative;
    width: 100%;
    height: 130px; /* Desktop Default */
    background: #f8fafc;
    flex-shrink: 0;
}
.job-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fallback-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    font-weight: 900;
    font-size: 1.5rem;
    height: 100%;
}

/* --- 3. Tags (Dates & Deadlines) --- */
.custom-dates-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
}
.pub-date-tag, .date-tag {
    position: absolute;
    top: 10px; right: 10px;
    pointer-events: auto;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    z-index: 2;
}
.deadline-tag {
    position: absolute;
    top: 10px; left: 10px; /* Desktop Default */
    pointer-events: auto;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}

/* --- 4. Content & Text --- */
.job-card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 15px;
}
.job-card-text {
    text-align: center;
    margin-bottom: 15px;
}
.job-title {
    margin: 0 0 5px 0;
    font-size: 1.05rem;
    color: var(--text-primary, #0f172a);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* 👈 هذا هو السطر الجديد الذي سيخفي التحذير */
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.company-name {
    font-weight: bold;
    color: #64748b;
    font-size: 0.85rem;
}

/* --- 5. Actions & Buttons --- */
.job-actions {
    display: flex;
    width: 100%;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    gap: 8px;
}
.btn-save {
    width: 100%;
    height: 42px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
    background: transparent;
    border: 1px solid #cbd5e1;
}
.btn-save:hover { background: #f8fafc; }
.save-icon { fill: none; stroke: #64748b; }
.save-text { color: #64748b; font-weight: bold; font-size: 0.95rem; }

/* Saved State */
.btn-save.saved { background: #eff6ff; border-color: #bfdbfe; }
.btn-save.saved .save-icon { fill: #2563eb; stroke: #2563eb; }
.btn-save.saved .save-text { color: #2563eb; }

/* Admin Buttons */
.admin-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    color: white;
}
.btn-edit { background: #f59e0b; }
.btn-delete { background: #ef4444; }
.btn-archive { background: #f97316; }

/* =========================================================
   📱 MOBILE SPECIFIC ARCHITECTURE
========================================================= */
@media (max-width: 768px) {
    
    /* 🚀 إصلاح تخطيط الموبايل الأساسي وإخفاء السايدبار */
    .home-sidebar { display: none !important; }
    .home-layout { display: block !important; }
    .home-main-content { width: 100% !important; max-width: 100% !important; }

    /* 🚀 إجبار إعلانات الموبايل على الظهور (لأننا أخفيناها في الديسكتوب بال الأعلى) */
    .mobile-cv-banner.mobile-only { display: flex !important; }
    .mobile-trending-wrapper.mobile-only { display: block !important; }

    /* --- الأساسيات للشبكة في الموبايل --- */
    .jobs-grid { 
        display: grid !important; 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important; 
        padding: 10px !important; 
    }
    .job-card { padding: 0 !important; }
    .job-cover-wrapper { height: 110px !important; border-radius: 0 !important; }
    
    .pub-date-tag, .date-tag { top: 5px; right: 5px; font-size: 0.65rem; padding: 3px 6px; }
    .deadline-tag { top: auto; bottom: 5px; left: 5px; font-size: 0.65rem; padding: 3px 6px; }

    .job-card-content { padding: 10px 8px !important; }
    .job-card-text { margin-bottom: 10px !important; }
    .job-title { font-size: 0.85rem; }
    .company-name { font-size: 0.75rem; }

    .job-actions { padding: 0 8px 10px 8px !important; border: none !important; }
    .btn-save, .admin-btn { height: 38px !important; }
    .save-text { display: none !important; }
    .btn-save svg { margin: 0; width: 18px; height: 18px; }
    
    .admin-btn { font-size: 0; }
    .btn-edit::after { content: '✏️'; font-size: 1rem; }
    .btn-delete::after { content: '🗑️'; font-size: 1rem; }
    .btn-archive::after { content: '🗄️'; font-size: 1rem; }

    /* =========================================
       🚀 MOBILE CV BANNER (ANIMATED SAAS)
    ========================================= */
    .mobile-cv-banner {
        grid-column: 1 / -1; /* يمتد على العمودين لسد أي فراغ */
        background: linear-gradient(-45deg, #0f172a, #1e40af, #2563eb, #0f172a);
        background-size: 400% 400%;
        animation: gradientBG 10s ease infinite;
        border-radius: 20px;
        padding: 18px;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        position: relative;
        overflow: hidden;
        margin: 15px 0;
    }

    @keyframes gradientBG {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }

    .mobile-cv-banner::before {
        content: '';
        position: absolute;
        width: 120px;
        height: 120px;
        background: rgba(255,255,255,0.05);
        border-radius: 50%;
        top: -40px;
        left: -30px;
    }

    .cv-banner-content { position: relative; z-index: 2; flex-grow: 1; }

    .cv-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.12);
        border: 1px solid rgba(255,255,255,0.1);
        color: #bfdbfe;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 0.68rem;
        font-weight: 800;
        margin-bottom: 10px;
        backdrop-filter: blur(10px);
    }

    .mobile-cv-banner h3 { margin: 0 0 6px; color: white; font-size: 0.95rem; font-weight: 900; }
    
    #cv-dynamic-text {
        transition: opacity 0.5s ease-in-out;
        display: inline-block;
    }

    .mobile-cv-banner p { margin: 0; color: #dbeafe; font-size: 0.78rem; line-height: 1.5; }

    .cv-banner-btn {
        position: relative;
        z-index: 2;
        background: #f97316;
        color: #ffffff !important;
        text-decoration: none;
        padding: 10px 16px;
        border-radius: 14px;
        font-size: 0.82rem;
        font-weight: 800;
        white-space: nowrap;
        transition: 0.2s;
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
        animation: pulse-orange 2s infinite;
    }
    .cv-banner-btn:active { transform: scale(0.96); }

    @keyframes pulse-orange {
        0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7); }
        70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
        100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
    }

    /* =========================================
       🔥 MOBILE TRENDING SECTION (COMPACT SAAS UI)
    ========================================= */
    .mobile-trending-wrapper {
        grid-column: 1 / -1; /* يمتد على العمودين لسد أي فراغ */
        margin: 15px 0;
        background: #f8fafc;
        padding: 16px;
        border-radius: 20px;
        border: 1px solid #e2e8f0;
    }

    .mobile-trending-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 14px;
    }

    .trending-title { display: flex; align-items: center; gap: 8px; }
    .trending-title h3 { margin: 0; font-size: 1rem; font-weight: 900; color: #0f172a; }

    .hot-jobs-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .hot-job-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #ffffff;
        border-radius: 16px;
        padding: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.03);
        border: 1px solid #f1f5f9;
        transition: transform 0.2s;
        cursor: pointer;
    }
    .hot-job-card:active { transform: scale(0.98); }

    .hot-rank {
        width: 28px;
        height: 28px;
        background: linear-gradient(135deg, #ef4444, #f87171);
        border-radius: 50%; 
        color: white;
        font-weight: 900;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        flex-shrink: 0;
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
    }

    .hot-content {
        flex: 1;
        margin: 0 12px;
        min-width: 0;
    }

    .hot-content h4 {
        font-size: 0.85rem;
        margin: 0 0 4px 0;
        color: #0f172a;
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hot-content p {
        margin: 0;
        font-size: 0.72rem;
        color: #64748b;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hot-btn {
        background: #eff6ff;
        color: #2563eb;
        padding: 8px 16px;
        border-radius: 10px;
        font-size: 0.75rem;
        text-decoration: none;
        font-weight: 800;
        flex-shrink: 0;
    }

    .hot-view-all-btn {
        display: block;
        text-align: center;
        background: white;
        color: #64748b;
        padding: 10px;
        border-radius: 12px;
        text-decoration: none;
        font-weight: bold;
        font-size: 0.8rem;
        margin-top: 12px;
        border: 1px solid #e2e8f0;
        transition: 0.2s;
    }
    .hot-view-all-btn:active { background: #f1f5f9; }

}