/*
 * ==========================================================================
 * Et3am Delivery - Custom Filament v3 Theme
 * Application: "إطعام دليفري" - Charitable Food Distribution ERP
 * Direction: RTL-first (Arabic)
 * ==========================================================================
 */

/* --------------------------------------------------------------------------
 * 1. GOOGLE FONTS - Cairo (Arabic-optimized)
 * -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

/* --------------------------------------------------------------------------
 * 2. CSS CUSTOM PROPERTIES
 * -------------------------------------------------------------------------- */
:root {
    /* Brand Palette */
    --et3am-emerald-50: #ecfdf5;
    --et3am-emerald-100: #d1fae5;
    --et3am-emerald-200: #a7f3d0;
    --et3am-emerald-300: #6ee7b7;
    --et3am-emerald-400: #34d399;
    --et3am-emerald-500: #10b981;
    --et3am-emerald-600: #059669;
    --et3am-emerald-700: #047857;
    --et3am-emerald-800: #065f46;
    --et3am-emerald-900: #064e3b;

    --et3am-teal-500: #14b8a6;
    --et3am-teal-600: #0d9488;
    --et3am-teal-700: #0f766e;
    --et3am-teal-800: #115e59;
    --et3am-teal-900: #134e4a;

    /* Typography */
    --et3am-font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;

    /* Spacing & Radius */
    --et3am-radius-sm: 0.375rem;
    --et3am-radius-md: 0.5rem;
    --et3am-radius-lg: 0.75rem;
    --et3am-radius-xl: 1rem;
    --et3am-radius-2xl: 1.25rem;

    /* Shadows */
    --et3am-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --et3am-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --et3am-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --et3am-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --et3am-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --et3am-transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --et3am-transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Scrollbar */
    --et3am-scrollbar-width: 6px;
    --et3am-scrollbar-track: #f1f5f9;
    --et3am-scrollbar-thumb: #94a3b8;
    --et3am-scrollbar-thumb-hover: var(--et3am-emerald-500);
}

/* Dark mode custom property overrides */
.dark {
    --et3am-scrollbar-track: #1e293b;
    --et3am-scrollbar-thumb: #475569;
    --et3am-scrollbar-thumb-hover: var(--et3am-emerald-400);
}

/* --------------------------------------------------------------------------
 * 3. BASE TYPOGRAPHY & RTL FOUNDATION
 * -------------------------------------------------------------------------- */
body,
.filament-body,
.fi-body {
    font-family: var(--et3am-font-family) !important;
    direction: rtl;
    text-align: right;
}

/* Ensure all Filament text inherits Cairo */
.fi-sidebar,
.fi-topbar,
.fi-main,
.fi-header,
.fi-modal,
.fi-dropdown,
.fi-notification,
.filament-tables-table,
[class*="filament-"],
[class*="fi-"] {
    font-family: var(--et3am-font-family) !important;
}

/* RTL text alignment defaults */
p, h1, h2, h3, h4, h5, h6,
label, span, div, td, th, li {
    text-align: inherit;
}

/* Headings weight adjustment for Arabic readability */
h1, h2, h3, h4, h5, h6,
.fi-header-heading,
.fi-section-header-heading {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
 * 4. LOGIN PAGE
 * -------------------------------------------------------------------------- */

/* Gradient background for the login/auth pages */
.fi-simple-layout {
    background: linear-gradient(135deg, var(--et3am-emerald-700) 0%, var(--et3am-teal-700) 50%, var(--et3am-emerald-900) 100%) !important;
    min-height: 100vh;
    position: relative;
}

/* Subtle pattern overlay on login background */
.fi-simple-layout::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
                      radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Login card styling */
.fi-simple-layout .fi-simple-main-ctn {
    position: relative;
    z-index: 1;
}

.fi-simple-layout .fi-simple-main {
    background: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: blur(20px);
    border-radius: var(--et3am-radius-2xl) !important;
    box-shadow: var(--et3am-shadow-xl),
                0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    padding: 2.5rem !important;
    max-width: 28rem;
    width: 100%;
    transition: transform var(--et3am-transition-normal),
                box-shadow var(--et3am-transition-normal);
}

.fi-simple-layout .fi-simple-main:hover {
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.15) !important;
}

/* Dark mode login card */
.dark .fi-simple-layout .fi-simple-main {
    background: rgba(30, 41, 59, 0.95) !important;
}

/* Logo area above the login form */
.fi-simple-layout .fi-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--et3am-emerald-100);
}

.dark .fi-simple-layout .fi-logo {
    border-bottom-color: rgba(16, 185, 129, 0.2);
}

