/* ================================================
   Neo-Dense Dialog Styles
   Two-column layout styles for dense dialogs
   ================================================ */

/* Two-column layout */
.neo-dense .mud-grid {
    width: 100%;
    margin: 0 !important;
}

/* DEFECT-12337: Improved grid item spacing for better visual hierarchy */
/* Use 8px padding for adequate white space between fields */
.neo-dense .mud-grid-item {
    padding: 8px !important;
}

/* Exception: Preserve padding for grid items containing AccessibleSwitch */
.neo-dense .mud-grid-item:has(> .accessible-switch-container) {
    padding: 12px !important;
}

/* Exception: Preserve padding for grid items containing nested grids with AccessibleSwitch */
.neo-dense .mud-grid-item:has(.accessible-switch-container) {
    padding: 12px !important;
    overflow: visible !important;
}

/* Ensure nested grids with AccessibleSwitch are not constrained */
.neo-dense .mud-grid-item .mud-grid:has(.accessible-switch-container) {
    overflow: visible !important;
}

.neo-dense .mud-grid-item .mud-grid .mud-grid-item:has(.accessible-switch-container) {
    overflow: visible !important;
    padding: 0 !important;
}

.neo-dense .mud-grid-item:first-child {
   border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.neo-dense .mud-grid-item:last-child {
    padding-left: 16px !important;
}

/* Section headers */
.neo-section {
    font-weight: 700;
    font-size: .9rem;
    margin: 0 0 20px 0 !important;
    padding: 0 0 8px 0 !important;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e5e7eb;
    height: 28px;
    box-sizing: border-box;
}

/* Status toggle */
.neo-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f3f4f6;
    margin: 0 0 20px 0 !important;
    transition: background-color 0.2s ease;
}

.neo-status.active {
    background: #dbeafe;
    border-left: 4px solid #2563eb;
}

.neo-status.inactive {
    background: #f1f5f9;
    border-left: 4px solid #64748b;
}

.neo-status-label {
    font-weight: 500;
    color: #374151;
    margin: 0;
    transition: color 0.2s ease;
}

.neo-status.active .neo-status-label {
    color: #1d4ed8;
    font-weight: 600;
}

.neo-status.inactive .neo-status-label {
    color: #475569;
    font-weight: 600;
}

/* Switch positioning */
.neo-status .mud-switch {
    margin: 0 !important;
    margin-right: 0 !important;
}

.neo-status .mud-switch-label {
    margin-left: 8px !important;
}

/* Field sizing - ensure consistent width across all field types */
.neo-dense .mud-input,
.neo-dense .mud-select,
.neo-dense .mud-input-control,
.neo-dense .mud-input-control-input-container,
.neo-dense .mud-input-outlined,
.neo-dense .mud-select-outlined {
    width: 100%;
}

/* Ensure all direct children of grid items fill completely - exclude style tags and custom components */
.neo-dense .mud-grid-item > .mud-input-control:not(.accessible-switch-container),
.neo-dense .mud-grid-item > .mud-select:not(.accessible-switch-container) {
    width: 100% !important;
    display: block !important;
}

/* Ensure all input controls and selects inside grid items are full width - BUT NOT inside AccessibleSwitch */
.neo-dense .mud-grid-item .mud-input-control:not(.accessible-switch-container),
.neo-dense .mud-grid-item .mud-select:not(.accessible-switch-container) {
    width: 100% !important;
}

/* Exception: Do NOT force width on any controls inside AccessibleSwitch */
.neo-dense .accessible-switch-container .mud-input-control,
.neo-dense .accessible-switch-container .mud-select,
.neo-dense .accessible-switch-container .mud-switch {
    width: auto !important;
    max-width: fit-content !important;
}

/* Override any inline or default widths on text fields to match selects */
.neo-dense .mud-input-outlined.mud-input {
    width: 100%;
    max-width: none;
}

