/* ALS — حقل رفع الملفات المصمَّم (als-file)
 *
 * بديل عن <input type="file"> الخام، الذي يرسمه المتصفح بزرّ إنجليزي
 * («Choose File / No file chosen») محاذٍ لليسار لا يُترجَم ولا يُنسَّق ولا يحترم RTL.
 *
 * ملف خاصّ بنا — قابل للتحرير (بخلاف أصول AMS المنقولة: crud-unified وأخواتها).
 * المتغيّرات كلها من :root في _Layout فلا ألوان محلية هنا.
 */

.als-file {
    position: relative;
}

/* الحقل الأصلي يبقى في الشجرة ليعمل التحقق والإرسال — يُخفى بصرياً لا وظيفياً.
   display:none يمنع رسالة التحقق الأصلية من الظهور ويكسر :invalid في بعض المتصفحات. */
.als-file-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── منطقة الاختيار/السحب ── */
.als-file-drop {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px dashed var(--gray-300);
    border-radius: var(--radius, 10px);
    background: var(--parchment);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    margin: 0;
}

.als-file-drop:hover {
    border-color: var(--brass-500);
    background: var(--brass-50);
}

/* التركيز بلوحة المفاتيح: الحقل الأصلي مخفيّ، فالحلقة تُرسم على البديل المرئي
   وإلا صار الحقل غير قابل للوصول بالكيبورد بصرياً. */
.als-file-native:focus-visible + .als-file-drop,
.als-file-drop:focus-visible {
    outline: none;
    border-color: var(--ink-600);
    box-shadow: 0 0 0 3px var(--ink-100);
}

.als-file-drop.is-dragover {
    border-color: var(--brass-600);
    border-style: solid;
    background: var(--brass-50);
    box-shadow: 0 0 0 3px var(--brass-200);
}

.als-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: var(--radius, 10px);
    background: var(--ink-100);
    color: var(--ink-700);
    font-size: 1.05rem;
}

.als-file-drop:hover .als-file-icon,
.als-file-drop.is-dragover .als-file-icon {
    background: var(--brass-200);
    color: var(--brass-700);
}

.als-file-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.als-file-cta {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-800);
}

.als-file-types {
    font-size: 11.5px;
    color: var(--gray-500);
}

/* ── الملف المختار ── */
.als-file-picked {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--brass-200);
    border-right: 3px solid var(--brass-500);
    border-radius: var(--radius, 10px);
    background: var(--brass-50);
}

.als-file-picked[hidden] { display: none; }

.als-file-picked-icon {
    color: var(--brass-700);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.als-file-picked-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

/* اسم الملف قد يكون طويلاً جداً — يُقتطع ولا يكسر البطاقة */
.als-file-picked-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.als-file-picked-size {
    font-size: 11.5px;
    color: var(--gray-500);
}

.als-file-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.als-file-clear:hover {
    background: var(--danger);
    color: var(--white);
}

/* ── المرفق الحالي (شاشة التعديل) ── */
.als-file-current {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray-600);
}

.als-file-current i { color: var(--success); margin-top: 2px; }

@media (max-width: 575.98px) {
    .als-file-drop { padding: 12px; }
    .als-file-types { display: none; }
}