.fi-simple-layout .fi-logo img,
.fi-simple-layout .fi-logo svg {
    max-height: 5rem;
    height: 5rem !important;
    width: auto;
}

/* Login form heading */
.fi-simple-layout .fi-simple-header-heading {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    color: var(--et3am-emerald-800);
    text-align: center;
}

.dark .fi-simple-layout .fi-simple-header-heading {
    color: var(--et3am-emerald-300);
}

/* Login form inputs */
.fi-simple-layout .fi-input {
    border-radius: var(--et3am-radius-lg) !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    border: 1.5px solid #e2e8f0 !important;
    transition: border-color var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast) !important;
}

.fi-simple-layout .fi-input:focus {
    border-color: var(--et3am-emerald-500) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.dark .fi-simple-layout .fi-input {
    border-color: #334155 !important;
    background-color: #1e293b !important;
}

.dark .fi-simple-layout .fi-input:focus {
    border-color: var(--et3am-emerald-400) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15) !important;
}

/* Login form button */
.fi-simple-layout .fi-btn-primary {
    border-radius: var(--et3am-radius-lg) !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    background: linear-gradient(135deg, var(--et3am-emerald-600), var(--et3am-teal-600)) !important;
    border: none !important;
    transition: transform var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast),
                opacity var(--et3am-transition-fast) !important;
}

.fi-simple-layout .fi-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    opacity: 0.95;
}

.fi-simple-layout .fi-btn-primary:active {
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
 * 5. SIDEBAR ENHANCEMENTS
 * -------------------------------------------------------------------------- */

/* Sidebar gradient background */
.fi-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-inline-end: 1px solid #e2e8f0;
}

.dark .fi-sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    border-inline-end-color: #334155;
}

/* Sidebar navigation items */
.fi-sidebar-item {
    transition: all var(--et3am-transition-fast) !important;
}

.fi-sidebar-item-button {
    border-radius: var(--et3am-radius-md) !important;
    margin-inline: 0.5rem;
    padding: 0.5rem 0.75rem !important;
    transition: background-color var(--et3am-transition-fast),
                color var(--et3am-transition-fast),
                transform var(--et3am-transition-fast) !important;
}

/* Sidebar hover state */
.fi-sidebar-item-button:hover {
    background-color: var(--et3am-emerald-50) !important;
    color: var(--et3am-emerald-700) !important;
}

.dark .fi-sidebar-item-button:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: var(--et3am-emerald-300) !important;
}

/* Sidebar active item */
.fi-sidebar-item-active .fi-sidebar-item-button,
.fi-sidebar-item-button[aria-current="page"] {
    background-color: var(--et3am-emerald-50) !important;
    color: var(--et3am-emerald-700) !important;
    font-weight: 600 !important;
    border-inline-start: 3px solid var(--et3am-emerald-500) !important;
}

.dark .fi-sidebar-item-active .fi-sidebar-item-button,
.dark .fi-sidebar-item-button[aria-current="page"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--et3am-emerald-300) !important;
    border-inline-start-color: var(--et3am-emerald-400) !important;
}

/* Sidebar active item icon */
.fi-sidebar-item-active .fi-sidebar-item-icon {
    color: var(--et3am-emerald-600) !important;
}

.dark .fi-sidebar-item-active .fi-sidebar-item-icon {
    color: var(--et3am-emerald-400) !important;
}

/* Sidebar group headers */
.fi-sidebar-group-label {
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8 !important;
    padding-inline: 1rem;
    margin-bottom: 0.25rem;
    position: relative;
}

.fi-sidebar-group {
    position: relative;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Subtle border accent on group headers */
.fi-sidebar-group-label::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--et3am-emerald-400), var(--et3am-teal-400));
    border-radius: 0 2px 2px 0;
}

[dir="rtl"] .fi-sidebar-group-label::before,
.fi-sidebar-group-label::before {
    border-radius: 2px 0 0 2px;
}

/* Sidebar group divider */
.fi-sidebar-group + .fi-sidebar-group {
    border-top: 1px solid #f1f5f9;
    padding-top: 0.5rem;
}

.dark .fi-sidebar-group + .fi-sidebar-group {
    border-top-color: #1e293b;
}

/* --------------------------------------------------------------------------
 * 6. DASHBOARD & STAT CARDS
 * -------------------------------------------------------------------------- */

/* Filament stat widgets / cards */
.fi-wi-stats-overview-stat {
    border-radius: var(--et3am-radius-xl) !important;
    transition: transform var(--et3am-transition-normal),
                box-shadow var(--et3am-transition-normal) !important;
    box-shadow: var(--et3am-shadow-sm) !important;
    overflow: hidden;
}

