/*
 * RIBHO Admin — Modern Corporate Theme
 * Loaded on top of Filament's stock CSS via a render hook (no build step).
 * Cosmetic overrides only: colors, borders, radii, shadows, spacing.
 * No structural (flex/margin/pseudo-element) hacks against Filament's
 * layout, so upgrades and edge cases stay stable.
 */

:root {
    --rb-blue: #2563eb;
    --rb-gradient: linear-gradient(90deg, #2563eb 0%, #0ea5e9 55%, #06d6f0 100%);
    --rb-side-bg: #0b1a3a;
    --rb-side-text: #dbe4f3;
    --rb-side-muted: #8193ba;
    --rb-bg: #f5f7fb;
    --rb-surface: #ffffff;
    --rb-ink: #0f172a;
    --rb-muted: #64748b;
    --rb-line: #e8ecf3;
    --rb-line-strong: #d9dfea;
    --rb-head-bg: #f4f6fb;
    --rb-row-hover: #f3f7ff;
    --rb-radius: 0.85rem;
    --rb-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.25);
}

/* ================================================== Shell */
.fi-main,
.fi-main-ctn,
.fi-page {
    max-width: 100% !important;
}

.fi-body {
    background-color: var(--rb-bg);
    color: var(--rb-ink);
}

/* ================================================== Topbar */
.fi-topbar > nav {
    background-color: var(--rb-surface) !important;
    border-bottom: 1px solid var(--rb-line) !important;
    box-shadow: none !important;
}

.fi-global-search .fi-input-wrp {
    background-color: var(--rb-bg) !important;
    border-radius: 0.75rem !important;
    box-shadow: none !important;
    min-width: 18rem;
}

