/* ============================================
   RP-BOX — Design System
   ============================================ */

:root {
    --color-void: #12010f;
    --color-bg-1: #280120;
    --color-bg-2: #450063;
    --color-primary: #9414d1;
    --color-primary-rgb: 148, 20, 209;
    --color-cyan: #03b2ed;
    --color-cyan-rgb: 3, 178, 237;
    --color-pink: #fd59ca;
    --color-pink-rgb: 253, 89, 202;
    --color-amber: #ffb84d;
    --color-amber-rgb: 255, 184, 77;
    --color-danger: #e23c5d;
    --color-danger-rgb: 226, 60, 93;
    --color-danger-text: #ff9caf;
    --color-success-text: #7fe3ff;
    --color-info-text: #d9b3f7;

    --color-text: #f5eefc;
    --color-text-dim: #c9b8d6;
    --color-text-muted: #8d7a9c;
    --color-heading: #ffffff;

    --color-surface: rgba(255, 255, 255, 0.05);
    --color-surface-strong: rgba(255, 255, 255, 0.08);
    --color-border: rgba(255, 255, 255, 0.12);
    --color-input-bg: rgba(0, 0, 0, 0.25);
    --color-shimmer-rgb: 255, 255, 255;

    --color-chrome-rgb: 18, 1, 15;

    --gradient-brand: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-primary) 55%, var(--color-pink) 100%);
    --gradient-bg: radial-gradient(120% 120% at 15% 0%, #3a0140 0%, var(--color-bg-1) 45%, var(--color-void) 100%);
    --gradient-text: linear-gradient(90deg, var(--color-cyan), var(--color-primary), var(--color-pink));

    --shadow-glow: 0 8px 40px rgba(var(--color-primary-rgb), 0.35);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;

    --font-base: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-display: 'Space Grotesk', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --container-w: 1240px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- الوضع الفاتح ---------- */
:root[data-theme="light"] {
    --color-void: #ffffff;
    --color-bg-1: #f7f1fb;
    --color-bg-2: #efe1f8;
    --color-primary: #8a13c2;
    --color-primary-rgb: 138, 19, 194;
    --color-cyan: #0891b8;
    --color-cyan-rgb: 8, 145, 184;
    --color-pink: #d6389f;
    --color-pink-rgb: 214, 56, 159;
    --color-amber: #b5710a;
    --color-amber-rgb: 181, 113, 10;
    --color-danger: #d5304f;
    --color-danger-rgb: 213, 48, 79;
    --color-danger-text: #b5203c;
    --color-success-text: #077391;
    --color-info-text: #6b1f96;

    --color-text: #241129;
    --color-text-dim: #5b4a63;
    --color-text-muted: #83748a;
    --color-heading: #150a1a;

    --color-surface: rgba(20, 0, 30, 0.04);
    --color-surface-strong: rgba(20, 0, 30, 0.07);
    --color-border: rgba(20, 0, 30, 0.12);
    --color-input-bg: rgba(20, 0, 30, 0.035);
    --color-shimmer-rgb: 20, 0, 30;

    --color-chrome-rgb: 255, 255, 255;

    --gradient-bg: radial-gradient(120% 120% at 15% 0%, #fbeeff 0%, var(--color-bg-1) 45%, var(--color-void) 100%);

    --shadow-glow: 0 8px 32px rgba(var(--color-primary-rgb), 0.18);
    --shadow-card: 0 4px 20px rgba(40, 1, 32, 0.08);
}

/* ---------- Profile templates (photographer public pages) ---------- */
/* القالب الافتراضي "سينمائي" يستخدم قيم :root كما هي بدون حاجة لإعادة تعريف */
body.tpl-minimal {
    --radius-lg: 12px;
    --radius-md: 10px;
    --shadow-glow: 0 4px 20px rgba(var(--color-primary-rgb), 0.15);
    --shadow-card: 0 2px 14px rgba(0, 0, 0, 0.25);
}
body.tpl-minimal .card { backdrop-filter: none; }
body.tpl-bold {
    --radius-lg: 30px;
    --radius-md: 20px;
    --shadow-glow: 0 14px 55px rgba(var(--color-primary-rgb), 0.5);
}
body.tpl-bold h1,
body.tpl-bold .section-title,
body.tpl-bold .album-info h3,
body.tpl-bold .p-card-name { font-weight: 900; letter-spacing: -0.01em; }
body.tpl-bold .card { border-width: 2px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-base);
    background: var(--gradient-bg) fixed;
    color: var(--color-text);
    line-height: 1.7;
    min-height: 100vh;
    /* إعادة تعريف هذه المشتقات على مستوى body (بدل الاكتفاء بوراثة قيمة :root المحسوبة سلفًا)
       يسمح لصفحة البروفايل بإعادة تلوينها فعليًا عبر تجاوز --color-primary على body نفسه */
    --gradient-brand: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-primary) 55%, var(--color-pink) 100%);
    --gradient-text: linear-gradient(90deg, var(--color-cyan), var(--color-primary), var(--color-pink));
}