.fi-wi-stats-overview-stat:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: var(--et3am-shadow-lg) !important;
}

/* Stat card value */
.fi-wi-stats-overview-stat-value {
    font-weight: 800 !important;
    font-size: 1.75rem !important;
}

/* Stat card description */
.fi-wi-stats-overview-stat-description {
    font-weight: 500 !important;
}

/* Widget cards general */
.fi-wi-card,
.fi-section {
    border-radius: var(--et3am-radius-xl) !important;
    transition: box-shadow var(--et3am-transition-normal) !important;
}

.fi-wi-card:hover,
.fi-section:hover {
    box-shadow: var(--et3am-shadow-md) !important;
}

/* Chart widgets */
.fi-wi-chart {
    border-radius: var(--et3am-radius-xl) !important;
}

/* --------------------------------------------------------------------------
 * 7. TABLE ENHANCEMENTS
 * -------------------------------------------------------------------------- */

/* Table container */
.fi-ta {
    border-radius: var(--et3am-radius-xl) !important;
    overflow: hidden;
}

/* Table header */
.fi-ta-header-cell {
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b !important;
}

.dark .fi-ta-header-cell {
    color: #94a3b8 !important;
}

/* Table row hover */
.fi-ta-row {
    transition: background-color var(--et3am-transition-fast) !important;
}

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

.dark .fi-ta-row:hover {
    background-color: rgba(16, 185, 129, 0.05) !important;
}

/* Table row striping (subtle) */
.fi-ta-row:nth-child(even) {
    background-color: #fafbfc;
}

.dark .fi-ta-row:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.fi-ta-row:nth-child(even):hover {
    background-color: var(--et3am-emerald-50) !important;
}

.dark .fi-ta-row:nth-child(even):hover {
    background-color: rgba(16, 185, 129, 0.05) !important;
}

/* Table cell padding for RTL comfort */
.fi-ta-cell {
    padding: 0.75rem 1rem !important;
}

/* --------------------------------------------------------------------------
 * 8. BUTTONS
 * -------------------------------------------------------------------------- */

/* General button transitions */
.fi-btn {
    transition: transform var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast),
                background-color var(--et3am-transition-fast),
                opacity var(--et3am-transition-fast) !important;
    border-radius: var(--et3am-radius-md) !important;
    font-weight: 600 !important;
}

/* Button hover lift */
.fi-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--et3am-shadow-md) !important;
}

.fi-btn:active {
    transform: translateY(0px);
    box-shadow: var(--et3am-shadow-sm) !important;
}

/* Primary button emerald gradient */
.fi-btn-primary {
    background: linear-gradient(135deg, var(--et3am-emerald-600), var(--et3am-emerald-500)) !important;
}

.fi-btn-primary:hover {
    background: linear-gradient(135deg, var(--et3am-emerald-700), var(--et3am-emerald-600)) !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

/* Danger button */
.fi-btn-danger:hover {
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35) !important;
}

/* Icon buttons */
.fi-icon-btn {
    transition: transform var(--et3am-transition-fast),
                background-color var(--et3am-transition-fast),
                color var(--et3am-transition-fast) !important;
    border-radius: var(--et3am-radius-md) !important;
}

.fi-icon-btn:hover {
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
 * 9. FORM INPUTS
 * -------------------------------------------------------------------------- */

/* General input styling */
.fi-input {
    border-radius: var(--et3am-radius-md) !important;
    transition: border-color var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast) !important;
    font-family: var(--et3am-font-family) !important;
}

/* Input focus ring - emerald */
.fi-input:focus,
.fi-input:focus-within {
    border-color: var(--et3am-emerald-500) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
    outline: none !important;
}

.dark .fi-input:focus,
.dark .fi-input:focus-within {
    border-color: var(--et3am-emerald-400) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12) !important;
}

/* Input wrapper focus */
.fi-input-wrp:focus-within {
    border-color: var(--et3am-emerald-500) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

.dark .fi-input-wrp:focus-within {
    border-color: var(--et3am-emerald-400) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12) !important;
}

/* Select inputs */
.fi-select-input,
.fi-select {
    font-family: var(--et3am-font-family) !important;
}

/* Textarea */
textarea.fi-input {
    min-height: 6rem;
}

/* Checkbox and Radio emerald accent */
.fi-checkbox-input:checked,
.fi-radio-input:checked {
    background-color: var(--et3am-emerald-500) !important;
    border-color: var(--et3am-emerald-500) !important;
}

