/* window-manager.css
   كل القواعد هنا تستهدف أصنافاً (.wm-win/.wm-h/.wm-header...) لا يضيفها window-manager.js إلا على سطح المكتب،
   ويزيلها فور العبور إلى عرض الجوال أو على الأجهزة اللمسية — فلا أثر لها على التصميم المتجاوب الحالي.
   (لا نستخدم media query هنا عمداً: لا حاجة له، وتجاهل المتصفحات القديمة له كان سيُسقط القواعد كلها.) */

/* البطاقة: عمود مرن (عنوان ثابت ← محتوى يتمرّر ← أزرار ثابتة) ولا تتجاوز الشاشة أبداً */
.wm-win { box-sizing: border-box; }
.wm-win:not(.wm-generic) { display: flex; flex-direction: column; overflow: hidden; }
.wm-win:not(.wm-generic) > .wm-header,
.wm-win:not(.wm-generic) > .wm-footer { flex: 0 0 auto; }
.wm-win:not(.wm-generic) > .wm-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.wm-win.wm-generic { overflow: auto; overscroll-behavior: contain; }
.wm-win.wm-max { border-radius: 8px !important; }

/* شريط العنوان = مقبض السحب */
.wm-header { cursor: move; user-select: none; -webkit-user-select: none; touch-action: none; }
.wm-header h1, .wm-header h2, .wm-header h3, .wm-header h4 { cursor: move; }
.wm-header [onclick], .wm-header button, .wm-header a, .wm-header input, .wm-header select { cursor: pointer; }

/* زر التكبير/الاستعادة بجوار زر الإغلاق */
.wm-max-btn {
    flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
    display: inline-grid; place-items: center; cursor: pointer; font-size: .9rem; line-height: 1;
    background: rgba(100, 116, 139, .14); color: inherit; opacity: .85;
    margin-inline-start: auto; margin-inline-end: 10px; transition: background .15s, opacity .15s, transform .1s;
}
.wm-max-btn:hover { background: rgba(99, 102, 241, .22); opacity: 1; }
.wm-max-btn:active { transform: scale(.92); }
.wm-max-btn:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }

/* مقابض تغيير الحجم: حواف رفيعة + زوايا أكبر، داخل البطاقة فلا تتأثر بـ overflow */
.wm-h { position: absolute; z-index: 60; touch-action: none; background: transparent; }
.wm-h-n  { top: 0;    left: 24px;  right: 24px; height: 5px; cursor: ns-resize; }
.wm-h-s  { bottom: 0; left: 24px;  right: 24px; height: 5px; cursor: ns-resize; }
.wm-h-e  { right: 0;  top: 24px;   bottom: 24px; width: 5px; cursor: ew-resize; }
.wm-h-w  { left: 0;   top: 24px;   bottom: 24px; width: 5px; cursor: ew-resize; }
/* الزوايا أكبر (22px): البطاقات لها border-radius كبير + overflow:hidden فأقصى بكسلات الزاوية غير قابلة للنقر */
.wm-h-ne { top: 0;    right: 0;    width: 22px; height: 22px; cursor: nesw-resize; }
.wm-h-sw { bottom: 0; left: 0;     width: 22px; height: 22px; cursor: nesw-resize; }
.wm-h-nw { top: 0;    left: 0;     width: 22px; height: 22px; cursor: nwse-resize; }
.wm-h-se { bottom: 0; right: 0;    width: 22px; height: 22px; cursor: nwse-resize; }
.wm-h:hover { background: rgba(99, 102, 241, .25); }
/* مقبض بصري صغير في الزاوية السفلية اليمنى ليدلّ على إمكانية تغيير الحجم */
.wm-h-se::after, .wm-h-sw::after {
    content: ''; position: absolute; bottom: 7px; width: 9px; height: 9px; opacity: .45; pointer-events: none;
    background: linear-gradient(135deg, transparent 0 45%, currentColor 45% 55%, transparent 55% 70%, currentColor 70% 80%, transparent 80%);
}
.wm-h-se::after { right: 7px; }
.wm-h-sw::after { left: 7px; transform: scaleX(-1); }
.wm-win.wm-max .wm-h { display: none; }

/* أثناء السحب/التحجيم: لا تحديد نصوص، ولا يلتقط iframe الحدث */
html.wm-gesture, html.wm-gesture body { user-select: none !important; -webkit-user-select: none !important; }
html.wm-gesture * { cursor: inherit !important; }
html.wm-gesture iframe { pointer-events: none !important; }