html[dir="ltr"] body { direction: ltr; }
html[dir="rtl"] body { direction: rtl; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.container {
    width: 100%;
    max-width: var(--container-w);
    margin-inline: auto;
    padding-inline: 20px;
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section { padding-block: 64px; }
.section-title {
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    font-weight: 800;
    margin: 0 0 8px;
}
.section-sub { color: var(--color-text-dim); margin: 0 0 32px; max-width: 640px; }
.section-head { margin-bottom: 32px; }
.section-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover { box-shadow: 0 10px 50px rgba(var(--color-pink-rgb), 0.4); }
.btn-outline {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
    backdrop-filter: blur(6px);
}
.btn-outline:hover { border-color: var(--color-primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-cyan); padding: 8px 12px; }

/* ---------- شريط معاينة الإدارة (انتحال شخصية مصور) ---------- */
.impersonate-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #e2a63c;
    color: #2a1a00;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    padding: 10px 16px;
}
.impersonate-bar a { text-decoration: underline; color: #2a1a00; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(var(--color-chrome-rgb), 0.75);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    gap: 24px;
}
.floating-brand {
    position: fixed;
    top: 18px;
    inset-inline-end: 22px;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: rgba(var(--color-chrome-rgb), 0.55);
    backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    isolation: isolate;
    transition: transform 0.25s ease;
}
.floating-brand::before {
    content: "";
    position: absolute;
    inset: -6px;
    background: var(--gradient-brand);
    opacity: 0.18;
    filter: blur(12px);
    border-radius: var(--radius-full);
    z-index: -1;
    animation: brand-glow-pulse 4s ease-in-out infinite;
}
.floating-brand img { height: 26px; width: auto; filter: drop-shadow(0 0 8px rgba(var(--color-primary-rgb), 0.5)); }
.floating-brand:hover { transform: scale(1.08); }
@keyframes brand-glow-pulse {
    0%, 100% { opacity: 0.14; }
    50% { opacity: 0.28; }
}
@media (prefers-reduced-motion: reduce) {
    .floating-brand::before { animation: none; }
    .floating-brand:hover { transform: none; }
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand img { height: 34px; width: auto; }
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { font-weight: 600; color: var(--color-text-dim); font-size: 0.95rem; transition: color 0.2s; }
.main-nav a:hover, .main-nav a.active { color: var(--color-heading); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-cyan);
    border: 1px solid var(--color-border);
    padding: 8px 14px;
    border-radius: var(--radius-full);
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-full);
    font-size: 1rem;
    line-height: 1;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { border-color: var(--color-primary); transform: translateY(-1px); }
.theme-toggle-icon-dark { display: none; }
:root[data-theme="light"] .theme-toggle-icon-dark { display: inline; }
:root[data-theme="light"] .theme-toggle-icon-light { display: none; }
.theme-toggle-floating {
    position: fixed;
    top: 18px;
    inset-inline-start: 22px;
    z-index: 500;
    background: rgba(var(--color-chrome-rgb), 0.55);
    backdrop-filter: blur(14px);
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-heading);
    font-size: 1.6rem;
}

@media (max-width: 860px) {
    .main-nav { position: fixed; inset-inline: 0; top: 76px; background: var(--color-bg-1); flex-direction: column; align-items: stretch; padding: 20px; gap: 4px; border-bottom: 1px solid var(--color-border); transform: translateY(-130%); transition: transform 0.25s ease; }
    .main-nav.open { transform: translateY(0); }
    .main-nav a { padding: 12px 8px; border-radius: var(--radius-sm); }
    .main-nav a:hover { background: var(--color-surface); }
    .menu-toggle { display: block; }
    .header-actions .btn-primary.nav-join { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding-block: 72px 40px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto -10%;
    height: 500px;
    background: radial-gradient(closest-side, rgba(var(--color-primary-rgb), 0.45), transparent);
    filter: blur(10px);
    z-index: -1;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; margin: 0 0 18px; line-height: 1.25; }
.hero p { color: var(--color-text-dim); font-size: 1.1rem; max-width: 640px; margin: 0 auto 32px; }
.hero-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

.category-ticker {
    margin-top: 56px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-block: 4px 8px;
    scrollbar-width: none;
}
.category-ticker::-webkit-scrollbar { display: none; }
.category-chip {
    flex: none;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

/* ---------- Filters ---------- */
.filters-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.filters-bar .btn { align-self: end; }
.field-search { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 700; }
.field select, .field input, .field textarea {
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    width: 100%;
}
.input-inline {
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
}
.input-inline:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.25);
}
.field select:focus, .field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.25);
}
.field-hint { font-size: 0.75rem; color: var(--color-text-muted); }
.field-error { font-size: 0.8rem; color: var(--color-danger-text); }

.category-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.category-pill {
    padding: 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-dim);
    transition: all 0.2s;
}
.category-pill.active, .category-pill:hover { background: var(--gradient-brand); color: #fff; border-color: transparent; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-dynamic { grid-template-columns: repeat(var(--album-cols, 4), 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-dynamic { grid-template-columns: repeat(min(var(--album-cols, 4), 3), 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-4, .grid-2, .grid-dynamic { grid-template-columns: 1fr; } }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(var(--color-primary-rgb), 0.5); }

.tag {
    background: rgba(var(--color-cyan-rgb), 0.12);
    color: var(--color-cyan);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

/* ============================================
   بطاقة المصور — "الرصيف الحي" (Kinetic Dock)
   ============================================ */
.p-card {
    display: flex;
    flex-direction: column;
}

/* ---------- منطقة الصورة ---------- */
.p-card-media {
    /* استثناء متعمّد وموثّق: صورة الغلاف محتوى غير مرتبط بالوضع
       الفاتح/الداكن، لذا يحتاج تدرّج التظليل ولون النص فوقها قيمًا
       ثابتة بدل الرموز الخاصة بالثيم (والتي تنعكس بين الداكن والفاتح
       وتكسر التباين). */
    --overlay-scrim: 10, 0, 10;
    --overlay-ink: #fbf7ff;

    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--color-bg-2);
}

.p-card-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
}
.p-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.7s var(--ease-out);
}

.p-card-scrim {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(var(--overlay-scrim), 0.9) 0%,
        rgba(var(--overlay-scrim), 0.55) 28%,
        rgba(var(--overlay-scrim), 0.08) 60%,
        transparent 78%
    );
}

/* ---------- الرصيف: العنوان الثابت + اللوحة المنسدلة ---------- */
.p-card-dock {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
}

.p-card-reveal-track {
    display: grid;
    grid-template-rows: 1fr; /* افتراضيًا مكشوف بالكامل (لمس/بلا hover) */
    transition: grid-template-rows 0.5s var(--ease-out);
}
/* صندوق قطع صرف بلا حشو/حدود خاصة به — أي حشو أو حدود هنا يمنع انهيار
   الصف الشبكي إلى 0fr بالكامل (يبقى منها شريط رفيع ظاهر دومًا)، لذا انتقلا
   لعنصر داخلي (.p-card-reveal-content) لا يفرض حدًا أدنى على القطع الخارجي. */
.p-card-reveal-inner {
    overflow: hidden;
    min-height: 0;
}
.p-card-reveal-content {
    background: rgba(var(--color-chrome-rgb), 0.86);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-block-start: 1px solid var(--color-border);
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.p-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 52px;
    overflow: hidden;
}

.p-card-terminal {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display), ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.74rem;
    color: var(--color-text-dim);
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease;
}
.p-card-terminal:hover,
.p-card-terminal:focus-visible {
    border-color: rgba(var(--color-cyan-rgb), 0.6);
    color: var(--color-text);
}
.p-card-prompt { color: var(--color-cyan); font-weight: 700; flex: none; }
.p-card-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-card-caret {
    display: inline-block;
    width: 1px;
    height: 0.9em;
    flex: none;
    background: var(--color-cyan);
    animation: p-card-blink 1.1s step-end infinite;
}
@keyframes p-card-blink { 0%, 45% { opacity: 1; } 55%, 100% { opacity: 0; } }