.fi-checkbox-input:focus,
.fi-radio-input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* Toggle emerald */
.fi-toggle-input:checked {
    background-color: var(--et3am-emerald-500) !important;
}

/* --------------------------------------------------------------------------
 * 10. BADGES
 * -------------------------------------------------------------------------- */

.fi-badge {
    border-radius: 9999px !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    padding: 0.2rem 0.65rem !important;
    letter-spacing: 0.02em;
    transition: transform var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast) !important;
}

.fi-badge:hover {
    transform: scale(1.05);
}

/* Badge success variant - emerald */
.fi-badge-success {
    background-color: var(--et3am-emerald-100) !important;
    color: var(--et3am-emerald-800) !important;
}

.dark .fi-badge-success {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--et3am-emerald-300) !important;
}

/* --------------------------------------------------------------------------
 * 11. MODALS & NOTIFICATIONS
 * -------------------------------------------------------------------------- */

/* Modal styling */
.fi-modal-window {
    border-radius: var(--et3am-radius-xl) !important;
    box-shadow: var(--et3am-shadow-xl) !important;
}

/* Notifications */
.fi-notification {
    border-radius: var(--et3am-radius-lg) !important;
    box-shadow: var(--et3am-shadow-lg) !important;
    font-family: var(--et3am-font-family) !important;
    transition: transform var(--et3am-transition-normal),
                opacity var(--et3am-transition-normal) !important;
}

/* Notification success */
.fi-notification-success {
    border-inline-start: 4px solid var(--et3am-emerald-500) !important;
}

/* --------------------------------------------------------------------------
 * 12. TOPBAR / HEADER
 * -------------------------------------------------------------------------- */

.fi-topbar {
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.dark .fi-topbar {
    background-color: rgba(15, 23, 42, 0.85) !important;
    border-bottom-color: rgba(51, 65, 85, 0.5);
}

/* Global search */
.fi-global-search-input {
    border-radius: var(--et3am-radius-lg) !important;
    font-family: var(--et3am-font-family) !important;
}

/* --------------------------------------------------------------------------
 * 13. TABS & NAVIGATION
 * -------------------------------------------------------------------------- */

.fi-tabs-tab {
    transition: color var(--et3am-transition-fast),
                border-color var(--et3am-transition-fast),
                background-color var(--et3am-transition-fast) !important;
    font-weight: 600 !important;
    border-radius: var(--et3am-radius-md) var(--et3am-radius-md) 0 0 !important;
}

.fi-tabs-tab:hover {
    color: var(--et3am-emerald-600) !important;
}

.fi-tabs-tab-active {
    color: var(--et3am-emerald-600) !important;
    border-bottom-color: var(--et3am-emerald-500) !important;
}

.dark .fi-tabs-tab-active {
    color: var(--et3am-emerald-400) !important;
    border-bottom-color: var(--et3am-emerald-400) !important;
}

/* --------------------------------------------------------------------------
 * 14. PAGINATION
 * -------------------------------------------------------------------------- */

.fi-pagination-item {
    border-radius: var(--et3am-radius-md) !important;
    transition: all var(--et3am-transition-fast) !important;
}

.fi-pagination-item:hover {
    background-color: var(--et3am-emerald-50) !important;
    color: var(--et3am-emerald-700) !important;
}

.dark .fi-pagination-item:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: var(--et3am-emerald-300) !important;
}

/* --------------------------------------------------------------------------
 * 15. CUSTOM SCROLLBAR
 * -------------------------------------------------------------------------- */

/* Webkit browsers (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: var(--et3am-scrollbar-width);
    height: var(--et3am-scrollbar-width);
}

::-webkit-scrollbar-track {
    background: var(--et3am-scrollbar-track);
    border-radius: var(--et3am-radius-lg);
}

::-webkit-scrollbar-thumb {
    background: var(--et3am-scrollbar-thumb);
    border-radius: var(--et3am-radius-lg);
    transition: background-color var(--et3am-transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--et3am-scrollbar-thumb-hover);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--et3am-scrollbar-thumb) var(--et3am-scrollbar-track);
}

/* Sidebar scrollbar - slightly thinner */
.fi-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

/* --------------------------------------------------------------------------
 * 16. GENERAL TRANSITIONS & POLISH
 * -------------------------------------------------------------------------- */

/* Smooth transitions on all interactive elements */
a, button, input, select, textarea,
[role="button"],
[role="tab"],
[role="menuitem"] {
    transition: color var(--et3am-transition-fast),
                background-color var(--et3am-transition-fast),
                border-color var(--et3am-transition-fast),
                box-shadow var(--et3am-transition-fast),
                opacity var(--et3am-transition-fast);
}