/* Vertical divider */
.mud-divider-vertical {
    width: 1px !important;
    background: rgba(0, 0, 0, 0.12) !important;
    height: 400px !important;
    min-height: 400px !important;
}

/* Helper text styling */
.text-muted {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 8px 0 20px 0 !important;
    padding: 0 !important;
    font-style: italic;
}

/* Spacing utilities */
.neo-dense .mt-2 {
    margin-top: 8px !important;
}

.neo-dense .mt-4 {
    margin-top: 20px !important;
}

/* Field container spacing */
.neo-dense .mud-form-control > .mud-input-control,
.neo-dense .mud-form-control > .mud-select {
    margin: 0 !important;
}

/* Consistent field heights - use system standard */
.neo-dense .mud-input-outlined .mud-input-root,
.neo-dense .mud-select-outlined .mud-input-root {
    height: var(--form-field-height);
    min-height: var(--form-field-height);
}

/* Field padding - let system defaults apply */
.neo-dense .mud-input-outlined .mud-input-root input,
.neo-dense .mud-select-outlined .mud-input-root input {
    height: auto;
    line-height: 1.4;
}

/* Select-specific styling */
.neo-dense .mud-select-outlined .mud-select-input {
    height: var(--form-field-height);
    min-height: var(--form-field-height);
    line-height: 1.4;
    display: flex;
    align-items: center;
}

/* Dropdown arrow positioning */
.neo-dense .mud-select-outlined .mud-input-adornment {
    height: var(--form-field-height);
    display: flex;
    align-items: center;
}

/* Label positioning */
.neo-dense .mud-input-outlined .mud-input-label,
.neo-dense .mud-select-outlined .mud-input-label {
    font-size: 0.875rem;
}

.neo-dense .mud-input-outlined.mud-input-label-outside .mud-input-label,
.neo-dense .mud-select-outlined.mud-input-label-outside .mud-input-label {
    top: -6px !important;
    font-size: 0.75rem !important;
}

/* Multiline textarea */
.neo-dense .mud-input-outlined .mud-input-root textarea {
    height: 72px !important;
    min-height: 72px !important;
    padding: 12px 12px 4px 12px !important;
    line-height: 1.3 !important;
    resize: vertical;
}

/* ================================================
   Neo-Tabs Styles
   Enhanced tab styling for dialog forms
   ================================================ */

.neo-tabs {
    background: transparent !important;
    border-bottom: 1px solid #e5e7eb !important;
    margin-bottom: 20px !important;
}

/* Add consistent padding to tab panels */
.neo-tabs .mud-tabs-panels {
    padding: 16px !important;
}

/* Ensure MudGrid inside tab panels has no extra margin */
.neo-tabs .mud-tabs-panels .mud-grid {
    margin: 0 !important;
}

.neo-tabs .mud-tabs-toolbar {
    background: transparent !important;
    border-bottom: none !important;
    min-height: 48px !important;
}

/* ================================================
   Pill-Tabs Styles (Benefit Dialog)
   Modern pill-style tabs with centered layout
   ================================================ */

/* TOOLBAR - Centered Pills */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabs-tabbar,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabs-tabbar,
.pill-tabs.mud-tabs .mud-tabs-tabbar {
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

/* TOOLBAR INNER - Where pills actually are */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabs-tabbar-wrapper,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabs-tabbar-wrapper,
.pill-tabs.mud-tabs .mud-tabs-tabbar-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: visible !important;
}