.p-card-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.p-card-cta:hover span:first-child,
.p-card-cta:focus-visible span:first-child {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.p-card-arrow {
    position: relative;
    inset-inline-start: 0;
    color: var(--color-cyan);
    transition: inset-inline-start 0.3s var(--ease-out);
}
html[dir="rtl"] .p-card-arrow { display: inline-block; transform: scaleX(-1); }
.p-card-cta:hover .p-card-arrow,
.p-card-cta:focus-visible .p-card-arrow { inset-inline-start: 4px; }

/* حالة الراحة الافتراضية (لمس / بدون hover): الوسوم والرابط والدعوة مكشوفة كليًا */
.p-card-tags,
.p-card-terminal,
.p-card-cta {
    opacity: 1;
    transform: none;
}

/* ---------- شريط العنوان الثابت (الصورة الرمزية + الاسم) ---------- */
.p-card-titlebar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-block: 12px;
    padding-inline: 14px;
    transition: transform 0.4s var(--ease-out);
}
.p-card-avatar-ring {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 2px;
    background: var(--gradient-brand);
    box-shadow: 0 2px 10px rgba(var(--color-primary-rgb), 0.4);
    transition: transform 0.4s var(--ease-out);
}
.p-card-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: rgba(var(--color-chrome-rgb), 0.9);
}
.p-card-title-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.p-card-name {
    color: var(--overlay-ink);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.98rem;
    line-height: 1.25;
    text-decoration: none;
    text-shadow: 0 1px 4px rgba(var(--overlay-scrim), 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.p-card-name-en {
    color: var(--overlay-ink);
    opacity: 0.72;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- شريط سفلي هادئ: التصنيف والموقع ---------- */
.p-card-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-block: 10px 14px;
    padding-inline: 16px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.p-card-dot {
    width: 3px;
    height: 3px;
    flex: none;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

/* ============================================
   تحسين تدريجي: التصغير عند الراحة والانبساط عند hover/focus
   فقط للأجهزة التي تدعم hover فعليًا (فأرة/تراك باد) — على اللمس
   يبقى الرصيف مكشوفًا دومًا كما هو معرّف أعلاه.
   ============================================ */
@media (hover: hover) and (pointer: fine) {
    .p-card-reveal-track { grid-template-rows: 0fr; }
    .p-card:hover .p-card-reveal-track,
    .p-card:focus-within .p-card-reveal-track { grid-template-rows: 1fr; }

    .p-card-tags,
    .p-card-terminal,
    .p-card-cta {
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
    }
    .p-card:hover .p-card-tags,
    .p-card:focus-within .p-card-tags { opacity: 1; transform: none; transition-delay: 0.08s; }
    .p-card:hover .p-card-terminal,
    .p-card:focus-within .p-card-terminal { opacity: 1; transform: none; transition-delay: 0.15s; }
    .p-card:hover .p-card-cta,
    .p-card:focus-within .p-card-cta { opacity: 1; transform: none; transition-delay: 0.22s; }

    .p-card:hover .p-card-cover img,
    .p-card:focus-within .p-card-cover img { transform: scale(1.06); }
    .p-card:hover .p-card-avatar-ring,
    .p-card:focus-within .p-card-avatar-ring { transform: scale(1.08); }
    .p-card:hover .p-card-titlebar,
    .p-card:focus-within .p-card-titlebar { transform: translateY(-2px); }

    .p-card:hover,
    .p-card:focus-within { box-shadow: var(--shadow-glow); }
}

/* إتاحة الحركة: نُبقي الكشف يعمل فورًا بلا حركة متحركة */
@media (prefers-reduced-motion: reduce) {
    .p-card-reveal-track,
    .p-card-cover img,
    .p-card-avatar-ring,
    .p-card-titlebar,
    .p-card-tags,
    .p-card-terminal,
    .p-card-cta,
    .p-card-arrow {
        transition: none !important;
    }
    .p-card-caret { animation: none; opacity: 1; }
}

/* ---------- Steps (how it works) ---------- */
.steps { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step-card { padding: 26px 20px; text-align: center; }
.step-num {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--gradient-brand); color: #fff; font-weight: 800;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.step-card h3 { margin: 0 0 6px; font-size: 1rem; }
.step-card p { margin: 0; color: var(--color-text-muted); font-size: 0.85rem; }

/* ---------- Profile page ---------- */
.profile-hero {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    margin-bottom: 32px;
}
.profile-cover { width: 100%; aspect-ratio: 16/6; object-fit: cover; background: var(--color-bg-2); }
/* البروفايل والاسم يعلوان أسفل صورة الغلاف مباشرة — يحتاجان تباينًا مضمونًا بغض النظر
   عن محتوى الصورة أو الوضع الليلي/النهاري الحالي، لذا تُفرض ألوان فاتحة فوق ستارة داكنة ثابتة. */
.profile-cover-scrim {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 160px;
    background: linear-gradient(0deg, rgba(10, 0, 10, 0.78) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}
.profile-info { position: relative; z-index: 2; padding: 0 28px 28px; margin-top: -60px; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.profile-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--color-void); background: var(--color-bg-2); flex: none; }
.profile-heading { flex: 1; min-width: 220px; }
.profile-heading h1 { margin: 0 0 4px; font-size: 1.7rem; color: #fff; }
.profile-heading .en-name { color: rgba(255, 255, 255, 0.75); font-size: 0.9rem; margin-bottom: 8px; }
.profile-meta-row { display: flex; flex-wrap: wrap; gap: 14px; color: rgba(255, 255, 255, 0.85); font-size: 0.88rem; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-actions .btn-outline { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.profile-actions .btn-outline:hover { border-color: #fff; }
.profile-bio { padding: 0 28px 28px; color: var(--color-text-dim); max-width: 760px; }

/* ---------- أيقونات التواصل الاجتماعي ---------- */
.social-links { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 28px 28px; }
.social-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-cyan);
    transition: transform 0.2s var(--ease-out), border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.social-icon-link svg { width: 19px; height: 19px; }
.social-icon-link:hover {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
    transform: translateY(-3px);
}

/* ---------- قائمة المشاركة المنسدلة ---------- */
.share-menu { position: relative; }
.share-menu-trigger svg { width: 18px; height: 18px; display: block; }
.share-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    z-index: 20;
    min-width: 200px;
    background: var(--color-bg-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.share-menu.open .share-menu-panel { opacity: 1; transform: none; pointer-events: auto; }
.share-menu-panel a,
.share-menu-panel button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: start;
    width: 100%;
}
.share-menu-panel svg { width: 17px; height: 17px; flex: none; color: var(--color-cyan); }
.share-menu-panel a:hover,
.share-menu-panel button:hover { background: var(--color-surface); }

/* ---------- رأس مختصر لصفحات الأعمال والتواصل الداخلية ---------- */
.profile-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    margin-bottom: 28px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.profile-subheader-brand { display: flex; align-items: center; gap: 12px; }
.profile-subheader-brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-primary); }
.profile-subheader-brand span { display: flex; flex-direction: column; gap: 2px; }
.profile-subheader-brand strong { font-size: 0.95rem; }
.profile-subheader-brand em { font-style: normal; font-size: 0.78rem; color: var(--color-text-muted); }
.profile-subheader-back svg { width: 15px; height: 15px; }

/* ---------- صفحة التواصل ---------- */
.contact-page-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .contact-page-grid { grid-template-columns: 1fr; } }
.contact-page-aside { display: flex; flex-direction: column; gap: 18px; }
.contact-whatsapp-btn svg { width: 18px; height: 18px; }
.contact-social-title { margin: 0; font-size: 0.9rem; color: var(--color-text-dim); }
.contact-page-aside .social-links { padding: 0; }

.tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
    padding: 9px 18px; border-radius: var(--radius-full);
    background: var(--color-surface); border: 1px solid var(--color-border);
    font-size: 0.85rem; font-weight: 700; color: var(--color-text-dim);
}
.tab-btn.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.media-item { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface); }
.media-item img, .media-item video { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.media-item iframe { width: 100%; aspect-ratio: 16/9; border: none; }
.media-caption { padding: 10px 12px; font-size: 0.82rem; color: var(--color-text-dim); }

.services-list { display: flex; flex-wrap: wrap; gap: 10px; }
.service-chip { padding: 8px 16px; border-radius: var(--radius-full); background: rgba(253,89,202,0.12); color: var(--color-pink); font-size: 0.85rem; font-weight: 600; }

/* ---------- Forms / auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 76px); display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 460px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-card); }
.auth-card.wide { max-width: 720px; }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 6px; }
.auth-card .sub { color: var(--color-text-muted); margin: 0 0 26px; font-size: 0.9rem; }
.form-row { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-foot { margin-top: 20px; text-align: center; font-size: 0.88rem; color: var(--color-text-muted); }
.form-foot a { color: var(--color-cyan); font-weight: 700; }

.alert {
    display: block;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.7;
    border-inline-start-width: 4px;
    border-inline-start-style: solid;
}
.alert-success { background: rgba(var(--color-cyan-rgb), 0.12); border: 1px solid rgba(var(--color-cyan-rgb), 0.4); border-inline-start-color: var(--color-cyan); color: var(--color-success-text); }
.alert-error { background: rgba(var(--color-danger-rgb), 0.15); border: 1px solid rgba(var(--color-danger-rgb), 0.4); border-inline-start-color: var(--color-danger); color: var(--color-danger-text); }
.alert-info { background: rgba(var(--color-primary-rgb), 0.12); border: 1px solid rgba(var(--color-primary-rgb), 0.4); border-inline-start-color: var(--color-primary); color: var(--color-info-text); }

.stepper { display: flex; gap: 8px; margin-bottom: 28px; }
.stepper .step { flex: 1; text-align: center; padding: 10px 6px; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 700; background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.stepper .step.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.stepper .step.done { color: var(--color-cyan); }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.checkbox-pill { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--color-input-bg); border: 1px solid var(--color-border); font-size: 0.85rem; cursor: pointer; }
.checkbox-pill input { accent-color: var(--color-primary); }

/* ---------- Plans ---------- */
.plan-card { padding: 32px 26px; position: relative; }
.plan-card.featured { border-color: var(--color-primary); box-shadow: var(--shadow-glow); }
.plan-badge { position: absolute; top: -14px; inset-inline-start: 24px; background: var(--gradient-brand); color: #fff; font-size: 0.75rem; font-weight: 800; padding: 5px 14px; border-radius: var(--radius-full); }
.plan-duration { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 6px; }
.plan-card h3 { margin: 0 0 16px; font-size: 1.2rem; }
.plan-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.plan-price .amount { font-size: 2.2rem; font-weight: 800; }
.plan-price .currency { color: var(--color-text-muted); font-size: 0.9rem; }
.plan-original { color: var(--color-text-muted); text-decoration: line-through; font-size: 0.85rem; margin-bottom: 20px; }
.plan-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.plan-features li { display: flex; gap: 8px; font-size: 0.88rem; color: var(--color-text-dim); align-items: flex-start; }
.plan-features li::before { content: "✓"; color: var(--color-cyan); font-weight: 800; }

/* ---------- بطاقات اختيار الباقة بنموذج التسجيل ---------- */
.plan-select-card { display: block; position: relative; cursor: pointer; text-align: center; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.plan-select-card:hover { transform: translateY(-3px); }
.plan-select-radio { position: absolute; inset-inline-start: 0; top: 0; opacity: 0; width: 1px; height: 1px; }
.plan-select-card:has(.plan-select-radio:checked) { border-color: var(--color-primary); box-shadow: var(--shadow-glow); background: rgba(var(--color-primary-rgb), 0.1); }
.plan-select-card .plan-select-cta { display: block; margin-top: 10px; pointer-events: none; }
.plan-select-card:has(.plan-select-radio:checked) .plan-select-cta { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.plan-select-radio:focus-visible ~ .plan-select-cta { outline: 2px solid var(--color-cyan); outline-offset: 2px; }

/* ---------- Dashboard / admin shell ---------- */
.app-shell { display: flex; min-height: calc(100vh - 76px); }
.app-sidebar {
    width: 260px; flex: none;
    background: var(--color-surface-strong);
    border-inline-end: 1px solid var(--color-border);
    padding: 24px 16px;
}
.app-sidebar-group { margin-bottom: 18px; }
.app-sidebar-group:last-child { margin-bottom: 0; }
.app-sidebar-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 0 14px;
    margin-bottom: 6px;
}
.app-sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    color: var(--color-text-dim); font-weight: 600; font-size: 0.9rem; margin-bottom: 4px;
}
.app-sidebar a:hover { background: var(--color-surface); color: var(--color-heading); }
.app-sidebar a.active { background: var(--gradient-brand); color: #fff; }
.app-main { flex: 1; padding: 32px; min-width: 0; }
.app-main h1 { margin-top: 0; }
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .app-sidebar {
        width: 100%; padding: 14px;
        border-inline-end: none; border-bottom: 1px solid var(--color-border);
        display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 6px;
    }
    .app-sidebar-group {
        display: flex; flex-wrap: wrap; gap: 4px 6px;
        margin-bottom: 0;
        padding-inline-end: 10px;
        border-inline-end: 1px solid var(--color-border);
    }
    .app-sidebar-group:last-child { border-inline-end: none; padding-inline-end: 0; }
    .app-sidebar-label { display: none; }
    .app-sidebar a { white-space: nowrap; margin-bottom: 0; padding: 8px 12px; font-size: 0.85rem; }
    .app-main { padding: 20px; }
}
@media (max-width: 520px) {
    .app-sidebar-group { border-inline-end: none; padding-inline-end: 0; width: 100%; }
}

.stat-card { padding: 22px; }

/* ---------- إحصائيات الزوار والنشاط بلوحة تحكم المصور ---------- */
.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 140px;
    padding: 20px 4px 6px;
    overflow-x: auto;
}
.mini-chart-bar {
    flex: 1;
    min-width: 8px;
    background: var(--gradient-brand);
    border-radius: 6px 6px 0 0;
    height: var(--h, 4%);
    min-height: 3px;
    position: relative;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.mini-chart-bar:hover { opacity: 1; }
.mini-chart-val {
    position: absolute;
    top: -20px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--color-text-dim);
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}
.mini-chart-bar:hover .mini-chart-val { opacity: 1; }
.mini-chart-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--color-text-muted); padding: 0 4px; }

.top-pages-list { display: flex; flex-direction: column; gap: 10px; }
.top-pages-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--color-surface); border-radius: var(--radius-sm); font-size: 0.9rem; }
.top-pages-list li strong { color: var(--color-cyan); }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 1.1rem; flex: none; }
.activity-date { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }
.stat-card .num { font-size: 1.9rem; font-weight: 800; }
.stat-card .label { color: var(--color-text-muted); font-size: 0.85rem; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--color-border); }
.data-table th { color: var(--color-text-muted); font-weight: 700; font-size: 0.8rem; }
.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.table-wrap .data-table { min-width: 640px; }

