/* ==========================================================================
   Palift ERP — Custom Theme
   Matches the Palift ERP UI System Design prototype exactly.
   Applied via ->stylesheet() on top of Filament's default CSS.
   Colors: #252523 (sidebar), #921A1D (brand red), #f3f1ee (bg)
   Fonts:  Cairo (body), Josefin Sans (headings/numbers)
   ========================================================================== */

/* ── 1. FONTS ─────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Josefin+Sans:wght@400;500;600;700&display=swap');

html, body,
.fi-body,
.fi-body *,
input, select, textarea, button {
    font-family: 'Cairo', Arial, Helvetica, sans-serif !important;
}

/* ── 2. BODY BACKGROUND ────────────────────────────────────────────────────── */
body {
    background-color: #f3f1ee !important;
}

/* ── 3. SIDEBAR — Dark background ──────────────────────────────────────────── */
/* The sidebar element itself */
.fi-sidebar {
    background-color: #252523 !important;
    border-right: 1px solid #34332f !important;
}

/* Filament adds lg:bg-transparent which overrides bg. This counter-override handles that. */
@media (min-width: 1024px) {
    .fi-sidebar {
        background-color: #252523 !important;
    }
}

/* Sidebar header (logo area) */
.fi-sidebar-header {
    background-color: #252523 !important;
    border-bottom: 1px solid #34332f !important;
    box-shadow: none !important;
    --tw-ring-opacity: 0 !important;
}

/* Make the shadow/ring disappear on light mode sidebar header */
.fi-sidebar-header::after,
.fi-sidebar-header::before {
    display: none !important;
}

/* Sidebar logo — invert to white on dark background */
.fi-sidebar-header .fi-logo img,
.fi-sidebar-header a img {
    filter: brightness(0) invert(1) !important;
}

/* ── 4. SIDEBAR NAV — Group Labels ─────────────────────────────────────────── */
.fi-sidebar-group-label {
    color: #75736d !important;
    font-size: 10.5px !important;
    letter-spacing: 1.4px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
}

/* ── 5. SIDEBAR NAV — Item buttons ─────────────────────────────────────────── */
.fi-sidebar-item-button {
    border-radius: 8px !important;
    position: relative !important;
    overflow: hidden !important;
    margin-bottom: 2px;
}

/* Active left-bar indicator (3 px red stripe on the start edge) */
.fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background-color: #921A1D;
}

/* Inactive label */
.fi-sidebar-item-label {
    color: #b4b1ab !important;
    font-size: 13.5px !important;
    font-weight: 400 !important;
}

/* Inactive icon */
.fi-sidebar-item-icon {
    color: #8d8a84 !important;
}

/* Hover */
.fi-sidebar-item-button:hover {
    background-color: #33322f !important;
}
.fi-sidebar-item-button:hover .fi-sidebar-item-label {
    color: #e0ddd8 !important;
}
.fi-sidebar-item-button:hover .fi-sidebar-item-icon {
    color: #c8c4bd !important;
}

/* Active item */
.fi-sidebar-item.fi-active .fi-sidebar-item-button,
.fi-sidebar-item.fi-sidebar-item-active .fi-sidebar-item-button {
    background-color: #33322f !important;
}
.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-sidebar-item-active .fi-sidebar-item-label {
    color: #ffffff !important;
    font-weight: 600 !important;
}
.fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.fi-sidebar-item.fi-sidebar-item-active .fi-sidebar-item-icon {
    color: #ffffff !important;
}

/* Sub-group border lines for grouped children */
.fi-sidebar-item-grouped-border div {
    background-color: #44433f !important;
}

/* ── 6. SIDEBAR USER MENU (footer) ─────────────────────────────────────────── */
.fi-sidebar-user-menu,
.fi-user-avatar {
    background-color: #921A1D !important;
}

/* ── 7. TOPBAR ──────────────────────────────────────────────────────────────── */
.fi-topbar nav {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e7e4df !important;
    box-shadow: none !important;
    --tw-shadow: none !important;
    --tw-ring-opacity: 0 !important;
}

/* Search input in topbar */
.fi-global-search-field {
    background-color: #f3f1ee !important;
    border-color: #e7e4df !important;
    border-radius: 8px !important;
}

/* ── 8. MAIN CONTENT AREA ───────────────────────────────────────────────────── */
.fi-main-ctn {
    background-color: #f3f1ee !important;
}

