/**
 * Rica admin — نفس هوية التطبيق (أزرق #04091b / #0B2A4A + ذهبي #D0AF37)
 * يُحمَّل بعد ثيم Filament (STYLES_AFTER) ليكون له الأولوية.
 */

.fi-panel-admin .fi-logo img {
    height: 3.25rem !important;
    width: auto !important;
    object-fit: contain;
    filter: drop-shadow(0 2px 14px rgba(208, 175, 55, 0.35));
}
:root {
    --rica-bg: #04091b;
    --rica-bg-glow: #0c346b;
    --rica-surface: #0b2a4a;
    --rica-surface-dark: #061c33;
    --rica-gold: #d0af37;
    --rica-gold-light: #e0c66a;
    --rica-gold-dark: #a88924;
    --rica-text: #f5f7fa;
    --rica-text-muted: rgba(245, 247, 250, 0.72);
    --rica-border: rgba(208, 175, 55, 0.22);
    --rica-border-strong: rgba(208, 175, 55, 0.45);
    --rica-glass: rgba(11, 42, 74, 0.55);
}

/* خلفية عامة + توهج ذهبي (مثل GlobalBackground في Flutter) */
html,
body.fi-body {
    background: radial-gradient(
            ellipse 120% 80% at 20% -10%,
            var(--rica-bg-glow) 0%,
            var(--rica-bg) 55%
        )
        fixed !important;
    color: var(--rica-text);
}

.rica-ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.rica-ambient-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
}

.rica-ambient-bg__orb--gold-tr {
    width: min(55vw, 420px);
    height: min(55vw, 420px);
    top: -8%;
    right: -12%;
    background: radial-gradient(circle, rgba(208, 175, 55, 0.14) 0%, transparent 70%);
}

.rica-ambient-bg__orb--gold-bl {
    width: min(50vw, 380px);
    height: min(50vw, 380px);
    bottom: -5%;
    left: -15%;
    background: radial-gradient(circle, rgba(208, 175, 55, 0.1) 0%, transparent 70%);
}

.rica-ambient-bg__orb--blue {
    width: min(70vw, 520px);
    height: min(70vw, 520px);
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(11, 42, 74, 0.35) 0%, transparent 65%);
}

.fi-layout,
.fi-main-ctn,
.fi-simple-layout {
    position: relative;
    z-index: 1;
}

/* شعار العلامة */
.rica-brand-logo {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rica-brand-logo__glow {
    position: absolute;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(208, 175, 55, 0.35) 0%, transparent 70%);
    box-shadow: 0 0 28px rgba(208, 175, 55, 0.25);
}

.rica-brand-logo__img {
    position: relative;
    z-index: 1;
    width: auto;
    height: 2.75rem;
    object-fit: contain;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.35));
}

.rica-brand-logo--large .rica-brand-logo__glow {
    width: 7rem;
    height: 7rem;
    box-shadow: 0 0 48px rgba(208, 175, 55, 0.35);
}

.rica-brand-logo--large .rica-brand-logo__img {
    height: 5.5rem;
}

.fi-logo.fi-logo-dark,
.fi-logo.fi-logo-light {
    height: auto !important;
}

.fi-sidebar-header .fi-logo,
.fi-topbar .fi-logo {
    margin-inline: 0.25rem;
}

/* شريط علوي + جانبي */
.fi-topbar {
    background: rgba(4, 9, 27, 0.88) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--rica-border) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.fi-sidebar {
    background: linear-gradient(180deg, rgba(6, 28, 51, 0.98) 0%, rgba(4, 9, 27, 0.98) 100%) !important;
    border-inline-end: 1px solid var(--rica-border) !important;
}

.fi-sidebar-header {
    border-bottom: 1px solid var(--rica-border);
    padding-block: 1rem !important;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: linear-gradient(90deg, rgba(208, 175, 55, 0.18) 0%, rgba(11, 42, 74, 0.5) 100%) !important;
    border-inline-start: 3px solid var(--rica-gold);
}

.fi-sidebar-item-btn:hover {
    background: rgba(11, 42, 74, 0.65) !important;
}

.fi-sidebar-item-label,
.fi-sidebar-group-label {
    color: var(--rica-text) !important;
}

/* المحتوى الرئيسي */
.fi-main {
    background: transparent !important;
}

.fi-page header .fi-header-heading,
.fi-simple-header-heading {
    color: var(--rica-text) !important;
    font-weight: 800;
}