.badge { padding: 4px 12px; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 700; display: inline-block; }
.badge-pending { background: rgba(var(--color-amber-rgb), 0.15); color: var(--color-amber); }
.badge-approved { background: rgba(var(--color-cyan-rgb), 0.15); color: var(--color-cyan); }
.badge-rejected, .badge-suspended { background: rgba(var(--color-danger-rgb), 0.15); color: var(--color-danger-text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--color-border); padding-block: 48px 24px; margin-top: 80px; color: var(--color-text-muted); font-size: 0.88rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { color: var(--color-heading); margin: 0 0 14px; font-size: 0.95rem; }
.footer-grid a { display: block; margin-bottom: 8px; color: var(--color-text-muted); }
.footer-grid a:hover { color: var(--color-cyan); }
.footer-bottom { text-align: center; border-top: 1px solid var(--color-border); padding-top: 20px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }

/* Utilities */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   طبقات جوّية: تحبب فيلمي + مؤشر مخصّص
   ============================================ */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 22px; height: 22px;
    border: 1.5px solid var(--color-cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.2s var(--ease-out), height 0.2s var(--ease-out), background 0.2s, opacity 0.3s, border-color 0.2s;
    opacity: 0;
    mix-blend-mode: difference;
}
.cursor-dot.ready { opacity: 1; }
.cursor-dot.hovering { width: 44px; height: 44px; background: rgba(var(--color-cyan-rgb), 0.18); }
@media (pointer: coarse), (max-width: 860px) { .cursor-dot { display: none; } }

/* ============================================
   خلفيات متحركة (Aurora blobs)
   ============================================ */
.aurora {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}
.aurora span {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    animation: drift 22s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 420px; height: 420px; background: var(--color-primary); top: -10%; inset-inline-start: -8%; animation-duration: 26s; }
.aurora span:nth-child(2) { width: 380px; height: 380px; background: var(--color-cyan); top: 10%; inset-inline-end: -10%; animation-duration: 20s; animation-delay: -6s; }
.aurora span:nth-child(3) { width: 320px; height: 320px; background: var(--color-pink); bottom: -15%; inset-inline-start: 20%; animation-duration: 24s; animation-delay: -12s; }

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -40px) scale(1.12); }
    100% { transform: translate(-25px, 25px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .aurora span, .marquee-track, [class*="float-"] { animation: none !important; }
}

/* ============================================
   خلفية فيديو اختيارية للهيرو (تُفعَّل من إعدادات الإدارة)
   ============================================ */
.hero-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}
.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(var(--color-chrome-rgb), 0.55) 0%, rgba(var(--color-chrome-rgb), 0.9) 100%);
    z-index: -1;
}

