/*
 * HMIS Enterprise Theme v5
 * Professional AIIMS-level hospital management system design
 * Dark sidebar · Light content · Clean typography · Enterprise cards
 */

/* ── Global ──────────────────────────────────────────────────────────────── */
*, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar shell ───────────────────────────────────────────────────────── */
.fi-sidebar,
.fi-main-sidebar,
aside.fi-sidebar {
    background-color: #0c1425 !important;
    border-right: 1px solid #1a2540 !important;
    width: 260px !important;
}

.fi-sidebar-nav {
    background-color: #0c1425 !important;
    padding: 0.5rem 0 !important;
}

/* ── Sidebar header ──────────────────────────────────────────────────────── */
.fi-sidebar-header-ctn,
.fi-sidebar-header,
.fi-sidebar-header-logo-ctn {
    background-color: #0c1425 !important;
    border-bottom: 1px solid #1a2540 !important;
}

.fi-sidebar-header {
    padding: 1.1rem 1.25rem !important;
}

.fi-sidebar-header .fi-logo,
.fi-sidebar-header span,
.fi-sidebar-header a {
    color: #f0f6ff !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    letter-spacing: -0.02em !important;
}

/* ── Sidebar group headers ───────────────────────────────────────────────── */
.fi-sidebar-group-btn {
    padding: 0.7rem 1rem 0.25rem !important;
    cursor: pointer;
}

.fi-sidebar-group-label {
    color: #3d5a80 !important;
    font-size: 0.6rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    flex: 1;
}

.fi-sidebar-group-collapse-btn,
.fi-sidebar-group-btn button {
    color: #2d4263 !important;
    opacity: 1 !important;
}

/* ── Sidebar nav items ───────────────────────────────────────────────────── */
.fi-sidebar-item-btn,
.fi-sidebar-item-btn * {
    color: #94a8c7 !important;
    opacity: 1 !important;
    text-decoration: none !important;
}

.fi-sidebar-item-btn {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    width: calc(100% - 1rem) !important;
    margin: 0.07rem 0.5rem !important;
    padding: 0.42rem 0.75rem !important;
    border-radius: 0.45rem !important;
    font-size: 0.8rem !important;
    font-weight: 450 !important;
    transition: background-color 0.1s ease, color 0.1s ease !important;
    cursor: pointer !important;
}

.fi-sidebar-item-btn:hover {
    background-color: #1a2a48 !important;
    color: #dce8ff !important;
}

.fi-sidebar-item-btn:hover * {
    color: #dce8ff !important;
}

/* Active item */
.fi-sidebar-item.fi-active .fi-sidebar-item-btn {
    background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.35) !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn * {
    color: #ffffff !important;
}

.fi-sidebar-item-label {
    color: inherit !important;
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
}

.fi-sidebar-item-icon {
    color: inherit !important;
    opacity: 0.8 !important;
    width: 1rem !important;
    height: 1rem !important;
    flex-shrink: 0 !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    opacity: 1 !important;
}

.fi-sidebar-group-items {
    padding: 0.1rem 0 0.4rem !important;
}

/* ── Sidebar footer ──────────────────────────────────────────────────────── */
.fi-sidebar-footer {
    background-color: #0c1425 !important;
    border-top: 1px solid #1a2540 !important;
    padding: 0.6rem 0.75rem !important;
}

.fi-sidebar-footer *:not(img) {
    color: #4a6080 !important;
}

