/* Custom Filament Theme - Company Color: #32b6b3 */

/* ============================================
   SIDEBAR PROTECTION FROM BOOTSTRAP
   These rules ensure Bootstrap cannot override sidebar styles
   ============================================ */

/* Sidebar background - maximum specificity */
html body .fi-sidebar,
html body .fi-layout .fi-sidebar,
html body aside.fi-sidebar,
html body [data-turbo-permanent].fi-sidebar,
.fi-sidebar {
    background-color: #32b6b3 !important;
    background: #32b6b3 !important;
}

/* Sidebar inner container */
html body .fi-sidebar-nav,
.fi-sidebar-nav {
    background-color: transparent !important;
    background: transparent !important;
}

/* Sidebar navigation items - adjust text colors for contrast */
.fi-sidebar-nav-groups {
    color: #fff !important;
}

.fi-sidebar-group-label {
    color: rgba(255, 255, 255, 0.7) !important;
}

html body .fi-sidebar-item-label,
.fi-sidebar-item-label {
    color: #fff !important;
}

html body .fi-sidebar-item-icon,
.fi-sidebar-item-icon {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Active/hover states */
html body .fi-sidebar-item-active .fi-sidebar-item-label,
.fi-sidebar-item-active .fi-sidebar-item-label {
    color: #fff !important;
}

html body .fi-sidebar-item-active,
.fi-sidebar-item-active {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

html body .fi-sidebar-item:hover,
.fi-sidebar-item:hover,
html body .fi-sidebar .fi-sidebar-item:hover,
.fi-sidebar .fi-sidebar-item:hover,
html body a.fi-sidebar-item:hover,
a.fi-sidebar-item:hover {
    background-color: rgba(0, 0, 0, 0.15) !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Ensure hover doesn't get overridden by Bootstrap or other styles */
html body .fi-sidebar-item:hover .fi-sidebar-item-label,
.fi-sidebar-item:hover .fi-sidebar-item-label {
    color: #fff !important;
}

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

html body .fi-sidebar-item-active .fi-sidebar-item-icon,
.fi-sidebar-item-active .fi-sidebar-item-icon {
    color: #fff !important;
}

/* Sidebar header/brand area - white background for logo visibility */
html body .fi-sidebar-header,
.fi-sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    background-color: #fff !important;
    background: #fff !important;
    padding: 0.75rem !important;
    margin-bottom: 0.5rem !important;
}

/* Hide ALL buttons/icons in sidebar header (collapse arrows near logo) */
html body .fi-sidebar-header button,
html body .fi-sidebar-header [class*="collapse"],
html body .fi-sidebar-header [class*="toggle"],
.fi-sidebar-header button,
.fi-sidebar-header [class*="collapse"],
.fi-sidebar-header [class*="toggle"],
html body .fi-logo + button,
html body .fi-brand + button {
    display: none !important;
}

/* Hide sidebar collapse button completely */
html body .fi-sidebar-nav-collapse-btn,
.fi-sidebar-nav-collapse-btn,
html body .fi-sidebar button.fi-icon-btn,
.fi-sidebar button.fi-icon-btn,
html body .fi-sidebar-header .fi-icon-btn,
.fi-sidebar-header .fi-icon-btn,
html body button[title="Collapse sidebar"],
button[title="Collapse sidebar"],
html body button[title="Expand sidebar"],
button[title="Expand sidebar"] {
    display: none !important;
}

/* Badge styling in sidebar */
html body .fi-sidebar-item-badge,
.fi-sidebar-item-badge {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

/* Hide collapse arrows - use hover effects instead */
html body .fi-sidebar-group-collapse-button,
.fi-sidebar-group-collapse-button {
    display: none !important;
}

/* Prevent Bootstrap from affecting sidebar elements */
.fi-sidebar *,
.fi-sidebar *::before,
.fi-sidebar *::after {
    box-sizing: border-box;
}

/* Reset any Bootstrap nav styles inside sidebar */
.fi-sidebar .nav,
.fi-sidebar .navbar,
.fi-sidebar .nav-link,
.fi-sidebar .nav-item {
    all: unset;
}

/* Prevent Bootstrap link hover styles from affecting sidebar */
.fi-sidebar a,
.fi-sidebar a:hover,
.fi-sidebar a:focus,
.fi-sidebar a:active,
html body .fi-sidebar a,
html body .fi-sidebar a:hover {
    text-decoration: none !important;
    background-color: transparent !important;
}

.fi-sidebar a.fi-sidebar-item:hover,
html body .fi-sidebar a.fi-sidebar-item:hover {
    background-color: rgba(0, 0, 0, 0.15) !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Fix for collapsed sidebar */
html body .fi-sidebar-close-overlay,
.fi-sidebar-close-overlay {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure sidebar group headings are visible */
html body .fi-sidebar-group,
.fi-sidebar-group {
    background-color: transparent !important;
}

/* Dark mode sidebar - keep the same color */
.dark .fi-sidebar,
.dark html body .fi-sidebar {
    background-color: #32b6b3 !important;
    background: #32b6b3 !important;
}

/* ============================================
   TABLE TEXT SELECTION
   Enable text selection in Filament tables
   ============================================ */
.fi-ta-table,
.fi-ta-table *,
.fi-ta-cell,
.fi-ta-cell *,
.fi-ta-text,
.fi-ta-text *,
table.fi-ta-table td,
table.fi-ta-table td * {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    cursor: text;
}

/* Keep buttons and actions clickable */
.fi-ta-table button,
.fi-ta-table a,
.fi-ta-table .fi-btn,
.fi-ta-table .fi-ac-action,
.fi-ta-table .fi-ta-checkbox,
.fi-ta-table input,
.fi-ta-table select {
    cursor: pointer;
    user-select: none !important;
}

/* ============================================
   SIDEBAR SIZE & CONSISTENCY
   Ensure sidebar is consistent across all pages
   Protect from Bootstrap/Semantic UI interference
   ============================================ */

/* Sidebar base - let Filament handle width transitions */
html body .fi-sidebar,
.fi-sidebar,
aside.fi-sidebar {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    position: relative !important;
    z-index: 40 !important;
}

/* Protect sidebar from Bootstrap/Semantic UI resets */
html body .fi-sidebar,
html body .fi-sidebar *,
.fi-sidebar,
.fi-sidebar * {
    /* Prevent Bootstrap from resetting these */
    box-sizing: border-box !important;
}

/* Prevent Bootstrap container from affecting sidebar */
html body .fi-sidebar.container,
html body .fi-sidebar .container,
.fi-sidebar.container,
.fi-sidebar .container {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Prevent Semantic UI segment from affecting sidebar */
html body .fi-sidebar.ui.segment,
.fi-sidebar.ui.segment {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* ============================================
   PROTECT SIDEBAR FROM BOOTSTRAP/SEMANTIC UI
   Critical for pages like edit-form that load external CSS
   ============================================ */

/* Force sidebar styles over Bootstrap */
html body .fi-sidebar,
html body .fi-sidebar *:not(svg):not(path) {
    font-family: inherit !important;
}

html body .fi-sidebar .fi-sidebar-item,
html body .fi-sidebar a.fi-sidebar-item {
    display: flex !important;
    align-items: center !important;
    padding: 0.2rem 0.75rem !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0.375rem !important;
    text-decoration: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Reset Bootstrap button styles in sidebar */
html body .fi-sidebar .btn,
html body .fi-sidebar button {
    all: unset !important;
    cursor: pointer !important;
}

html body .fi-sidebar .fi-sidebar-group-button {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0.25rem 0.75rem !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
}

/* Prevent Bootstrap card styles */
html body .fi-sidebar .card,
html body .fi-sidebar .card-header,
html body .fi-sidebar .card-body {
    all: unset !important;
}

/* Prevent Bootstrap list styles */
html body .fi-sidebar ul,
html body .fi-sidebar ol {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

/* Prevent Semantic UI menu styles */
html body .fi-sidebar.ui.menu,
html body .fi-sidebar .ui.menu,
html body .fi-sidebar .menu {
    all: unset !important;
}

html body .fi-sidebar .item,
html body .fi-sidebar .ui.item {
    all: unset !important;
}

/* Icon sizing in sidebar */
html body .fi-sidebar .fi-sidebar-item-icon,
html body .fi-sidebar svg.fi-sidebar-item-icon {
    width: 1.25rem !important;
    height: 1.25rem !important;
    flex-shrink: 0 !important;
    margin-right: 0.5rem !important;
}

/* ============================================
   MAXIMUM SPECIFICITY SIDEBAR PROTECTION
   For pages with Bootstrap/Semantic UI (edit-form)
   No width overrides - let Filament handle collapse
   ============================================ */

/* Sidebar styling protection - no width forcing */
html body div.fi-layout aside.fi-sidebar,
html body .fi-body .fi-sidebar,
body aside.fi-sidebar {
    background-color: #32b6b3 !important;
}

/* Reset Semantic UI styles in sidebar - target specific problematic classes */
html body .fi-sidebar.ui.menu,
html body .fi-sidebar .ui.menu,
.fi-sidebar.ui.menu,
.fi-sidebar .ui.menu {
    all: unset !important;
}

/* Reset Bootstrap container styles */
html body .fi-sidebar .container,
html body .fi-sidebar .container-fluid,
html body .fi-sidebar .row {
    all: unset !important;
}

/* Force nav groups layout */
html body aside.fi-sidebar nav,
html body aside.fi-sidebar .fi-sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    background: transparent !important;
    width: 100% !important;
    padding: 0.25rem 0.5rem !important;
}

html body aside.fi-sidebar .fi-sidebar-nav-groups {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
}

/* Force group styling - no display override */
html body aside.fi-sidebar .fi-sidebar-group {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* Group button styling - clickable sections with visual feedback */
html body aside.fi-sidebar .fi-sidebar-group-button,
.fi-sidebar-group-button {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0.4rem 0.5rem !important;
    margin: 0.125rem 0 !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: none !important;
    border-left: 2px solid transparent !important;
    border-radius: 0 0.25rem 0.25rem 0 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-align: left !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    transition: all 0.15s ease !important;
}

/* Group button hover state */
html body aside.fi-sidebar .fi-sidebar-group-button:hover,
.fi-sidebar-group-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-left-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
}

/* Force items container - no display override to allow collapse */
html body aside.fi-sidebar .fi-sidebar-group-items {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Force item link styling */
html body aside.fi-sidebar .fi-sidebar-item {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0.2rem 0.75rem !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0.375rem !important;
    color: #fff !important;
    font-size: 0.8125rem !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

html body aside.fi-sidebar .fi-sidebar-item:hover {
    background: rgba(0, 0, 0, 0.15) !important;
}

html body aside.fi-sidebar .fi-sidebar-item-active {
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Force label styling */
html body aside.fi-sidebar .fi-sidebar-item-label {
    color: #fff !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Force icon styling */
html body aside.fi-sidebar .fi-sidebar-item-icon {
    width: 1.25rem !important;
    height: 1.25rem !important;
    margin-right: 0.5rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    flex-shrink: 0 !important;
}



/* Reduce font size in sidebar menu items (2pt smaller = ~0.875rem -> ~0.75rem) */
html body .fi-sidebar-item-label,
.fi-sidebar-item-label {
    font-size: 0.8125rem !important;
    line-height: 1.25rem !important;
}

/* Reduce sidebar group label font size */
html body .fi-sidebar-group-label,
.fi-sidebar-group-label {
    font-size: 0.6875rem !important;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Reduce vertical padding on menu items */
html body .fi-sidebar-item,
.fi-sidebar-item {
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
}

/* Reduce spacing between sidebar groups */
html body .fi-sidebar-group,
.fi-sidebar-group {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

/* Reduce padding inside sidebar nav */
html body .fi-sidebar-nav,
.fi-sidebar-nav {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    gap: 0 !important;
}

/* Navigation groups container */
html body .fi-sidebar-nav-groups,
.fi-sidebar-nav-groups {
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Reduce group label padding - same size as menu items */
html body .fi-sidebar-group-label,
.fi-sidebar-group-label {
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    font-size: 0.8125rem !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Navigation group button/header - minimal spacing */
html body .fi-sidebar-group-button,
.fi-sidebar-group-button {
    padding: 0.15rem 0 !important;
    margin: 0 !important;
    gap: 0 !important;
}

/* Remove extra spacing from group items container */
html body .fi-sidebar-group-items,
.fi-sidebar-group-items {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

/* All group states - zero extra spacing */
html body .fi-sidebar-group[data-collapsed],
.fi-sidebar-group[data-collapsed] {
    margin: 0 !important;
    padding: 0 !important;
}

/* Target any flex gaps in sidebar */
html body .fi-sidebar nav,
html body .fi-sidebar ul,
html body .fi-sidebar ol,
html body .fi-sidebar div,
.fi-sidebar nav,
.fi-sidebar ul,
.fi-sidebar ol {
    gap: 0 !important;
}

/* Sidebar list items */
html body .fi-sidebar li,
.fi-sidebar li {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   EXPAND WORKING AREA
   Reduce grey gap between sidebar and content
   Full width content with minimal padding
   ============================================ */

/* Main content area - minimal padding */
html body .fi-main,
.fi-main {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* The main content container - full width */
html body .fi-main-ctn,
.fi-main-ctn {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
}

/* Body/page content - no gap */
html body .fi-body,
.fi-body {
    gap: 0 !important;
}

/* Layout container - no gap between sidebar and content */
html body .fi-layout,
.fi-layout {
    gap: 0 !important;
}

/* Topbar alignment */
html body .fi-topbar,
.fi-topbar {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

/* Page header - minimal padding */
html body .fi-header,
.fi-header {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 0.5rem !important;
}

/* Page content area */
html body .fi-page,
.fi-page {
    padding: 0.5rem 0 !important;
}

/* Simple page content wrapper - full width */
html body .fi-simple-main-ctn,
.fi-simple-main-ctn {
    max-width: 100% !important;
}

/* Table container */
html body .fi-ta-ctn,
.fi-ta-ctn {
    padding: 0 !important;
}

/* Ensure full width content on all pages */
html body .fi-page > div,
.fi-page > div {
    max-width: 100% !important;
    width: 100% !important;
}

/* Resource pages - full width */
html body [class*="fi-resource-"],
[class*="fi-resource-"] {
    max-width: 100% !important;
}

/* Section content areas */
html body .fi-section-content,
.fi-section-content {
    padding: 0.75rem !important;
}

/* ============================================
   SIDEBAR - REMOVE SCROLL
   Prevent sidebar from scrolling, show all items
   ============================================ */

/* Remove overflow scroll from sidebar */
html body .fi-sidebar,
.fi-sidebar,
aside.fi-sidebar {
    overflow: visible !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Sidebar nav container - no scroll */
html body .fi-sidebar-nav,
.fi-sidebar-nav {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Sidebar nav groups - no scroll */
html body .fi-sidebar-nav-groups,
.fi-sidebar-nav-groups {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Inner sidebar content */
html body .fi-sidebar-content,
.fi-sidebar-content {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Sidebar group items container */
html body .fi-sidebar-group-items,
.fi-sidebar-group-items {
    overflow: visible !important;
    max-height: none !important;
}

/* Target the main scrollable container inside sidebar */
html body .fi-sidebar > div,
.fi-sidebar > div {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Sidebar wrapper/inner elements */
html body .fi-sidebar [style*="overflow"],
.fi-sidebar [style*="overflow"] {
    overflow: visible !important;
}

/* Dark mode - same rules */
.dark .fi-sidebar,
.dark .fi-sidebar-nav,
.dark .fi-sidebar-nav-groups {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
}

/* ============================================
   DASHBOARD STATS - COMPACT SINGLE ROW
   Force stats widgets to display in one row
   ============================================ */

/* Stats widget grid - force 8 columns */
.fi-wi-stats-overview-stats {
    display: grid !important;
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
}

/* Make stat cards smaller */
.fi-wi-stats-overview-stats > div {
    min-width: 0 !important;
}

/* Compact stat card styling */
.fi-wi-stats-overview-stat {
    padding: 0.75rem !important;
}

.fi-wi-stats-overview-stat-value {
    font-size: 1.25rem !important;
    line-height: 1.5rem !important;
}

.fi-wi-stats-overview-stat-label {
    font-size: 0.7rem !important;
}

.fi-wi-stats-overview-stat-description {
    font-size: 0.65rem !important;
}

/* ============================================
   FORM.IO DATE PICKER - CALENDAR BUTTON ON RIGHT
   Position calendar icon/button inline with input field
   ============================================ */

/* Date/DateTime input group - inline layout */
.formio-component-datetime .input-group,
.formio-component-day .input-group,
.formio-component-time .input-group,
#formio-submission-editor .input-group,
#digistain-form-submission .input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
}

/* Date input field - take remaining space */
.formio-component-datetime .input-group > input,
.formio-component-datetime .input-group > .form-control,
.formio-component-day .input-group > input,
.formio-component-time .input-group > input,
#formio-submission-editor .input-group > input,
#digistain-form-submission .input-group > input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* Calendar button container - right side */
.formio-component-datetime .input-group-append,
.formio-component-datetime .input-group-btn,
.formio-component-day .input-group-append,
.formio-component-time .input-group-append,
#formio-submission-editor .input-group-append,
#formio-submission-editor .input-group-btn,
#digistain-form-submission .input-group-append,
#digistain-form-submission .input-group-btn {
    display: flex !important;
    flex-shrink: 0 !important;
    margin-left: -1px !important;
}

/* Calendar button styling */
.formio-component-datetime .input-group-append .btn,
.formio-component-datetime .input-group-btn .btn,
.formio-component-day .input-group-append .btn,
.formio-component-time .input-group-append .btn,
#formio-submission-editor .input-group-append .btn,
#formio-submission-editor .input-group-btn .btn,
#digistain-form-submission .input-group-append .btn,
#digistain-form-submission .input-group-btn .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem 0.75rem !important;
    background-color: #e5e7eb !important;
    border: 1px solid #d1d5db !important;
}

/* Dark mode calendar button */
.dark .formio-component-datetime .input-group-append .btn,
.dark .formio-component-datetime .input-group-btn .btn,
.dark #formio-submission-editor .input-group-append .btn,
.dark #formio-submission-editor .input-group-btn .btn,
.dark #digistain-form-submission .input-group-append .btn,
.dark #digistain-form-submission .input-group-btn .btn {
    background-color: #4b5563 !important;
    border-color: #4b5563 !important;
    color: #e5e7eb !important;
}

/* Flatpickr input wrapper - inline */
.formio-component-datetime .flatpickr-wrapper,
.formio-component-day .flatpickr-wrapper,
#formio-submission-editor .flatpickr-wrapper,
#digistain-form-submission .flatpickr-wrapper {
    display: flex !important;
    flex: 1 1 auto !important;
    width: 100% !important;
}

/* Ensure proper alignment in form rows */
.formio-component-datetime,
.formio-component-day,
.formio-component-time {
    width: 100% !important;
}

/* Fix for nested input groups */
.formio-component-datetime .form-group .input-group,
#formio-submission-editor .formio-component-datetime .input-group,
#digistain-form-submission .formio-component-datetime .input-group {
    flex-wrap: nowrap !important;
}