/* ============================================
   شاشات تحميل Skeleton
   ============================================ */
img.img-loading {
    background: linear-gradient(100deg, rgba(var(--color-shimmer-rgb),0.03) 30%, rgba(var(--color-shimmer-rgb),0.09) 50%, rgba(var(--color-shimmer-rgb),0.03) 70%);
    background-size: 300% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -20% 0; }
}
@media (prefers-reduced-motion: reduce) {
    img.img-loading { animation: none; background: rgba(var(--color-shimmer-rgb),0.05); }
}

/* ============================================
   Reveal on scroll
   محصورة داخل html.js حتى يبقى المحتوى ظاهرًا فورًا إن تعطّل جافاسكربت
   (الكلاس يُضاف عبر سكربت مضمّن في <head> قبل أي محتوى)
   ============================================ */
html.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
html.js .reveal.in-view { opacity: 1; transform: translateY(0); }
html.js .reveal-stagger.in-view > * { opacity: 1; transform: translateY(0) scale(1); }
html.js .reveal-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
html.js .reveal-stagger.in-view > *:nth-child(1) { transition-delay: 0.05s; }
html.js .reveal-stagger.in-view > *:nth-child(2) { transition-delay: 0.12s; }
html.js .reveal-stagger.in-view > *:nth-child(3) { transition-delay: 0.19s; }
html.js .reveal-stagger.in-view > *:nth-child(4) { transition-delay: 0.26s; }
html.js .reveal-stagger.in-view > *:nth-child(5) { transition-delay: 0.33s; }
html.js .reveal-stagger.in-view > *:nth-child(6) { transition-delay: 0.4s; }
html.js .reveal-stagger.in-view > *:nth-child(7) { transition-delay: 0.47s; }
html.js .reveal-stagger.in-view > *:nth-child(8) { transition-delay: 0.54s; }