.fi-main {
    background-color: #f3f1ee;
}

/* Page background */
.fi-page {
    background-color: #f3f1ee;
}

/* ── 9. PAGE HEADER ─────────────────────────────────────────────────────────── */
.fi-header-heading {
    font-family: 'Josefin Sans', 'Cairo', sans-serif !important;
    font-weight: 600 !important;
    font-size: 1.15rem !important;
    color: #252523 !important;
    letter-spacing: -0.01em !important;
}

.fi-header-subheading {
    color: #8a8780 !important;
}

/* Breadcrumb */
.fi-breadcrumbs a,
.fi-breadcrumbs li {
    color: #a8a49d !important;
    font-size: 12px !important;
}
.fi-breadcrumbs li:last-child a {
    color: #6f6c66 !important;
}

/* ── 10. WIDGET CARDS ──────────────────────────────────────────────────────── */
/* Generic widget wrapper */
.fi-wi > div,
.fi-wi-card,
[class*="fi-wi"] > div:first-child {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    --tw-shadow: none !important;
    --tw-ring-opacity: 0 !important;
}

/* Stats overview individual stats */
.fi-wi-stats-overview-stat {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    padding: 18px 20px !important;
}

/* Stat value — use Josefin Sans + big number look */
.fi-wi-stats-overview-stat-value {
    font-family: 'Josefin Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.875rem !important;
    color: #252523 !important;
    line-height: 1.15 !important;
    margin-top: 10px !important;
}

/* Stat label */
.fi-wi-stats-overview-stat-label {
    font-size: 12.5px !important;
    color: #8a8780 !important;
    font-weight: 600 !important;
}

/* Stat description (delta) */
.fi-wi-stats-overview-stat-description {
    font-size: 12px !important;
    margin-top: 7px !important;
}