/* Sidebar scrollbar */
.fi-sidebar-nav::-webkit-scrollbar { width: 3px; }
.fi-sidebar-nav::-webkit-scrollbar-track { background: #0c1425; }
.fi-sidebar-nav::-webkit-scrollbar-thumb { background: #1e3054; border-radius: 3px; }
.fi-sidebar-nav::-webkit-scrollbar-thumb:hover { background: #2d4a7a; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.fi-topbar,
header.fi-topbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e9edf3 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
}

/* Global search */
.fi-global-search-field input,
.fi-topbar input[type="search"],
.fi-topbar input[type="text"] {
    border-radius: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
    font-size: 0.8125rem !important;
    padding: 0.4rem 0.875rem !important;
    color: #1e293b !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}

.fi-global-search-field input:focus,
.fi-topbar input[type="search"]:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
    background-color: #ffffff !important;
    outline: none !important;
}

/* Topbar icons */
.fi-topbar-icon-btn {
    color: #64748b !important;
    border-radius: 0.5rem !important;
}

.fi-topbar-icon-btn:hover {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
}

/* User menu button in topbar */
.fi-user-menu-button,
.fi-user-menu-trigger {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.3rem 0.5rem !important;
    border-radius: 0.5rem !important;
    transition: background-color 0.1s !important;
}

.fi-user-menu-button:hover,
.fi-user-menu-trigger:hover {
    background-color: #f1f5f9 !important;
}

/* User avatar circle */
.fi-user-avatar {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: 9999px !important;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: white !important;
}

/* ── Main content area ───────────────────────────────────────────────────── */
.fi-main,
main.fi-main {
    background-color: #f0f4f8 !important;
}

.fi-page {
    background-color: #f0f4f8 !important;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.fi-header,
.fi-simple-page {
    max-width: 100% !important;
}

.fi-header-heading {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.025em !important;
    line-height: 1.3 !important;
}

.fi-header-subheading {
    font-size: 0.8125rem !important;
    color: #64748b !important;
    margin-top: 0.1rem !important;
}

/* Header action buttons */
.fi-header-actions .fi-btn {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
}

/* ── Cards & Sections ────────────────────────────────────────────────────── */
.fi-section,
.fi-wi-stats-overview-stat,
.fi-wi-chart,
.fi-wi-table,
.fi-wi {
    background-color: #ffffff !important;
    border: 1px solid #e9edf3 !important;
    border-radius: 0.875rem !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05), 0 0 0 0 transparent !important;
    transition: box-shadow 0.15s !important;
}

/* Stat cards */
.fi-wi-stats-overview-stat {
    padding: 1.25rem 1.5rem !important;
}

.fi-wi-stats-overview-stat-label {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: #64748b !important;
}

.fi-wi-stats-overview-stat-value {
    font-size: 1.9rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.15 !important;
    margin-top: 0.25rem !important;
}

.fi-wi-stats-overview-stat-description {
    font-size: 0.76rem !important;
    color: #94a3b8 !important;
    margin-top: 0.2rem !important;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.fi-ta-content {
    border-radius: 0.875rem !important;
    overflow: hidden !important;
    border: 1px solid #e9edf3 !important;
    background: #fff !important;
}

.fi-ta-header-cell {
    background-color: #f8fafc !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    color: #4b5563 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.07em !important;
    padding: 0.7rem 1rem !important;
    border-bottom: 1px solid #e9edf3 !important;
}

.fi-ta-cell {
    padding: 0.7rem 1rem !important;
    font-size: 0.8125rem !important;
    color: #374151 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.fi-ta-row:hover .fi-ta-cell {
    background-color: #f8faff !important;
}

/* Table empty state */
.fi-ta-empty-state {
    padding: 4rem 2rem !important;
}

.fi-ta-empty-state-heading {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin-top: 0.75rem !important;
}

.fi-ta-empty-state-description {
    font-size: 0.8125rem !important;
    color: #9ca3af !important;
    margin-top: 0.35rem !important;
    max-width: 28rem !important;
}

/* Table pagination */
.fi-ta-pagination {
    padding: 0.75rem 1rem !important;
    border-top: 1px solid #f1f5f9 !important;
    background: #f8fafc !important;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.fi-btn-color-primary {
    background: linear-gradient(135deg, #1d4ed8, #2563eb) !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(29, 78, 216, 0.3) !important;
}

.fi-btn-color-primary:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8) !important;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.4) !important;
}

.fi-btn {
    border-radius: 0.5rem !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    transition: all 0.15s !important;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.fi-badge {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    border-radius: 9999px !important;
    padding: 0.15rem 0.6rem !important;
}

/* ── Form inputs ─────────────────────────────────────────────────────────── */
.fi-fo-field-wrp input,
.fi-fo-field-wrp select,
.fi-fo-field-wrp textarea {
    border-radius: 0.5rem !important;
    border-color: #d1d5db !important;
    font-size: 0.8125rem !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}

.fi-fo-field-wrp input:focus,
.fi-fo-field-wrp select:focus,
.fi-fo-field-wrp textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
}

.fi-fo-field-wrp-label {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: #374151 !important;
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.fi-modal-window {
    border-radius: 1rem !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
}

.fi-modal-header {
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 1.25rem 1.5rem !important;
}

.fi-modal-heading {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

/* ── Notifications ───────────────────────────────────────────────────────── */
.fi-no-notification {
    border-radius: 0.75rem !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e9edf3 !important;
}

/* ── Filters / Indicator bar ─────────────────────────────────────────────── */
.fi-ta-filters-container {
    border-radius: 0.75rem !important;
    border: 1px solid #e9edf3 !important;
    background: #ffffff !important;
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
}

/* ── Navigation breadcrumbs ──────────────────────────────────────────────── */
.fi-breadcrumbs {
    font-size: 0.78rem !important;
    color: #64748b !important;
}

.fi-breadcrumbs-item-label {
    color: #64748b !important;
}

.fi-breadcrumbs-separator {
    color: #cbd5e1 !important;
}

/* ── Login page ──────────────────────────────────────────────────────────── */
.fi-auth-page,
.fi-simple-layout {
    background: linear-gradient(145deg, #0c1425 0%, #0f2347 50%, #0c1a38 100%) !important;
}

.fi-simple-layout-content {
    border-radius: 1rem !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}

/* ── Mobile / Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .fi-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        height: 100vh !important;
        z-index: 50 !important;
        transition: left 0.25s ease !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.4) !important;
    }

    .fi-sidebar.fi-sidebar-open {
        left: 0 !important;
    }
}

@media (max-width: 768px) {
    .fi-header-heading { font-size: 1rem !important; }
    .fi-wi-stats-overview-stat-value { font-size: 1.5rem !important; }
    .fi-ta-cell { padding: 0.6rem 0.75rem !important; }
    .fi-ta-header-cell { padding: 0.6rem 0.75rem !important; }
}

/* ── Sidebar group label improvements ───────────────────────────────────── */
.fi-sidebar-group {
    margin-top: 0.1rem !important;
}

/* ── Sidebar collapsed state ─────────────────────────────────────────────── */
.fi-sidebar-group.fi-collapsed .fi-sidebar-group-items {
    display: none !important;
}

/* ── Topbar hamburger on mobile ──────────────────────────────────────────── */
.fi-topbar-toggle-sidebar-btn {
    color: #475569 !important;
}

/* ── Active group — slightly highlight group header ──────────────────────── */
.fi-sidebar-group:has(.fi-sidebar-item.fi-active) > .fi-sidebar-group-btn .fi-sidebar-group-label {
    color: #5b8dee !important;
}

/* ── Smooth transitions on Livewire navigation ───────────────────────────── */
[wire\:loading] { opacity: 0.6; transition: opacity 0.2s; }

/* ── Section wrapper spacing ─────────────────────────────────────────────── */
.fi-page-content > * + * {
    margin-top: 0 !important;
}

/* ── Resource list action buttons ────────────────────────────────────────── */
.fi-ta-row-actions .fi-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.75rem !important;
}

/* ── Sidebar JS smart-collapse script support ────────────────────────────── */
.fi-sidebar-group-items[style*="display: none"] {
    display: none !important;
}

/* ── Help Center button in topbar ────────────────────────────────────────── */
.fi-topbar-help-btn {
    flex-shrink: 0;
}

/* Help drawer: slide-over transition helpers (Tailwind handles via Alpine) */
.translate-x-full  { transform: translateX(100%); }
.translate-x-0     { transform: translateX(0); }

/* Help drawer smooth scroll */
.help-content-scroll {
    scroll-behavior: smooth;
}

/* Step number circles */
.help-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background-color: #dbeafe;
    color: #1d4ed8;
    font-size: 0.625rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.125rem;
}