/* ============================================
   بحث سريع بالهيرو
   ============================================ */
.hero-search {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 440px;
    margin-top: 28px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 6px 6px 6px 18px;
}
html[dir="rtl"] .hero-search { padding: 6px 18px 6px 6px; }
.hero-search-icon { opacity: 0.6; font-size: 0.9rem; }
.hero-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 0.9rem;
    padding: 8px 4px;
}
.hero-search input:focus { outline: none; }
.hero-search button {
    background: var(--gradient-brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 10px 22px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ============================================
   Marquee حقيقي لشريط التصنيفات
   ============================================ */
.marquee {
    position: relative;
    overflow: hidden;
    margin-top: 56px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
    display: flex;
    gap: 12px;
    width: max-content;
    animation: marquee-scroll 36s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ============================================
   هيرو v2: تصميم غير متماثل بصور عائمة حقيقية
   ============================================ */
.hero-v2 { position: relative; padding-block: 88px 30px; overflow: hidden; }
.hero-v2-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 40px;
}
/* min-width:0 يمنع محتوى الـ marquee العريض (width:max-content) من تكبير عمود الشبكة */
.hero-v2-grid > * { min-width: 0; }
@media (max-width: 980px) { .hero-v2-grid { grid-template-columns: 1fr; } .hero-v2-visual { display: none; } }

.hero-v2 h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5.2vw, 4.2rem);
    font-weight: 700;
    line-height: 1.08;
    margin: 0 0 22px;
    letter-spacing: -0.01em;
}
.hero-v2 p.lead { color: var(--color-text-dim); font-size: 1.1rem; max-width: 520px; margin: 0 0 34px; }

.hero-v2-visual { position: relative; height: 460px; }
.float-card {
    position: absolute;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    animation: float-y 7s ease-in-out infinite;
    background: var(--color-bg-2);
}
.float-card img { width: 100%; height: 100%; object-fit: cover; }
.float-card.fc-1 { width: 210px; height: 270px; top: 0; inset-inline-start: 10%; z-index: 3; animation-duration: 8s; }
.float-card.fc-2 { width: 180px; height: 230px; top: 40%; inset-inline-start: 46%; z-index: 4; animation-duration: 6.5s; animation-delay: -2s; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.float-card.fc-3 { width: 190px; height: 240px; top: 8%; inset-inline-end: 2%; z-index: 2; animation-duration: 9s; animation-delay: -4s; }
.float-card.fc-4 { width: 150px; height: 190px; bottom: 0; inset-inline-start: 0; z-index: 1; animation-duration: 7.5s; animation-delay: -1s; opacity: 0.85; }
.float-badge {
    position: absolute;
    z-index: 5;
    bottom: 18%;
    inset-inline-end: 8%;
    background: rgba(var(--color-chrome-rgb), 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    animation: float-y 5s ease-in-out infinite;
    animation-delay: -3s;
}
.float-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #4be3a0; box-shadow: 0 0 10px #4be3a0; }

@keyframes float-y {
    0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
    50% { transform: translateY(-16px) rotate(var(--rot, 0deg)); }
}
.float-card.fc-1 { --rot: -4deg; }
.float-card.fc-2 { --rot: 3deg; }
.float-card.fc-3 { --rot: 2deg; }
.float-card.fc-4 { --rot: -3deg; }

/* ============================================
   قسم الإحصائيات
   ============================================ */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-block: 20px;
}
@media (max-width: 700px) { .stats-strip { grid-template-columns: repeat(2, 1fr); } }
.stat-block { background: rgba(var(--color-chrome-rgb), 0.55); padding: 30px 20px; text-align: center; }
.stat-block .num {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-block .label { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 6px; }

/* ============================================
   لوحة البحث عن المصورين بالرئيسية
   ============================================ */
.search-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: clamp(28px, 5vw, 48px);
}
.search-panel-form { max-width: 820px; margin: 24px auto 0; background: none; border: none; padding: 0; }

.card { transition: transform 0.4s var(--ease-out), border-color 0.3s ease, box-shadow 0.4s ease; }

/* لمعة تمر فوق الأزرار الأساسية عند التحويم */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s var(--ease-out);
}
.btn-primary:hover::before { transform: translateX(120%); }

/* ============================================
   مجلدات/ألبومات الأعمال بصفحة البروفايل
   ============================================ */
.album-card { display: block; overflow: hidden; }
.album-cover { position: relative; aspect-ratio: 4/3; background: var(--color-bg-2); overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease-out); }
.album-card:hover .album-cover img { transform: scale(1.08); }
.album-cover-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    background: var(--gradient-brand);
    opacity: 0.5;
}
.album-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff;
    background: rgba(0, 0, 0, 0.25);
}
.album-info { padding: 16px 18px; }
.album-info h3 { margin: 0 0 4px; font-size: 1rem; }
.album-count { color: var(--color-text-muted); font-size: 0.8rem; }

/* ============================================
   معرض بروفايل Masonry + Lightbox
   ============================================ */