/* Links in content */
.fi-main a:not(.fi-btn):not(.fi-link):not(.fi-sidebar-item-button) {
    color: var(--et3am-emerald-600);
    text-decoration: none;
    transition: color var(--et3am-transition-fast);
}

.fi-main a:not(.fi-btn):not(.fi-link):not(.fi-sidebar-item-button):hover {
    color: var(--et3am-emerald-800);
    text-decoration: underline;
}

.dark .fi-main a:not(.fi-btn):not(.fi-link):not(.fi-sidebar-item-button) {
    color: var(--et3am-emerald-400);
}

.dark .fi-main a:not(.fi-btn):not(.fi-link):not(.fi-sidebar-item-button):hover {
    color: var(--et3am-emerald-300);
}

/* Card / section hover glow */
.fi-section,
.fi-wi-card {
    position: relative;
}

/* Loading indicator color override */
.fi-loading-indicator {
    color: var(--et3am-emerald-500) !important;
}

/* Selection color */
::selection {
    background-color: rgba(16, 185, 129, 0.2);
    color: inherit;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--et3am-emerald-500);
    outline-offset: 2px;
    border-radius: var(--et3am-radius-sm);
}

/* --------------------------------------------------------------------------
 * 17. BREADCRUMBS
 * -------------------------------------------------------------------------- */

.fi-breadcrumbs {
    font-size: 0.85rem;
}

.fi-breadcrumbs li {
    transition: color var(--et3am-transition-fast);
}

.fi-breadcrumbs a:hover {
    color: var(--et3am-emerald-600) !important;
}

/* --------------------------------------------------------------------------
 * 18. DROPDOWN MENUS
 * -------------------------------------------------------------------------- */

.fi-dropdown-panel {
    border-radius: var(--et3am-radius-lg) !important;
    box-shadow: var(--et3am-shadow-lg) !important;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.dark .fi-dropdown-panel {
    border-color: #334155;
}

.fi-dropdown-list-item {
    transition: background-color var(--et3am-transition-fast),
                color var(--et3am-transition-fast) !important;
    border-radius: var(--et3am-radius-sm) !important;
    margin: 0.125rem 0.25rem;
}

.fi-dropdown-list-item:hover {
    background-color: var(--et3am-emerald-50) !important;
}

.dark .fi-dropdown-list-item:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

/* --------------------------------------------------------------------------
 * 19. RTL-SPECIFIC OVERRIDES
 * -------------------------------------------------------------------------- */

/* Ensure directional properties are correct for RTL */
[dir="rtl"] .fi-sidebar-item-active .fi-sidebar-item-button,
[dir="rtl"] .fi-sidebar-item-button[aria-current="page"] {
    border-inline-start: 3px solid var(--et3am-emerald-500) !important;
    border-inline-end: none !important;
}

/* RTL notification border */
[dir="rtl"] .fi-notification-success {
    border-inline-start: 4px solid var(--et3am-emerald-500) !important;
    border-inline-end: none !important;
}

/* RTL sidebar group label accent */
[dir="rtl"] .fi-sidebar-group-label::before {
    inset-inline-start: 0;
    inset-inline-end: auto;
}

/* Fix alignment for number inputs in RTL */
input[type="number"] {
    text-align: right;
    direction: ltr;
    unicode-bidi: bidi-override;
}

/* Date/time inputs keep LTR for readability */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    direction: ltr;
    text-align: right;
}

/* Phone number fields */
input[type="tel"] {
    direction: ltr;
    text-align: right;
}

/* --------------------------------------------------------------------------
 * 20. INFOLIST / DETAIL PAGES
 * -------------------------------------------------------------------------- */

.fi-in-entry-wrp {
    border-radius: var(--et3am-radius-md);
    transition: background-color var(--et3am-transition-fast);
}

.fi-in-entry-wrp:hover {
    background-color: rgba(241, 245, 249, 0.5);
}

.dark .fi-in-entry-wrp:hover {
    background-color: rgba(30, 41, 59, 0.3);
}

/* --------------------------------------------------------------------------
 * 21. EMPTY STATE
 * -------------------------------------------------------------------------- */

.fi-ta-empty-state {
    padding: 3rem 1rem !important;
}

.fi-ta-empty-state-icon {
    color: var(--et3am-emerald-300) !important;
}

.dark .fi-ta-empty-state-icon {
    color: var(--et3am-emerald-600) !important;
}

/* --------------------------------------------------------------------------
 * 22. PRINT STYLES
 * -------------------------------------------------------------------------- */

