/* ===== LUSAIL Brand Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&family=Playfair+Display:wght@300;400;500;600&family=Montserrat:wght@300;400;500&display=swap');

:root {
    --lusail-ink: #2f2a21;
    --lusail-muted: #74664f;
    --lusail-primary: #8b7355;
    --lusail-primary-strong: #5c4a32;
    --lusail-surface: #fffdf8;
    --lusail-page: #f7f4ed;
    --lusail-border: rgba(139, 115, 85, 0.14);
    --lusail-shadow: 0 18px 45px -30px rgba(47, 42, 33, 0.45);
}

/* ===== Base RTL Support ===== */
body, html {
    direction: rtl;
    font-family: 'Tajawal', ui-sans-serif, system-ui, sans-serif;
    background: var(--lusail-page);
    color: var(--lusail-ink);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.fi-ta-cell, .fi-fo-field-wrp {
    direction: rtl;
    text-align: right;
}

.fi-sidebar {
    direction: rtl;
}

.fi-main {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0) 280px),
        var(--lusail-page);
}

.fi-main-ctn {
    min-width: 0;
}

.fi-page {
    gap: 1rem;
}

.fi-header-heading {
    color: var(--lusail-ink) !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
}

.fi-header-subheading {
    color: var(--lusail-muted) !important;
}

.fi-breadcrumbs,
.fi-breadcrumbs a {
    color: rgba(116, 102, 79, 0.78) !important;
}

/* ===== LUSAIL Login Page ===== */

/* Brand panel background animation */
.lusail-brand-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    animation: lusail-glow 8s ease-in-out infinite alternate;
}

@keyframes lusail-glow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5%, 5%); }
}

/* Login form container - remove default shadow/ring */
.fi-simple-main {
    background: transparent !important;
    box-shadow: none !important;
    --tw-ring-shadow: none !important;
}

/* Login form styling */
.fi-simple-page .fi-form {
    background: rgba(255, 253, 248, 0.96);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--lusail-shadow);
    border: 1px solid var(--lusail-border);
    backdrop-filter: blur(14px);
}

/* Login heading styling */
.fi-simple-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.fi-simple-header .fi-header-heading {
    color: #5C4A32 !important;
    font-size: 1.6rem !important;
    font-weight: 600 !important;
}

.fi-simple-header .fi-header-subheading {
    color: #8B7355 !important;
    font-size: 0.85rem !important;
}

/* Form inputs on login - warm styling */
.fi-simple-page .fi-input {
    border-color: #d4c5a9 !important;
    border-radius: 0.6rem !important;
    transition: all 0.3s ease;
}

.fi-simple-page .fi-input:focus {
    border-color: #8B7355 !important;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.12) !important;
}