.fi-section,
.fi-fo-section {
    background: var(--rica-glass) !important;
    border: 1px solid var(--rica-border) !important;
    border-radius: 0.875rem !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.fi-section-header-heading,
.fi-fo-section-header-heading {
    color: var(--rica-gold-light) !important;
}

/* جداول */
.fi-ta-ctn {
    border: 1px solid var(--rica-border);
    border-radius: 0.875rem;
    overflow: hidden;
    background: rgba(4, 9, 27, 0.6);
}

.fi-ta-header-cell {
    background: rgba(11, 42, 74, 0.85) !important;
    color: var(--rica-gold-light) !important;
}

.fi-ta-row {
    border-color: rgba(208, 175, 55, 0.08) !important;
}

.fi-ta-row:hover {
    background: rgba(11, 42, 74, 0.45) !important;
}

/* حقول ونماذج */
.fi-input-wrp,
.fi-fo-text-input input,
.fi-select-input,
textarea.fi-input {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: var(--rica-border) !important;
    color: var(--rica-text) !important;
}

.fi-input-wrp:focus-within {
    border-color: var(--rica-border-strong) !important;
    box-shadow: 0 0 0 2px rgba(208, 175, 55, 0.15);
}

/* أزرار */
.fi-btn.fi-btn-color-primary {
    background: linear-gradient(135deg, var(--rica-gold) 0%, var(--rica-gold-dark) 100%) !important;
    border-color: var(--rica-gold-dark) !important;
    color: var(--rica-bg) !important;
    font-weight: 700;
}

.fi-btn.fi-btn-color-primary:hover {
    background: linear-gradient(135deg, var(--rica-gold-light) 0%, var(--rica-gold) 100%) !important;
}

.fi-btn.fi-btn-color-gray {
    border-color: var(--rica-border) !important;
    color: var(--rica-text-muted) !important;
}

/* صفحة الدخول */
.fi-simple-layout {
    min-height: 100dvh;
}

.fi-simple-page {
    background: var(--rica-glass) !important;
    border: 1px solid var(--rica-border-strong) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(208, 175, 55, 0.08) inset;
    backdrop-filter: blur(16px);
}

.fi-simple-header .rica-brand-logo__glow {
    width: 6.5rem;
    height: 6.5rem;
    box-shadow: 0 0 52px rgba(208, 175, 55, 0.38);
}

.fi-simple-header .rica-brand-logo__img {
    height: 5rem;
}

.fi-simple-page .fi-logo,
.fi-simple-header .fi-logo {
    margin-bottom: 0.75rem;
}

.fi-simple-page .fi-simple-header-heading {
    font-size: 1.35rem;
}

/* لوحة التحكم — شبكة مربعين */
.rica-hub-wrap {
    max-width: 36rem;
    margin-inline: auto;
}

.rica-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    align-items: stretch;
}

.rica-hub-grid__title {
    grid-column: 1 / -1;
    margin: 0 0 0.25rem;
    padding: 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--rica-gold-light);
    background: none;
    border: none;
    box-shadow: none;
}

.rica-hub-card--wide {
    grid-column: 1 / -1;
}

@media (min-width: 520px) {
    .rica-hub-wrap {
        max-width: 42rem;
    }

    .rica-hub-grid {
        gap: 0.85rem;
    }
}

button.rica-hub-card {
    cursor: pointer;
    font: inherit;
}

.rica-hub-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.25rem;
    min-height: 4.75rem;
    width: 100%;
    padding: 0.85rem 0.9rem;
    border-radius: 0.875rem;
    text-decoration: none;
    color: var(--rica-text) !important;
    background: linear-gradient(135deg, rgba(11, 42, 74, 0.92) 0%, rgba(6, 28, 51, 0.95) 100%);
    border: 1px solid var(--rica-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

a.rica-hub-card:hover,
button.rica-hub-card:hover {
    transform: translateY(-2px);
    border-color: var(--rica-border-strong);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35), 0 0 24px rgba(208, 175, 55, 0.08);
}

.rica-hub-card--muted {
    cursor: default;
    opacity: 0.9;
    background: rgba(11, 42, 74, 0.4);
}

.rica-hub-card--outline {
    background: rgba(4, 9, 27, 0.35);
    border-style: dashed;
}

.rica-hub-emoji {
    font-size: 1.35rem;
    line-height: 1.2;
}

.rica-hub-label {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.rica-hub-hint {
    font-size: 0.8rem;
    color: var(--rica-text-muted);
}

/* إشعارات */
.fi-no-notification {
    color: var(--rica-text-muted);
}

/* قائمة المستخدمين على الموبايل — رجوع وإلغاء البحث */
@media (max-width: 768px) {
    .fi-resource-list-records-page .fi-header {
        position: sticky;
        top: 0;
        z-index: 50;
        padding-bottom: 0.5rem;
        background: linear-gradient(
            180deg,
            rgba(4, 9, 27, 0.98) 0%,
            rgba(4, 9, 27, 0.92) 85%,
            transparent 100%
        );
    }

    .fi-resource-list-records-page .fi-header-actions {
        flex-wrap: wrap;
        gap: 0.45rem;
        width: 100%;
    }

    .fi-resource-list-records-page .fi-header-actions .fi-btn {
        min-height: 2.75rem;
        flex: 1 1 auto;
    }

    .fi-resource-list-records-page .rica-admin-hub-back {
        flex: 1 1 100%;
        justify-content: center;
    }

    /* شارة «بحث: …» — زر الإزالة أوضح للمس */
    .fi-ta-header-toolbar .fi-badge,
    .fi-ta-indicators .fi-badge {
        font-size: 0.9rem;
        padding: 0.35rem 0.5rem;
    }

    .fi-ta-indicators .fi-badge button,
    .fi-ta-indicators .fi-badge [type='button'] {
        min-width: 2.75rem;
        min-height: 2.75rem;
        margin-inline-start: 0.25rem;
    }
}

/* ─── سلاسة الأداء (SPA + موبايل) ─────────────────────────────────────── */

html {
    scroll-behavior: smooth;
}

.fi-main {
    -webkit-overflow-scrolling: touch;
}

.rica-hub-card,
.fi-btn,
.fi-sidebar-item-btn {
    touch-action: manipulation;
}

/* تقليل ضغط GPU على الشاشات الصغيرة */
@media (max-width: 768px) {
    .rica-ambient-bg__orb {
        filter: blur(36px);
        opacity: 0.75;
    }

    .rica-ambient-bg__orb--blue {
        display: none;
    }

    .fi-topbar {
        backdrop-filter: none !important;
        background: rgba(4, 9, 27, 0.97) !important;
    }

    .fi-simple-page {
        backdrop-filter: none !important;
        background: rgba(11, 42, 74, 0.92) !important;
    }

    .fi-section,
    .fi-fo-section {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .rica-hub-card,
    .fi-btn,
    .fi-sidebar-item-btn {
        transition: none !important;
    }

    .rica-ambient-bg__orb {
        filter: none;
    }
}