.media-grid.masonry {
    columns: 3 240px;
    column-gap: 16px;
    display: block;
}
@media (max-width: 700px) { .media-grid.masonry { columns: 1 240px; } }
.media-grid.masonry .media-item { break-inside: avoid; margin-bottom: 16px; cursor: zoom-in; }
.media-grid.masonry .media-item img { aspect-ratio: auto; transition: transform 0.5s var(--ease-out); }
.media-grid.masonry .media-item:hover img { transform: scale(1.04); }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(8, 0, 8, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: var(--radius-md); box-shadow: 0 20px 80px rgba(0,0,0,0.6); }
.lightbox-close, .lightbox-nav {
    position: absolute;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--color-border);
    color: #fff;
    border-radius: 50%;
    width: 46px; height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
}
.lightbox-close { top: 24px; inset-inline-end: 24px; }
.lightbox-nav.prev { inset-inline-start: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { inset-inline-end: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover, .lightbox-nav:hover { background: var(--gradient-brand); border-color: transparent; }

/* ============================================
   شريط الاكتشاف — Discovery Console
   (يحل محل .category-pills و .filters-bar معًا كعنصر واحد في photographers.php فقط —
   القواعد القديمة تبقى كما هي لأنها لا تزال مستخدمة في admin/photographers.php و index.php)
   ============================================ */
.discovery {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px 20px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- مسار التصفح (breadcrumb بطراز سطر أوامر) ---------- */
.discovery-crumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-family: var(--font-display), 'Cairo', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}
.discovery-crumb-prompt { color: var(--color-cyan); font-weight: 700; flex: none; }
.discovery-crumb-seg {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-dim);
    text-decoration: none;
    padding: 3px 5px;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, background 0.2s ease;
}
.discovery-crumb-seg:hover,
.discovery-crumb-seg:focus-visible { color: var(--color-cyan); background: rgba(var(--color-cyan-rgb), 0.1); }
.discovery-crumb-seg[aria-current="page"] { color: var(--color-heading); font-weight: 700; }
.discovery-crumb-home { width: 13px; height: 13px; flex: none; }
.discovery-crumb-icon { display: inline-flex; width: 13px; height: 13px; flex: none; }
.discovery-crumb-icon svg { width: 100%; height: 100%; }
.discovery-crumb-sep { color: var(--color-text-muted); opacity: 0.55; }
.discovery-crumb-leaf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-heading);
    font-weight: 700;
    padding: 3px 5px;
}
.discovery-crumb-clear {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease;
}
.discovery-crumb-clear:hover,
.discovery-crumb-clear:focus-visible { color: var(--color-danger-text); background: rgba(var(--color-danger-rgb), 0.15); }
.discovery-crumb-caret {
    display: inline-block;
    width: 1px;
    height: 0.9em;
    flex: none;
    background: var(--color-cyan);
    margin-inline-start: 2px;
    animation: discovery-blink 1.1s step-end infinite;
}
@keyframes discovery-blink { 0%, 45% { opacity: 1; } 55%, 100% { opacity: 0; } }

/* ---------- شريط الفئات (namespace tabs) ---------- */
.discovery-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.discovery-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-block: 9px;
    padding-inline-start: 10px;
    padding-inline-end: 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-input-bg);
    color: var(--color-text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-out);
}
.discovery-tab-all { padding-inline: 16px; }
.discovery-tab-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex: none;
    background: var(--color-surface-strong);
    border: 1px solid var(--color-border);
    color: var(--color-text-dim);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.discovery-tab-icon svg { width: 13px; height: 13px; }
.discovery-tab-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.discovery-tab-count {
    font-family: var(--font-display), monospace;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    background: var(--color-surface-strong);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    line-height: 1.5;
    flex: none;
}
.discovery-tab-chevron {
    width: 12px;
    height: 12px;
    flex: none;
    color: var(--color-text-muted);
    transition: transform 0.25s var(--ease-out), color 0.2s ease;
}
.discovery-tab[aria-expanded="true"] .discovery-tab-chevron { transform: rotate(180deg); color: var(--color-cyan); }

.discovery-tab:hover,
.discovery-tab:focus-visible {
    border-color: rgba(var(--color-cyan-rgb), 0.5);
    color: var(--color-text);
}
.discovery-tab.is-active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
}
.discovery-tab.is-active .discovery-tab-icon,
.discovery-tab.is-active .discovery-tab-count { background: rgba(255, 255, 255, 0.2); border-color: transparent; color: #fff; }
.discovery-tab.is-active .discovery-tab-chevron { color: #fff; }

/* ---------- اللوحة المشتركة للتخصصات ("0fr grid accordion") ---------- */
.discovery-panel-track {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s var(--ease-out);
}
.discovery-panel-track.is-open { grid-template-rows: 1fr; }
/* عنصر قطع صِرف بلا أي حشو/حدود خاصة به — الحشو كله على العنصر الداخلي
   التالي (.discovery-panel-content)، وإلا فلن ينهار الصف الشبكي إلى صفر
   تمامًا حتى مع box-sizing:border-box (نفس العلة الموثّقة في بطاقة المصور). */
.discovery-panel-inner {
    overflow: hidden;
    min-height: 0;
}
.discovery-panel-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: var(--color-surface-strong);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-block-start: 2px;
}
.discovery-panel-label {
    font-family: var(--font-display), monospace;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-inline-end: 4px;
    flex: none;
}
.discovery-spec-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 7px 13px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-input-bg);
    color: var(--color-text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.discovery-spec-hash { color: var(--color-cyan); font-weight: 700; }
.discovery-spec-chip:hover,
.discovery-spec-chip:focus-visible { border-color: rgba(var(--color-cyan-rgb), 0.6); color: var(--color-text); }
.discovery-spec-chip.is-active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
}
.discovery-spec-chip.is-active .discovery-spec-hash { color: rgba(255, 255, 255, 0.85); }

/* شبكة أمان: إن وصل التركيز (Tab) لأي رابط داخل لوحة لم تُفتح بعد (بلا JS)،
   تُفتح تلقائيًا فلا يبقى رابط مركَّز غير مرئي — بنفس أسلوب بطاقة المصور. */
.discovery-panel-track:focus-within { grid-template-rows: 1fr; }

/* ---------- الفاصل + نموذج الفلاتر ---------- */
.discovery-sep { border-block-start: 1px solid var(--color-border); }
.discovery-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
.discovery-filters .btn { align-self: end; }

.discovery-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* ---------- الاستجابة ---------- */
@media (max-width: 640px) {
    .discovery { padding: 16px 14px 18px; gap: 14px; }
    .discovery-tab { padding-block: 8px; padding-inline-start: 8px; padding-inline-end: 12px; font-size: 0.8rem; }
    .discovery-tab-label { max-width: 30vw; }
    .discovery-crumb { font-size: 0.72rem; }
    .discovery-panel-content { padding: 12px; }
}
@media (max-width: 420px) {
    .discovery-tab-count { display: none; }
    .discovery-tab-label { max-width: 38vw; }
}

/* ---------- تلميحات hover لأجهزة الفأرة/التراك باد فقط (لا تُعتمد كوسيلة وحيدة) ---------- */
@media (hover: hover) and (pointer: fine) {
    .discovery-tab:not(.is-active):hover { transform: translateY(-1px); }
    .discovery-spec-chip:hover { transform: translateY(-1px); }
}