.fi-global-search .fi-input-wrp:focus-within {
    border-color: var(--rb-blue) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.fi-topbar-database-notifications-btn {
    position: relative;
}

.fi-topbar-database-notifications-btn::after {
    content: "";
    position: absolute;
    top: 0.4rem;
    right: 0.45rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 9999px;
    background: #ef4444;
    box-shadow: 0 0 0 2px var(--rb-surface);
}

.fi-user-menu .fi-avatar {
    background: var(--rb-side-bg);
    box-shadow: 0 0 0 2px var(--rb-line);
}

/* ================================================== Sidebar */
.fi-sidebar {
    background-color: var(--rb-side-bg) !important;
    border-inline-end: none !important;
    background-image:
        radial-gradient(28rem 28rem at -10% 110%, rgba(37, 99, 235, 0.45), transparent 60%),
        radial-gradient(16rem 16rem at 110% 70%, rgba(6, 214, 240, 0.25), transparent 60%);
}

.fi-sidebar-header {
    background: var(--rb-side-bg) !important;
    box-shadow: none !important;
    --tw-ring-color: rgba(255, 255, 255, 0.06) !important;
}

.rb-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.rb-brand-mark {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.6rem;
    background: var(--rb-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 8px 18px -8px rgba(6, 214, 240, 0.9);
}

.rb-brand-name {
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.1;
}

.rb-brand-tagline {
    color: var(--rb-side-muted);
    font-size: 0.66rem;
    margin-top: 0.15rem;
}

/* Brand inside the white login card / topbar (when sidebar is collapsed) */
.fi-simple-header .rb-brand-name,
.fi-topbar .rb-brand-name {
    color: var(--rb-ink);
}

.fi-sidebar-group-label {
    color: var(--rb-side-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.66rem;
}

.fi-sidebar-item-label {
    color: var(--rb-side-text) !important;
}

.fi-sidebar-item-icon,
.fi-sidebar-group-icon,
.fi-sidebar-group-collapse-button {
    color: var(--rb-side-muted) !important;
}

.fi-sidebar-item-button {
    border-radius: 0.65rem !important;
}

.fi-sidebar-item-button:hover {
    background-color: rgba(255, 255, 255, 0.07) !important;
}

.fi-sidebar-item-button:hover .fi-sidebar-item-label,
.fi-sidebar-item-button:hover .fi-sidebar-item-icon {
    color: #fff !important;
}

.fi-sidebar-item-active > .fi-sidebar-item-button {
    background: var(--rb-gradient) !important;
    box-shadow: 0 10px 22px -10px rgba(6, 214, 240, 0.9);
}

.fi-sidebar-item-active .fi-sidebar-item-label,
.fi-sidebar-item-active .fi-sidebar-item-icon {
    color: #fff !important;
    font-weight: 600;
}

.fi-sidebar-item .fi-badge {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #fff !important;
    --tw-ring-color: transparent !important;
}

.rb-sidebar-footer {
    padding: 1rem 1.5rem 1.25rem;
}

.rb-sidebar-footer-text {
    color: var(--rb-side-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.rb-sidebar-footer-bar {
    width: 2rem;
    height: 3px;
    border-radius: 9999px;
    background: var(--rb-gradient);
    margin-top: 0.6rem;
}

/* ================================================== Page header */
.fi-breadcrumbs-item-label {
    color: var(--rb-muted);
}

.fi-header-heading {
    font-weight: 800 !important;
    letter-spacing: -0.03em;
    border-left: 4px solid var(--rb-blue);
    padding-left: 0.85rem;
    line-height: 1.15;
}

.fi-header-subheading {
    font-size: 0.9rem !important;
    color: var(--rb-muted) !important;
    padding-left: 1.1rem;
    margin-top: 0.4rem !important;
}

/* ================================================== Stat cards (custom widget) */
.rb-stats {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .rb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .rb-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.rb-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--rb-surface);
    border: 1px solid var(--rb-line);
    border-radius: var(--rb-radius);
    box-shadow: var(--rb-shadow);
}

.rb-stat-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.8rem;
    flex: none;
}

.rb-stat-blue .rb-stat-icon { background: #e8f0ff; color: #2563eb; }
.rb-stat-green .rb-stat-icon { background: #e6f9f0; color: #10b981; }
.rb-stat-amber .rb-stat-icon { background: #fff4e0; color: #f59e0b; }
.rb-stat-purple .rb-stat-icon { background: #efe9ff; color: #7c3aed; }

.rb-stat-green { background: linear-gradient(180deg, #f3fcf7, var(--rb-surface)); }
.rb-stat-amber { background: linear-gradient(180deg, #fff9ee, var(--rb-surface)); }
.rb-stat-purple { background: linear-gradient(180deg, #f7f4ff, var(--rb-surface)); }

.rb-stat-body { flex: 1 1 auto; min-width: 0; }

.rb-stat-delta {
    align-self: flex-start;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.rb-stat-green .rb-stat-delta { background: #dcfce7; color: #15803d; }
.rb-stat-amber .rb-stat-delta { background: #fef3c7; color: #b45309; }
.rb-stat-purple .rb-stat-delta { background: #ede9fe; color: #6d28d9; }

/* ================================================== Topbar user block */
.rb-user {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
    margin-inline-end: 0.25rem;
}

@media (min-width: 768px) {
    .rb-user { display: flex; }
}

.rb-user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--rb-ink);
}

.rb-user-role {
    font-size: 0.7rem;
    color: var(--rb-muted);
}

/* ================================================== Row actions (icon buttons) */
.fi-ta-actions .fi-icon-btn {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.6rem !important;
}

.fi-ta-actions .fi-icon-btn-color-primary { background: var(--rb-blue); color: #fff !important; }
.fi-ta-actions .fi-icon-btn-color-danger { background: #ef4444; color: #fff !important; }
.fi-ta-actions .fi-icon-btn-color-gray { background: var(--rb-surface); border: 1px solid var(--rb-line-strong); }
.fi-ta-actions .fi-icon-btn-color-primary:hover { background: #1d4ed8; }
.fi-ta-actions .fi-icon-btn-color-danger:hover { background: #dc2626; }

/* Name cell: role line under the name */
.rb-role-line {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    color: #b45309;
}

.rb-stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--rb-ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.rb-stat-label {
    color: var(--rb-muted);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* ================================================== Table card */
.fi-ta-ctn {
    border-radius: var(--rb-radius) !important;
    box-shadow: var(--rb-shadow) !important;
    --tw-ring-color: var(--rb-line) !important;
}

.fi-ta-header-heading {
    font-weight: 700 !important;
}

.fi-ta-header-description {
    color: var(--rb-muted) !important;
}

.fi-ta-search-field .fi-input-wrp {
    border-radius: 0.7rem !important;
    box-shadow: none !important;
    min-width: 16rem;
}

.fi-ta-search-field .fi-input-wrp:focus-within {
    border-color: var(--rb-blue) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.fi-ta-header-toolbar .fi-btn,
.fi-ta-header-toolbar .fi-icon-btn {
    border-radius: 0.7rem !important;
}

/* Table head */
.fi-ta-header-cell {
    background: var(--rb-head-bg) !important;
}

.fi-ta-header-cell-label {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rb-ink) !important;
}

.fi-ta-header-cell-sort-icon {
    color: var(--rb-blue) !important;
}

/* Vertical gridlines between cells */
.fi-ta-table td:not(:last-child),
.fi-ta-table th:not(:last-child) {
    border-right: 1px solid var(--rb-line);
}

.fi-ta-row:hover {
    background-color: var(--rb-row-hover) !important;
}

.fi-ta-text-item-label {
    font-size: 0.8125rem !important;
}

.fi-ta-image img {
    box-shadow: 0 0 0 2px var(--rb-line);
}

.fi-badge {
    border-radius: 0.5rem !important;
}

/* Row actions */
.fi-ta-actions .fi-btn {
    border-radius: 0.55rem !important;
    box-shadow: none !important;
}

.fi-ta-actions .fi-btn.fi-btn-outlined {
    color: var(--rb-blue) !important;
    --tw-ring-color: var(--rb-line-strong) !important;
}

.fi-ta-actions .fi-btn.fi-btn-outlined:hover {
    background: #e8f0ff !important;
}

.fi-ta-actions .fi-dropdown-trigger .fi-icon-btn {
    --tw-ring-color: var(--rb-line-strong);
    box-shadow: 0 0 0 1px var(--tw-ring-color);
    border-radius: 0.55rem;
}

/* Pagination */
.fi-ta-pagination {
    color: var(--rb-muted);
}

.fi-pagination-item,
.fi-pagination-previous-btn,
.fi-pagination-next-btn {
    border-radius: 0.55rem !important;
}

.fi-pagination-item-active {
    background: var(--rb-blue) !important;
    color: #fff !important;
}

.fi-pagination-item-active .fi-pagination-item-label {
    color: #fff !important;
}

/* ================================================== Buttons & inputs (global) */
.fi-btn {
    border-radius: 0.65rem !important;
}

.fi-btn.fi-color-primary:not(.fi-btn-outlined),
.fi-ac-btn-action.fi-color-primary:not(.fi-btn-outlined) {
    background: var(--rb-gradient) !important;
    box-shadow: 0 10px 22px -10px rgba(37, 99, 235, 0.9) !important;
    --tw-ring-color: transparent !important;
}

.fi-btn.fi-color-primary:hover {
    filter: brightness(1.06);
}

.fi-input-wrp {
    border-radius: 0.65rem !important;
}

.fi-input-wrp:focus-within {
    border-color: var(--rb-blue) !important;
    --tw-ring-color: rgba(37, 99, 235, 0.35) !important;
}

.fi-section,
.fi-fo-section,
.fi-wi-widget > .fi-section {
    border-radius: var(--rb-radius) !important;
    box-shadow: var(--rb-shadow) !important;
    --tw-ring-color: var(--rb-line) !important;
}

/* ================================================== Footer */
.rb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem 0.25rem;
    border-top: 1px solid var(--rb-line);
    font-size: 0.75rem;
    color: var(--rb-muted);
}

.rb-footer strong {
    color: var(--rb-ink);
}

.rb-footer-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rb-footer-right a {
    color: var(--rb-blue);
    text-decoration: none;
}

.rb-footer-right a:hover {
    text-decoration: underline;
}

.rb-footer-sep {
    width: 1px;
    height: 1rem;
    background: var(--rb-line-strong);
}

.rb-heart {
    color: #ec4899;
}

/* ================================================== Login */
.fi-simple-layout {
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(37, 99, 235, 0.14), transparent 60%),
        radial-gradient(800px 450px at 100% 0%, rgba(6, 214, 240, 0.14), transparent 55%),
        var(--rb-bg);
}

.fi-simple-main {
    border-radius: 1rem !important;
    box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.45) !important;
    --tw-ring-color: var(--rb-line) !important;
    border-top: 4px solid var(--rb-blue) !important;
}

/* ================================================== Dashboard overview cards */
@media (min-width: 1280px) {
    .rb-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

a.rb-stat { text-decoration: none; color: inherit; transition: transform 120ms ease, box-shadow 120ms ease; }
a.rb-stat:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -16px rgba(15, 23, 42, 0.35); }

.rb-stat-sub { color: var(--rb-muted); font-size: 0.7rem; margin-top: 0.2rem; }

/* ================================================== Compact mode */
/* Sidebar: tighter rows, smaller type, clear group headers */
.fi-sidebar-nav { padding-top: 0.5rem !important; gap: 0.35rem !important; }
.fi-sidebar-nav-groups { gap: 0.35rem !important; }
.fi-sidebar-group-items { gap: 0.1rem !important; }
.fi-sidebar-item-button { padding: 0.4rem 0.6rem !important; gap: 0.55rem !important; }
.fi-sidebar-item-label { font-size: 0.8rem !important; line-height: 1.2; }
.fi-sidebar-item-icon { width: 1.1rem !important; height: 1.1rem !important; }
.fi-sidebar-group-button { padding: 0.35rem 0.6rem !important; border-radius: 0.5rem; }
.fi-sidebar-group-button:hover { background: rgba(255, 255, 255, 0.05); }
.fi-sidebar-group-label { font-size: 0.62rem !important; letter-spacing: 0.12em; }
.fi-sidebar-group-icon { width: 0.95rem !important; height: 0.95rem !important; }
.fi-sidebar-group-collapse-button { width: 1.4rem !important; height: 1.4rem !important; }
.fi-sidebar-item .fi-badge { font-size: 0.62rem !important; padding: 0.05rem 0.4rem !important; min-height: 0 !important; }
.fi-sidebar-header { height: 3.5rem !important; }
.rb-brand-mark { width: 1.85rem; height: 1.85rem; font-size: 0.9rem; }
.rb-brand-name { font-size: 0.92rem; }
.rb-sidebar-footer { padding: 0.75rem 1rem 1rem; }
.rb-sidebar-footer-text { font-size: 0.7rem; }

/* Collapsed (icon-only) sidebar */
.fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item-button { justify-content: center; padding: 0.5rem !important; }
.fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-group-button { justify-content: center; }

/* Topbar & page header */
.fi-topbar > nav { height: 3.5rem !important; padding-block: 0 !important; }
.fi-main { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
.fi-page > .fi-page-header-main-ctn, .fi-page { gap: 1rem !important; }
.fi-header { padding-top: 0.25rem !important; padding-bottom: 0.5rem !important; }
.fi-header-heading { font-size: 1.25rem !important; border-left-width: 3px; padding-left: 0.65rem; }
.fi-header-subheading { font-size: 0.8rem !important; margin-top: 0.25rem !important; padding-left: 0.85rem; }
.fi-breadcrumbs { margin-bottom: 0.25rem !important; }
.fi-breadcrumbs-item-label, .fi-breadcrumbs-item-separator { font-size: 0.72rem !important; }
.fi-header .fi-btn { font-size: 0.8rem !important; padding: 0.4rem 0.75rem !important; }

/* Stat cards */
.rb-stats { gap: 0.75rem; }
.rb-stat { padding: 0.75rem 0.9rem; gap: 0.75rem; }
.rb-stat-icon { width: 2.4rem; height: 2.4rem; border-radius: 0.65rem; }
.rb-stat-icon svg { width: 1.2rem; height: 1.2rem; }
.rb-stat-value { font-size: 1.15rem; }
.rb-stat-label { font-size: 0.74rem; margin-top: 0.05rem; }

/* Tables */
.fi-ta-header { padding: 0.65rem 1rem !important; gap: 0.5rem !important; }
.fi-ta-header-heading { font-size: 0.9rem !important; }
.fi-ta-header-description { font-size: 0.74rem !important; }
.fi-ta-header-toolbar { padding: 0.5rem 1rem !important; }
.fi-ta-search-field .fi-input-wrp { min-width: 13rem; }
.fi-ta-header-cell { padding: 0.45rem 0.75rem !important; }
.fi-ta-header-cell-label { font-size: 0.64rem !important; }
.fi-ta-cell > * { padding: 0.45rem 0.75rem !important; }
.fi-ta-text-item-label, .fi-ta-text { font-size: 0.8rem !important; }
.fi-ta-image img, .fi-ta-image div { width: 1.75rem !important; height: 1.75rem !important; }
.fi-badge { font-size: 0.68rem !important; padding: 0.1rem 0.45rem !important; min-height: 0 !important; }
.fi-ta-actions .fi-btn { font-size: 0.74rem !important; padding: 0.3rem 0.6rem !important; }
.fi-ta-actions .fi-icon-btn { width: 1.9rem !important; height: 1.9rem !important; }
.fi-ta-pagination { padding: 0.5rem 1rem !important; font-size: 0.74rem; }
.fi-pagination-item, .fi-pagination-previous-btn, .fi-pagination-next-btn { min-width: 1.9rem !important; height: 1.9rem !important; font-size: 0.76rem !important; }
.fi-tabs { padding: 0.25rem !important; gap: 0.15rem !important; }
.fi-tabs-item { padding: 0.35rem 0.7rem !important; font-size: 0.78rem !important; }
.fi-tabs-item-label { font-size: 0.78rem !important; }

/* Forms & sections */
.fi-section-header { padding: 0.75rem 1rem !important; }
.fi-section-header-heading { font-size: 0.92rem !important; }
.fi-section-content { padding: 0.9rem 1rem !important; }
.fi-fo-field-wrp-label .fi-fo-field-wrp-label-text, .fi-fo-field-wrp-label { font-size: 0.78rem !important; }
.fi-input, .fi-select-input { font-size: 0.82rem !important; padding-top: 0.4rem !important; padding-bottom: 0.4rem !important; }
.fi-fo-field-wrp-hint { font-size: 0.68rem !important; }
.fi-btn { font-size: 0.8rem !important; padding: 0.42rem 0.8rem !important; }
.fi-btn.fi-size-sm { font-size: 0.74rem !important; padding: 0.3rem 0.6rem !important; }
.fi-modal-header { padding: 0.9rem 1.25rem !important; }
.fi-modal-content { padding: 1rem 1.25rem !important; }

/* Widgets */
.fi-wi-widget .fi-section-header, .fi-wi-chart .fi-section-header { padding: 0.6rem 1rem !important; }
.fi-wi-chart canvas { max-height: 220px; }

/* Footer */
.rb-footer { margin-top: 1.25rem; padding: 0.75rem 0.25rem; font-size: 0.7rem; }