/* Login button - LUSAIL gold/brown */
.fi-simple-page .fi-btn-primary {
    background: linear-gradient(135deg, #8B7355 0%, #6B5B43 100%) !important;
    border: none !important;
    border-radius: 0.6rem !important;
    padding: 0.7rem 1.5rem !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.03em;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(107, 91, 67, 0.25) !important;
}

.fi-simple-page .fi-btn-primary:hover {
    background: linear-gradient(135deg, #6B5B43 0%, #5C4A32 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(107, 91, 67, 0.35) !important;
}

/* ===== Sidebar Branding ===== */
.fi-sidebar {
    background: linear-gradient(180deg, #fffdf8 0%, #f0ede4 100%) !important;
    border-left-color: rgba(196, 180, 154, 0.2) !important;
}

.fi-sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(196, 180, 154, 0.15);
}

/* Sidebar brand name */
.fi-sidebar-header a {
    color: #5C4A32 !important;
    font-weight: 600 !important;
}

/* Sidebar nav items */
.fi-sidebar-nav .fi-sidebar-item a {
    color: #6B5B43 !important;
    border-radius: 0.5rem;
    transition: all 0.2s;
    min-height: 2.35rem;
}

.fi-sidebar-nav .fi-sidebar-item a:hover {
    background: rgba(196, 180, 154, 0.15) !important;
    color: #5C4A32 !important;
}

/* Active sidebar item */
.fi-sidebar-item-active > a {
    background: linear-gradient(135deg, #8B7355 0%, #6B5B43 100%) !important;
    color: #f0ede4 !important;
}

.fi-sidebar-item-active > a * {
    color: #f0ede4 !important;
}

/* Sidebar group labels */
.fi-sidebar-group-label {
    color: #8B7355 !important;
    font-weight: 700 !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.05em;
}

/* ===== Top Bar ===== */
.fi-topbar {
    backdrop-filter: blur(12px);
    background: rgba(255, 253, 248, 0.88) !important;
    border-bottom: 1px solid rgba(196, 180, 154, 0.15) !important;
}

/* ===== Dashboard Styling ===== */
.fi-dashboard-page .fi-section {
    border-radius: 1rem;
}

/* Stats cards */
.fi-wi-stats-overview-stat {
    border-radius: 1rem !important;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(196, 180, 154, 0.12) !important;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(250,248,244,0.96)) !important;
    box-shadow: var(--lusail-shadow);
}

.fi-wi-stats-overview-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(92, 74, 50, 0.1);
}

/* Dashboard heading */
.fi-dashboard-page .fi-header-heading {
    color: #5C4A32 !important;
}

.fi-dashboard-page .fi-header-subheading {
    color: #8B7355 !important;
}

/* ===== Table Enhancements ===== */
.fi-ta-header-cell {
    font-weight: 700 !important;
    font-size: 0.8rem;
    color: #5C4A32 !important;
    background: #f8f6f1 !important;
    white-space: nowrap;
}

.fi-ta-row {
    transition: background-color 0.15s;
}

.fi-ta-row:hover {
    background: rgba(248, 246, 241, 0.6) !important;
}

/* ===== Cards & Sections ===== */
.fi-section {
    border-radius: 0.75rem;
    border: 1px solid rgba(196, 180, 154, 0.12);
    background: rgba(255, 253, 248, 0.94);
    box-shadow: var(--lusail-shadow);
}

.fi-section-header {
    row-gap: 0.75rem;
}

.fi-section-content {
    min-width: 0;
}

/* ===== Form Inputs ===== */
.fi-input,
.fi-select-input,
.fi-textarea {
    border-radius: 0.5rem !important;
}

.fi-input-wrp,
.fi-select-input,
.fi-textarea {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.fi-input-wrp:focus-within,
.fi-select-input:focus,
.fi-textarea:focus {
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.12) !important;
}

/* ===== Buttons - Primary ===== */
.fi-btn-primary {
    background: #8B7355 !important;
    transition: all 0.2s;
    box-shadow: 0 10px 22px -16px rgba(92, 74, 50, 0.8);
}

.fi-btn-primary:hover {
    background: #6B5B43 !important;
    transform: translateY(-1px);
}

.fi-btn,
.fi-icon-btn {
    border-radius: 0.65rem !important;
}

.fi-dropdown-panel {
    border: 1px solid var(--lusail-border) !important;
    box-shadow: 0 20px 50px -28px rgba(47, 42, 33, 0.55) !important;
}

/* ===== Badges ===== */
.fi-badge-success {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.fi-badge-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.fi-badge-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f8f6f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c4b49a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8B7355;
}

/* ===== Mobile & Tablet Polish ===== */
@media (max-width: 1024px) {
    .fi-main {
        padding-inline: 0.75rem !important;
    }

    .fi-header {
        gap: 0.85rem !important;
    }

    .fi-header .fi-ac {
        width: 100%;
        justify-content: stretch;
    }

    .fi-header .fi-ac .fi-btn {
        flex: 1 1 auto;
    }

    .fi-sidebar {
        background: #fffdf8 !important;
    }
}

@media (max-width: 768px) {
    .fi-page {
        gap: 0.85rem;
    }

    .fi-header-heading {
        font-size: 1.3rem !important;
        line-height: 1.35 !important;
    }

    .fi-header-subheading {
        font-size: 0.88rem !important;
    }

    .fi-section {
        border-radius: 0.85rem !important;
        box-shadow: 0 12px 30px -26px rgba(47, 42, 33, 0.55);
    }

    .fi-section-header,
    .fi-section-content {
        padding: 0.9rem !important;
    }

    .fi-wi-stats-overview-stats-ctn {
        gap: 0.65rem !important;
    }

    .fi-wi-stats-overview-stat {
        padding: 0.9rem !important;
    }

    .fi-ta {
        border-radius: 0.85rem !important;
        overflow: hidden;
    }

    .fi-ta-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fi-ta-table {
        min-width: 720px;
    }

    .fi-ta-cell,
    .fi-ta-header-cell {
        padding-inline: 0.75rem !important;
    }

    .fi-fo-component-ctn,
    .fi-fo-field-wrp {
        min-width: 0;
    }

    .fi-modal-window {
        width: calc(100vw - 1rem) !important;
        max-height: calc(100dvh - 1rem) !important;
        border-radius: 1rem !important;
    }
}

@media (max-width: 640px) {
    .fi-main {
        padding-inline: 0.5rem !important;
    }

    .fi-topbar {
        min-height: 3.5rem;
    }

    .fi-simple-main {
        margin-block: 1rem !important;
        padding: 1.25rem !important;
    }

    .fi-simple-page .fi-form {
        padding: 1.25rem;
        border-radius: 0.9rem;
    }

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

    .fi-btn {
        min-height: 2.5rem;
    }

    .fi-btn-label,
    .fi-tabs-item-label,
    .fi-ta-text {
        white-space: normal;
    }

    .fi-fo-field-wrp-label label {
        line-height: 1.5;
    }

    .fi-pagination {
        gap: 0.35rem !important;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    .fi-sidebar, .fi-topbar, .fi-breadcrumbs {
        display: none !important;
    }
    .fi-main {
        margin: 0 !important;
        padding: 0 !important;
    }
}