@media print {
    /* Hide non-essential UI elements */
    .fi-sidebar,
    .fi-topbar,
    .fi-global-search,
    .fi-breadcrumbs,
    .fi-btn,
    .fi-icon-btn,
    .fi-pagination,
    .fi-ta-header-toolbar,
    .fi-dropdown,
    .fi-notification,
    .fi-footer,
    nav {
        display: none !important;
    }

    /* Full width for main content */
    .fi-main,
    .fi-main-ctn {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0.5rem !important;
    }

    /* Remove shadows and backgrounds */
    .fi-section,
    .fi-wi-card,
    .fi-ta,
    .fi-wi-stats-overview-stat {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
    }

    /* Ensure text is black for printing */
    body, p, span, td, th, h1, h2, h3, h4, h5, h6, label, div {
        color: #000 !important;
    }

    /* Table borders for print clarity */
    .fi-ta-row {
        border-bottom: 1px solid #e5e7eb !important;
    }

    .fi-ta-header-cell {
        border-bottom: 2px solid #000 !important;
        color: #000 !important;
    }

    /* Page breaks */
    .fi-section,
    .fi-wi-card {
        page-break-inside: avoid;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* Print header */
    @page {
        margin: 1.5cm;
        size: A4;
    }

    /* Reset backgrounds */
    body {
        background: white !important;
    }

    /* Ensure RTL direction is preserved in print */
    body {
        direction: rtl !important;
        text-align: right !important;
        font-family: var(--et3am-font-family) !important;
    }

    /* Show URLs after links in print */
    .fi-main a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
        font-weight: normal;
    }

    /* Don't show URL for buttons styled as links */
    .fi-main a.fi-btn[href]::after,
    .fi-main a.fi-link[href]::after {
        content: none;
    }
}

/* --------------------------------------------------------------------------
 * 23. RESPONSIVE ADJUSTMENTS
 * -------------------------------------------------------------------------- */

/* Mobile: tighter spacing */
@media (max-width: 768px) {
    .fi-simple-layout .fi-simple-main {
        margin: 1rem;
        padding: 1.5rem !important;
        border-radius: var(--et3am-radius-xl) !important;
    }

    .fi-wi-stats-overview-stat:hover {
        transform: none;
    }

    .fi-ta-cell {
        padding: 0.5rem 0.75rem !important;
    }
}

/* Large screens */
@media (min-width: 1536px) {
    .fi-simple-layout .fi-simple-main {
        max-width: 30rem;
    }
}

/* --------------------------------------------------------------------------
 * 24. LAYOUT HEIGHT FIXES
 * -------------------------------------------------------------------------- */

/* Ensure the body and layout fill full viewport */
.fi-layout {
    min-height: 100vh !important;
}

/* Sidebar should fill full height */
.fi-sidebar {
    min-height: 100vh;
    height: 100%;
}

/* Main content area should fill remaining space */
.fi-main-ctn {
    min-height: 100vh;
}

.fi-main {
    min-height: calc(100vh - 4rem);
    padding-bottom: 2rem;
}

/* --------------------------------------------------------------------------
 * 25. PAGE HEADING VISIBILITY (Light Mode)
 * -------------------------------------------------------------------------- */

/* Ensure page headings are always visible in light mode */
.fi-header-heading,
.fi-page-header h1,
.fi-header h1 {
    color: #1e293b !important;
}

/* Sidebar item text must be visible in light mode */
.fi-sidebar-item-button .fi-sidebar-item-label {
    color: #475569;
}

.fi-sidebar-item-active .fi-sidebar-item-button .fi-sidebar-item-label {
    color: var(--et3am-emerald-700) !important;
}

/* Sidebar item icons */
.fi-sidebar-item-icon {
    color: #64748b;
}

/* --------------------------------------------------------------------------
 * 26. ANIMATIONS
 * -------------------------------------------------------------------------- */

/* Subtle fade-in for page content */
.fi-main > * {
    animation: et3am-fade-in 0.3s ease-out;
}