/* ── 11. TABLE STYLES ──────────────────────────────────────────────────────── */
/* Table container */
.fi-ta {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

/* Table header cells */
.fi-ta-header-cell {
    background-color: #faf9f7 !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    color: #a8a49d !important;
    text-transform: uppercase !important;
    border-bottom: 1px solid #f0eeea !important;
    padding: 12px 20px !important;
}

/* Table rows */
.fi-ta-row td {
    border-bottom: 1px solid #f5f3f0 !important;
    padding: 14px 20px !important;
    font-size: 13px !important;
    color: #3f3e3a !important;
}

/* Table row hover */
.fi-ta-row:hover td {
    background-color: #faf9f7 !important;
}

/* Table cell text */
.fi-ta-cell-content {
    color: #3f3e3a !important;
}

/* Table filter bar */
.fi-ta-filters-ctn {
    background-color: #faf9f7 !important;
    border-bottom: 1px solid #f0eeea !important;
}

/* Table search */
.fi-ta-search-field-ctn input {
    background-color: #f3f1ee !important;
    border-color: #e7e4df !important;
    border-radius: 8px !important;
    font-size: 13px !important;
}

/* ── 12. BADGES ─────────────────────────────────────────────────────────────── */
.fi-badge {
    font-weight: 700 !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
}

/* Success/Active */
.fi-badge-color-success,
[class*="bg-success"] .fi-badge {
    background-color: #e7f3ec !important;
    color: #1f7a4d !important;
}

/* Warning/Expiring */
.fi-badge-color-warning,
[class*="bg-warning"] .fi-badge {
    background-color: #faf3e0 !important;
    color: #9a6b00 !important;
}

/* Danger/Expired/Overdue */
.fi-badge-color-danger,
[class*="bg-danger"] .fi-badge {
    background-color: #f7e9e9 !important;
    color: #921A1D !important;
}

/* Gray/Info */
.fi-badge-color-gray {
    background-color: #f0eeea !important;
    color: #6f6c66 !important;
}

/* ── 13. BUTTONS ─────────────────────────────────────────────────────────────── */
/* Primary button */
.fi-btn-color-primary {
    background-color: #921A1D !important;
    border-color: #921A1D !important;
    color: #ffffff !important;
}
.fi-btn-color-primary:hover {
    background-color: #7a1619 !important;
    border-color: #7a1619 !important;
}

/* ── 14. FORM FIELDS ─────────────────────────────────────────────────────────── */
/* Input borders */
.fi-fo-field-wrp input,
.fi-fo-field-wrp select,
.fi-fo-field-wrp textarea {
    border-color: #e2dfd9 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    background-color: #fbfaf8 !important;
    color: #252523 !important;
}

/* Input focus */
.fi-fo-field-wrp input:focus,
.fi-fo-field-wrp select:focus,
.fi-fo-field-wrp textarea:focus {
    border-color: #921A1D !important;
    --tw-ring-color: rgba(146, 26, 29, 0.1) !important;
}

/* Form section headings */
.fi-fo-section-header-heading {
    font-family: 'Josefin Sans', 'Cairo', sans-serif !important;
    font-weight: 600 !important;
    color: #252523 !important;
    font-size: 14px !important;
}

/* Form card / section card */
.fi-fo-section-content-ctn {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
}

/* ── 15. CARDS & PANELS ──────────────────────────────────────────────────────── */
/* Filament card component */
.fi-card {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

/* ── 16. CHART WIDGET ────────────────────────────────────────────────────────── */
.fi-wi-chart > div {
    background-color: #ffffff !important;
    border: 1px solid #e7e4df !important;
    border-radius: 12px !important;
}

.fi-wi-chart-heading {
    font-family: 'Josefin Sans', 'Cairo', sans-serif !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #252523 !important;
}

/* ── 17. WIDGET TABLE HEADINGS ───────────────────────────────────────────────── */
.fi-wi-table-heading {
    font-family: 'Josefin Sans', 'Cairo', sans-serif !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #252523 !important;
    padding: 20px 22px !important;
}

/* ── 18. NAVIGATION TABS (resource sub-pages) ───────────────────────────────── */
.fi-tabs-tab {
    font-weight: 600 !important;
    font-size: 13.5px !important;
}
.fi-tabs-tab[aria-selected="true"] {
    color: #921A1D !important;
    border-bottom-color: #921A1D !important;
}

/* ── 19. SIMPLE PAGE (Login) — right panel / form side ─────────────────────── */
/* When the dark left panel is present, push the form to the right half */
body:has(.palift-login-left) .fi-simple-layout {
    min-height: 100vh !important;
    background: #ffffff !important;
    padding: 0 !important;
    /* Leave left 50% for the fixed dark panel */
    padding-left: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* RTL: dark panel is on the right, form on the left */
html[dir="rtl"] body:has(.palift-login-left) .fi-simple-layout {
    padding-left: 0 !important;
    padding-right: 50% !important;
}

body:has(.palift-login-left) .fi-simple-main-ctn {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body:has(.palift-login-left) .fi-simple-main {
    width: 100% !important;
    max-width: 440px !important;
    min-height: unset !important;
    margin: 0 auto !important;
    padding: 48px 40px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    --tw-ring-opacity: 0 !important;
    background-color: #ffffff !important;
}

/* Default logo handling is now entirely managed in AdminPanelProvider.php */

.fi-simple-header {
    margin-bottom: 20px !important;
}

/* Login submit button */
.fi-simple-page .fi-btn-color-primary {
    width: 100% !important;
    background-color: #921A1D !important;
    border-color: #921A1D !important;
    border-radius: 8px !important;
    height: 48px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    margin-top: 26px !important;
}

/* ── 20. LOGIN LEFT PANEL (fixed, injected at BODY_START) ────────────────────── */
.palift-login-left {
    position: fixed;
    top: 0;
    left: 0;
    width: 50%;
    height: 100vh;
    background: #252523;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    z-index: 50;
    box-sizing: border-box;
}

/* RTL: fixed on the right */
html[dir="rtl"] .palift-login-left {
    left: auto;
    right: 0;
}

.palift-login-left-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.palift-login-left-logo {
    display: flex;
    align-items: center;
}

.palift-login-left-logo img {
    height: 224px;
    width: auto;
    display: block;
}

/* Lang toggle inside the dark panel */
.palift-login-lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 42px;
    padding: 0 10px;
    border: 1.5px solid #921A1D;
    border-radius: 6px;
    background: transparent;
    color: #921A1D;
    font-family: 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.palift-login-lang-toggle:hover {
    background: rgba(146, 26, 29, 0.18);
    border-color: #921A1D;
}

.palift-login-left-hero {
    position: relative;
    z-index: 1;
}

.palift-login-left-hero-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 36px;
    line-height: 1.25;
    color: #ffffff;
    text-align: left;
}

.palift-login-left-hero-sub {
    margin-top: 16px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    color: #b4b1ab;
    max-width: 360px;
    line-height: 1.75;
    text-align: left;
}

.palift-login-left-stats {
    display: flex;
    gap: 28px;
    margin-top: 32px;
}

.palift-login-left-stat-val {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #921A1D;
}

.palift-login-left-stat-label {
    font-size: 11px;
    color: #8d8a84;
    margin-top: 2px;
    text-align: left;
}

.palift-login-left-footer {
    position: relative;
    z-index: 1;
    font-size: 11px;
    color: #6f6c66;
}

/* Responsive: hide dark panel on small screens */
@media (max-width: 768px) {
    .palift-login-left {
        display: none;
    }
    body:has(.palift-login-left) .fi-simple-layout {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ── 21. PAGINATION ──────────────────────────────────────────────────────────── */
.fi-pagination-item-btn[aria-current="page"] {
    background-color: #921A1D !important;
    color: #ffffff !important;
    border-color: #921A1D !important;
}

/* ── 22. NOTIFICATIONS ──────────────────────────────────────────────────────── */
.fi-notification {
    border-radius: 12px !important;
    border: 1px solid #e7e4df !important;
    box-shadow: 0 4px 16px rgba(37, 37, 35, 0.1) !important;
}

/* ── 23. SCROLLBAR STYLING ──────────────────────────────────────────────────── */
.fi-sidebar-nav::-webkit-scrollbar { width: 10px; height: 10px; }
.fi-sidebar-nav::-webkit-scrollbar-thumb { background: #3a3a37; border-radius: 8px; border: 3px solid #252523; background-clip: content-box; }
.fi-sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* ── 24. MODAL / DIALOG ──────────────────────────────────────────────────────── */
.fi-modal-window {
    border-radius: 12px !important;
    border: 1px solid #e7e4df !important;
}

/* ── 25. DROPDOWN ─────────────────────────────────────────────────────────────── */
.fi-dropdown-panel {
    border: 1px solid #e7e4df !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(37, 37, 35, 0.12) !important;
}

/* ── 26. SELECT DROPDOWN ITEMS ───────────────────────────────────────────────── */
.fi-select-option:hover {
    background-color: #f3f1ee !important;
}

/* ── 27. ACTION GROUP BUTTON ─────────────────────────────────────────────────── */
.fi-ac-action-group-trigger-btn {
    color: #6f6c66 !important;
}

/* ── 28. TOP HEADER BREADCRUMB + TITLE AREA ─────────────────────────────────── */
.fi-breadcrumbs {
    font-size: 12px !important;
}

/* ── 29. RESOURCE PAGE LAYOUT CLEANUP ────────────────────────────────────────── */
/* Resource list page */
.fi-resource-list-page,
.fi-resource-create-page,
.fi-resource-edit-page,
.fi-resource-view-page {
    background: #f3f1ee;
}

/* ── 30. LIGHT MODE FORCE (in case dark mode toggled) ───────────────────────── */
/* Palift always uses light main area; sidebar is always dark */
.dark .fi-main-ctn,
.dark .fi-main,
.dark .fi-page {
    background-color: #f3f1ee !important;
}
.dark .fi-topbar nav {
    background-color: #ffffff !important;
}

/* ── 31. LANGUAGE TOGGLE BUTTON ─────────────────────────────────────────────── */
.palift-lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    min-width: 2.5rem;
    padding: 0 0.625rem;
    margin-inline-end: 0.75rem;
    border: 1.5px solid #000000;
    border-radius: 6px;
    background: transparent;
    color: #000000;
    font-family: 'Cairo', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.palift-lang-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: #000000;
    color: #000000;
}

/* ── 32. RTL LAYOUT WHEN ARABIC ─────────────────────────────────────────────── */
html[dir="rtl"] .fi-sidebar {
    border-right: none !important;
    border-left: 1px solid #34332f !important;
}
html[dir="rtl"] .fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
    inset-inline-start: auto !important;
    inset-inline-end: 0 !important;
    border-radius: 3px 0 0 3px !important;
}
html[dir="rtl"] .fi-topbar {
    direction: rtl;
}