/* ---------- إتاحة الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
    .discovery-panel-track,
    .discovery-tab,
    .discovery-tab-chevron,
    .discovery-spec-chip,
    .discovery-crumb-seg,
    .discovery-crumb-clear {
        transition: none !important;
    }
    .discovery-tab:hover,
    .discovery-spec-chip:hover { transform: none !important; }
    .discovery-crumb-caret { animation: none; opacity: 1; }
}

/* ---------- لوحة الإدارة: قائمة الحسابات بانتظار المراجعة ---------- */
.pending-approvals-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pending-approval-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.pending-approval-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pending-approval-info a { font-weight: 700; color: var(--color-heading); }
.pending-approval-meta { font-size: 0.78rem; color: var(--color-text-muted); }
.pending-approval-actions form { display: flex; gap: 8px; }
@media (max-width: 480px) {
    .pending-approval-row { flex-direction: column; align-items: stretch; }
    .pending-approval-actions form { justify-content: flex-end; }
}
/* ---------- عنصر إدارة قابل للطي (تصنيفات/مدن/باقات بلوحة الإدارة) ---------- */
.admin-manage-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.admin-manage-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.admin-manage-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
}
.admin-manage-summary::-webkit-details-marker { display: none; }
.admin-manage-summary:hover { background: var(--color-surface-strong); }
.admin-manage-summary-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.admin-manage-name { font-weight: 700; color: var(--color-heading); }
.admin-manage-meta { font-size: 0.8rem; color: var(--color-text-muted); }
.admin-manage-chevron { width: 16px; height: 16px; flex: none; color: var(--color-text-muted); transition: transform 0.25s var(--ease-out); }
.admin-manage-item[open] .admin-manage-chevron { transform: rotate(180deg); }
.admin-manage-body { padding: 4px 18px 18px; border-top: 1px solid var(--color-border); }
.admin-manage-body .form-grid,
.admin-manage-body .form-row { margin-top: 14px; }
.admin-manage-actions { display: flex; gap: 8px; flex: none; }
.admin-manage-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.admin-manage-add-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.admin-manage-add-form input { max-width: 220px; }

/* حقل فخ للبوتات (honeypot) — مخفي عن المستخدمين الحقيقيين بصريًا وعن قارئ
   الشاشة، لكن لا يستخدم display:none حتى لا تتجاهله بعض البوتات البسيطة. */
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.works-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(var(--color-primary-rgb), 0.15);
    overflow: hidden;
}
.works-progress-bar span {
    display: block;
    height: 100%;
    width: var(--pct, 0%);
    background: var(--gradient-brand);
    border-radius: var(--radius-full);
    transition: width 0.4s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
    .works-progress-bar span { transition: none; }
}

.app-sidebar-version { display: block; margin-top: 16px; font-size: 0.7rem; color: var(--color-text-muted); text-align: center; }
@media (max-width: 860px) {
    .app-sidebar-version { flex-basis: 100%; margin-top: 6px; text-align: start; }
}
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--color-danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    margin-inline-start: 4px;
}

/* ===== لايف شات (لوحة المصور والإدارة) ===== */
.chat-panel { display: flex; flex-direction: column; gap: 16px; }
.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 420px;
    overflow-y: auto;
    padding: 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
.chat-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--color-surface-strong);
    border: 1px solid var(--color-border);
}
.chat-bubble p { margin: 0; line-height: 1.7; }
.chat-bubble-time { display: block; margin-top: 6px; font-size: 0.7rem; color: var(--color-text-muted); }
.chat-bubble.mine {
    align-self: flex-end;
    background: rgba(var(--color-primary-rgb), 0.18);
    border-color: rgba(var(--color-primary-rgb), 0.4);
}
.chat-bubble.theirs { align-self: flex-start; }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input-row textarea {
    flex: 1;
    resize: none;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--color-primary); }

/* لوحة الإدارة: قائمة المحادثات + المحادثة النشطة */
.chat-admin-layout { display: flex; gap: 20px; align-items: flex-start; }
.chat-thread-list { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-thread-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}
.chat-thread-item:hover { border-color: rgba(var(--color-primary-rgb), 0.5); }
.chat-thread-item.active { border-color: var(--color-primary); background: rgba(var(--color-primary-rgb), 0.12); }
.chat-thread-item-name { font-weight: 700; }
.chat-thread-item-preview { font-size: 0.8rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-item-badge { position: absolute; top: 10px; inset-inline-end: 12px; }
.chat-admin-panel { flex: 1; min-width: 0; }
@media (max-width: 860px) {
    .chat-admin-layout { flex-direction: column; }
    .chat-thread-list { width: 100%; flex-direction: row; overflow-x: auto; }
    .chat-thread-item { min-width: 200px; }
}

/* الدردشة العائمة بلوحة المصور */
/* أي كلاس يحدد display (مثل .chat-widget-panel أو .alert) كان يتغلب على خاصية hidden
   الافتراضية للمتصفح، فتبقى اللوحة/رسالة الخطأ ظاهرة دائمًا ولا يعمل زر الإغلاق */
[hidden] { display: none !important; }
.chat-widget { position: fixed; inset-inline-end: 24px; bottom: 24px; z-index: 90; }
.chat-widget-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    box-shadow: var(--shadow-glow);
    font-size: 1.4rem;
    text-decoration: none;
}
.chat-widget-badge { position: absolute; top: -4px; inset-inline-end: -4px; }
.chat-widget-panel {
    position: absolute;
    bottom: 68px;
    inset-inline-end: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--color-bg-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chat-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
}
.chat-widget-header span:first-child { flex: 1; }
.chat-widget-fullpage { font-size: 0.75rem; color: var(--color-cyan); font-weight: 600; }
.chat-widget-close { background: none; border: none; color: var(--color-text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.chat-widget-thread { height: 280px; border-radius: 0; border: none; border-bottom: 1px solid var(--color-border); }
.chat-widget-error { margin: 0; padding: 8px 12px; font-size: 0.75rem; color: var(--color-danger-text); background: rgba(var(--color-danger-rgb), 0.12); }
.chat-widget-panel .chat-input-row { padding: 10px; }
.chat-widget-panel .chat-input-row textarea { min-height: 36px; }
@media (max-width: 480px) {
    .chat-widget { inset-inline-end: 16px; bottom: 16px; }
    .chat-widget-panel { width: calc(100vw - 32px); }
}