@keyframes et3am-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for loading states */
@keyframes et3am-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.fi-loading-indicator {
    animation: et3am-pulse 1.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
 * 27. TAILWIND UTILITY SAFELIST (Classes missing from Filament's compiled CSS)
 * -------------------------------------------------------------------------- */

/* Background colors */
.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-green-100 { background-color: #dcfce7; }
.bg-red-50 { background-color: #fef2f2; }
.bg-red-100 { background-color: #fee2e2; }
.bg-yellow-50 { background-color: #fefce8; }
.bg-yellow-100 { background-color: #fef9c3; }
.bg-orange-50 { background-color: #fff7ed; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-emerald-50 { background-color: #ecfdf5; }
.bg-emerald-100 { background-color: #d1fae5; }
.bg-teal-50 { background-color: #f0fdfa; }
.bg-indigo-50 { background-color: #eef2ff; }

/* Text colors */
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-green-600 { color: #16a34a; }
.text-green-700 { color: #15803d; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-yellow-600 { color: #ca8a04; }
.text-yellow-700 { color: #a16207; }
.text-orange-600 { color: #ea580c; }
.text-purple-600 { color: #9333ea; }
.text-emerald-600 { color: #059669; }
.text-emerald-700 { color: #047857; }
.text-teal-600 { color: #0d9488; }
.text-indigo-600 { color: #4f46e5; }

/* Border colors */
.border-blue-200 { border-color: #bfdbfe; }
.border-blue-300 { border-color: #93c5fd; }
.border-green-200 { border-color: #bbf7d0; }
.border-green-300 { border-color: #86efac; }
.border-red-200 { border-color: #fecaca; }
.border-red-300 { border-color: #fca5a5; }
.border-yellow-200 { border-color: #fde68a; }
.border-orange-200 { border-color: #fed7aa; }
.border-purple-200 { border-color: #e9d5ff; }
.border-emerald-200 { border-color: #a7f3d0; }
.border-emerald-300 { border-color: #6ee7b7; }
.border-teal-200 { border-color: #99f6e4; }
.border-indigo-200 { border-color: #c7d2fe; }

/* Ring colors */
.ring-2 { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }

/* Dark mode overrides for raw Tailwind color classes */
.dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.08); }
.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.08); }
.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.08); }
.dark .bg-yellow-50 { background-color: rgba(234, 179, 8, 0.08); }

/* Font mono for accounting tables */
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* Border dashed for empty states */
.border-dashed { border-style: dashed; }

/* File input styling (volunteer upload) */
.file\:mr-4::file-selector-button { margin-right: 1rem; }
.file\:py-2::file-selector-button { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.file\:px-4::file-selector-button { padding-left: 1rem; padding-right: 1rem; }
.file\:rounded-lg::file-selector-button { border-radius: 0.5rem; }
.file\:border-0::file-selector-button { border-width: 0; }
.file\:text-sm::file-selector-button { font-size: 0.875rem; }
.file\:font-semibold::file-selector-button { font-weight: 600; }
.file\:bg-primary-50::file-selector-button { background-color: var(--et3am-emerald-50); }
.file\:text-primary-700::file-selector-button { color: var(--et3am-emerald-700); }

/* Max height with overflow for AI review list */
.max-h-\[70vh\] { max-height: 70vh; }

/* Backdrop filter for blur effects */
.backdrop-blur { backdrop-filter: blur(8px); }

/* Pre formatting for JSON display */
pre { white-space: pre-wrap; word-wrap: break-word; }

/* --------------------------------------------------------------------------
 * 28. CUSTOM PAGE STYLES (blade view specific)
 * -------------------------------------------------------------------------- */

/* Empty state styling for custom pages */
.et3am-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    background: #fff;
    border-radius: 0.75rem;
    border: 2px dashed #e2e8f0;
}

.dark .et3am-empty-state {
    background: #1e293b;
    border-color: #334155;
}

.et3am-empty-state svg {
    width: 3rem;
    height: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.et3am-empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.et3am-empty-state p {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Scan input card with primary border */
.et3am-scan-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 2px solid var(--et3am-emerald-500);
    padding: 1.5rem;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.dark .et3am-scan-card {
    background: #1e293b;
}

.et3am-scan-card input[type="text"] {
    font-size: 1.5rem;
    padding: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.75rem;
    width: 100%;
}

.et3am-scan-card input[type="text"]:focus {
    border-color: var(--et3am-emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
    outline: none;
}

/* Progress bar colors */
.et3am-progress-bar {
    background: #e5e7eb;
    border-radius: 9999px;
    height: 1rem;
    overflow: hidden;
}

.et3am-progress-bar .et3am-progress-fill {
    background: linear-gradient(90deg, var(--et3am-emerald-500), var(--et3am-emerald-400));
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* Stat cards for kitchen/packaging pages */
.et3am-stat-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.dark .et3am-stat-card {
    background: #1e293b;
    border-color: #334155;
}

.et3am-stat-card .et3am-stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    display: block;
}

.et3am-stat-card .et3am-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--et3am-emerald-600);
}

/* Card containers for selection grids */
.et3am-select-card {
    padding: 1rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms, transform 150ms;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.dark .et3am-select-card {
    background: #1e293b;
    border-color: #334155;
}

.et3am-select-card:hover {
    border-color: var(--et3am-emerald-500);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* Table containers for blade pages */
.et3am-table-wrap {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.dark .et3am-table-wrap {
    background: #1e293b;
    border-color: #334155;
}

.et3am-table-wrap table {
    width: 100%;
    font-size: 0.875rem;
}

.et3am-table-wrap thead {
    background: #f9fafb;
}

.dark .et3am-table-wrap thead {
    background: #0f172a;
}

.et3am-table-wrap th {
    padding: 0.75rem 1rem;
    text-align: start;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.et3am-table-wrap td {
    padding: 0.75rem 1rem;
}

.et3am-table-wrap tbody tr {
    border-top: 1px solid #e5e7eb;
}

.dark .et3am-table-wrap tbody tr {
    border-top-color: #334155;
}

.et3am-table-wrap tbody tr:hover {
    background: var(--et3am-emerald-50);
}

/* Picked/complete row highlight */
.et3am-row-complete {
    background-color: #f0fdf4;
}

.dark .et3am-row-complete {
    background-color: rgba(34, 197, 94, 0.06);
}

/* Trial balance specific colors */
.et3am-debit { color: #2563eb; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.et3am-credit { color: #16a34a; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.et3am-negative { color: #dc2626; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.et3am-balanced { color: #16a34a; font-weight: 700; }
.et3am-unbalanced { color: #dc2626; font-weight: 700; }

/* Section header for page sections */
.et3am-section-header {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.dark .et3am-section-header {
    background: #1e293b;
    border-color: #334155;
}

/* Confidence score bar (AI review) */
.et3am-confidence-bar {
    background: #e5e7eb;
    border-radius: 9999px;
    height: 0.625rem;
    overflow: hidden;
}

.et3am-confidence-high { background: #22c55e; }
.et3am-confidence-medium { background: #f59e0b; }
.et3am-confidence-low { background: #ef4444; }

/* AI review selected card */
.et3am-ai-card-selected {
    border-color: var(--et3am-emerald-500) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Packaging summary box */
.et3am-packaging-summary {
    background: var(--et3am-emerald-50);
    border: 1px solid var(--et3am-emerald-200);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.dark .et3am-packaging-summary {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

/* --------------------------------------------------------------------------
 * 29. TOPBAR TOOLS DROPDOWN
 * -------------------------------------------------------------------------- */

.et3am-tools-wrap {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 50;
}

.et3am-tools-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    font-family: var(--et3am-font-family);
    transition: all 0.15s;
}

.et3am-tools-btn:hover {
    background: var(--et3am-emerald-50);
    border-color: var(--et3am-emerald-200);
    color: var(--et3am-emerald-600);
}

.et3am-tools-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    z-index: 9999;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    min-width: 15rem;
    overflow: visible;
}

[dir="rtl"] .et3am-tools-dropdown { right: 0; }
[dir="ltr"] .et3am-tools-dropdown { left: 0; }

.et3am-tools-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    text-align: start;
    text-decoration: none;
    font-family: var(--et3am-font-family);
    transition: background 0.15s;
}

.et3am-tools-item:hover {
    background: var(--et3am-emerald-50);
    color: var(--et3am-emerald-700);
}

/* Calculator */
.et3am-calc-panel {
    border-top: 1px solid #e2e8f0;
    padding: 0.625rem;
}

.et3am-calc-display {
    background: #1e293b;
    color: #fff;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    text-align: right;
    direction: ltr;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
}

.et3am-calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.2rem;
}

.et3am-calc-btn {
    padding: 0.45rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: var(--et3am-font-family);
    transition: opacity 0.1s, transform 0.1s;
}

.et3am-calc-btn:hover {
    opacity: 0.8;
    transform: scale(0.96);
}

.et3am-calc-btn:active {
    transform: scale(0.9);
}

.et3am-calc-btn-wide {
    grid-column: span 2;
}

/* Mobile: hide text, show icon only */
@media (max-width: 640px) {
    .et3am-tools-btn-text {
        display: none;
    }
    .et3am-tools-btn {
        padding: 0.375rem;
    }
    .et3am-tools-dropdown {
        min-width: 13rem;
        right: 0;
        left: auto;
    }
}

/* --------------------------------------------------------------------------
 * 30. REPORT EMPTY STATE (smaller icons)
 * -------------------------------------------------------------------------- */

.et3am-empty-report {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 2px dashed #e2e8f0;
}

.dark .et3am-empty-report {
    background: #1e293b;
    border-color: #334155;
}

.et3am-empty-report svg {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.75rem;
    color: #94a3b8;
}

.et3am-empty-report h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 0.25rem;
}

.et3am-empty-report p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0;
}
