/* Taj Alwuqar — اختيار الصورة الرئيسية للعقار */
.iqfal-cover-picker {
    margin-top: 4px;
}

.iqfal-cover-picker__hint {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--text-muted, #64748b);
    line-height: 1.5;
}

.iqfal-cover-picker__hint strong {
    color: var(--primary-color, #0f2744);
    font-weight: 700;
}

.iqfal-cover-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 12px;
}

.iqfal-cover-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 2px solid transparent;
    box-shadow: 0 4px 14px rgba(15, 39, 68, 0.08);
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
    cursor: pointer;
}

.iqfal-cover-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 39, 68, 0.14);
}

.iqfal-cover-tile--is-cover {
    border-color: var(--secondary-color, #b89355);
    box-shadow: 0 0 0 1px rgba(184, 147, 85, 0.35), 0 10px 28px rgba(184, 147, 85, 0.22);
}

.iqfal-cover-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.iqfal-cover-tile__badge {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    inset-inline-end: auto;
    z-index: 3;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #c9a24d, #b89355);
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.iqfal-cover-tile--is-cover .iqfal-cover-tile__badge {
    opacity: 1;
    transform: translateY(0);
}

.iqfal-cover-tile__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 10px 8px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.72) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.iqfal-cover-tile:hover .iqfal-cover-tile__overlay,
.iqfal-cover-tile:focus-within .iqfal-cover-tile__overlay {
    opacity: 1;
}

.iqfal-cover-tile--is-cover .iqfal-cover-tile__overlay {
    opacity: 0;
}

.iqfal-cover-tile__set-btn {
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.95);
    color: #0f2744;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.iqfal-cover-tile__set-btn i {
    color: #b89355;
}

/* زر حذف الصورة — موحّد (أدمن + وسيط + مطور) — مثل لوحة الأدمن */
.iqfal-cover-tile__remove {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    inset-inline-start: auto;
    z-index: 15;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: #a33a3a;
    color: #fff;
    font-family: inherit;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.iqfal-cover-tile__remove-x {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    pointer-events: none;
}

.iqfal-cover-tile__remove:hover {
    transform: translateY(-1px);
    background: #8f3232;
    box-shadow: 0 4px 10px rgba(163, 58, 58, 0.45);
}

.iqfal-cover-tile__index {
    position: absolute;
    bottom: 6px;
    left: 8px;
    z-index: 1;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

[dir="rtl"] .iqfal-cover-tile__index {
    left: auto;
    right: 8px;
}

.iqfal-cover-tile--is-cover .iqfal-cover-tile__index {
    display: none;
}

@media (max-width: 480px) {
    .iqfal-cover-picker__grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
        gap: 10px;
    }
}

/* لوحة الوسيط — خلفية غامقة */
#agentDashboard .agent-media-preview-host,
#agentDashboard #agent-media-preview {
    display: block !important;
    width: 100%;
}

#agentDashboard .iqfal-cover-picker__hint {
    color: var(--iq-text-2, #c9bda8);
}

#agentDashboard .iqfal-cover-picker__hint strong {
    color: #f4a5a5;
}

/* إلغاء أي تنسيق عام لأزرار النماذج على زر الحذف */
#agentDashboard .form-group .iqfal-cover-tile__remove,
#adminDashboard .form-group .iqfal-cover-tile__remove {
    position: absolute !important;
    top: 4px !important;
    inset-inline-end: 4px !important;
    inset-inline-start: auto !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 6px !important;
    background: #a33a3a !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 20 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    transform: none;
}

#agentDashboard .form-group .iqfal-cover-tile__remove:hover,
#adminDashboard .form-group .iqfal-cover-tile__remove:hover {
    background: #8f3232 !important;
    transform: translateY(-1px) !important;
}