/* PILL BUTTONS */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab,
.pill-tabs.mud-tabs .mud-tab {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    white-space: nowrap !important;
    padding: 6px 16px !important;
    min-height: 32px !important;
    height: 32px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

/* PILL HOVER STATE */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab:hover,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab:hover,
.pill-tabs.mud-tabs .mud-tab:hover {
    background: #f0fdfa !important;
    border-color: #14b8a6 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2) !important;
}

.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab:hover *,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab:hover *,
.pill-tabs.mud-tabs .mud-tab:hover * {
    color: #14b8a6 !important;
}

/* PILL ACTIVE STATE */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab.mud-tab-active,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab.mud-tab-active,
.pill-tabs.mud-tabs .mud-tab.mud-tab-active {
    background: #14b8a6 !important;
    border-color: #14b8a6 !important;
    color: #ffffff !important;
}

.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab.mud-tab-active *,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab.mud-tab-active *,
.pill-tabs.mud-tabs .mud-tab.mud-tab-active * {
    color: #ffffff !important;
}

/* HIDE TAB SLIDER */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab-slider,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tab-slider,
.pill-tabs.mud-tabs .mud-tab-slider {
    display: none !important;
}

/* TAB PANELS - FIXED HEIGHT */
.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabpanel,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabpanel,
.pill-tabs.mud-tabs .mud-tabpanel {
    min-height: 500px !important;
    max-height: 500px !important;
    height: 500px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
    padding: 16px 24px !important;
    box-sizing: border-box !important;
}

.mud-dialog.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabpanel > *,
.benefit-dialog-wrapper .pill-tabs.mud-tabs .mud-tabpanel > *,
.pill-tabs.mud-tabs .mud-tabpanel > * {
    max-width: 100% !important;
}

/* DIALOG WIDTH - Target the MudDialog wrapper directly */
.mud-dialog-container .mud-dialog.benefit-dialog-wrapper,
.mud-dialog.benefit-dialog-wrapper,
.mud-dialog-width-false.benefit-dialog-wrapper {
    max-width: 1000px !important;
    width: 1000px !important;
    min-width: 1000px !important;
}

/* DEDUCTION DIALOG WIDTH - Restored to 1000px to match Benefit dialog pattern */
.mud-dialog-container .mud-dialog.deduction-dialog-wrapper,
.mud-dialog.deduction-dialog-wrapper,
.mud-dialog-width-false.deduction-dialog-wrapper {
    max-width: 1000px !important;
    width: 1000px !important;
    min-width: 1000px !important;
}

/* DEFECT-12705: Fix deduction dialog extending beyond viewport */
/* Constrain dialog height with scrollable content */
.deduction-dialog-wrapper .mud-dialog-content {
    overflow: hidden !important;
    max-height: calc(90vh - 160px) !important;
}

/* DEFECT-12705: Deduction dialog tab panels with flexible height for narrower dialog */
/* Note: MudBlazor renders content directly in .mud-tabs-panels (no .mud-tabpanel wrapper) */
.deduction-dialog-wrapper .pill-tabs .mud-tabs-panels {
    min-height: 350px !important;
    max-height: calc(90vh - 280px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 12px 16px !important;
}

.neo-tabs .mud-tab {
    min-height: 48px !important;
    padding: 12px 20px !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: #6b7280 !important;
    border-radius: 8px 8px 0 0 !important;
    margin-right: 4px !important;
    transition: all 0.2s ease !important;
    background: transparent !important;
}

.neo-tabs .mud-tab:hover {
    background: #f9fafb !important;
    color: #374151 !important;
}

.neo-tabs .mud-tab.mud-tab-active {
    background: #ffffff !important;
    color: #2563eb !important;
    font-weight: 600 !important;
    border: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #ffffff !important;
    margin-bottom: -1px !important;
    z-index: 1 !important;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.02) !important;
}

.neo-tabs .mud-tab-panel {
    padding: 20px 0 !important;
    background: transparent !important;
}

.neo-tabs .mud-tab .mud-icon-root {
    margin-right: 8px !important;
    font-size: 1rem !important;
    opacity: 0.8 !important;
}

.neo-tabs .mud-tab.mud-tab-active .mud-icon-root {
    opacity: 1 !important;
}

/* Tab content spacing */
.neo-tabs .mud-tab-panel > *:first-child {
    margin-top: 0 !important;
}

.neo-tabs .mud-tab-panel > *:last-child {
    margin-bottom: 0 !important;
}
