/* =============================================================================
   APP STYLES
   ============================================================================= */

/* Make the main content area a flex column so children can use flex-grow */
.mud-main-content {
    display: flex;
    flex-direction: column;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner-container {
    background: white;
    border-radius: 8px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* MudBlazor Table Toolbar - Allow height increase */
.mud-table-toolbar {
    height: auto;
    padding-top: 8px;
}

/* MudBlazor Drawer - Slower hover transition */
.mud-drawer {
    transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* MudBlazor NavLink - Prevent text wrapping during drawer transition */
.mud-nav-link {
    white-space: nowrap;
}

/* Speech/voice input adornment icon — smaller to sit neatly inside the field */
.mud-input-adornment-icon-button .mud-icon-root {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Preserve case in button labels */
.mud-button-label {
    text-transform: none;
}

/* Preserve case in tab labels (prevent uppercase forcing) */
.mud-tab {
    position: relative;
    min-height: unset !important;
    min-width: unset !important;
    text-transform: none !important;
}

/* Vertical divider after every tab including the last, so + sits after a bar */
.mud-tabs-tabbar-wrapper .mud-tooltip-root .mud-tab::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background-color: var(--mud-palette-lines-default);
}

/* Tab bar layout: tabs scroll, header-after (+ button) never shrinks, items center-aligned
   so the underline sits at the same visual distance regardless of header content height */
.mud-tabs-tabbar-inner {
    justify-content: flex-start !important;
    align-items: center;
}

.mud-tabs-tabbar-content {
    flex: 1 1 0 !important;
    max-width: max-content !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.mud-tabs-header-after {
    flex-shrink: 0 !important;
    align-items: center !important;
}

/* Ensure tab panels fill remaining height. MudBlazor only sets flex-grow:1 on .mud-tabs-panels
   when mud-tabs-rounded is on the root element, but ApplyEffectsToContainer="false" prevents that. */
.mud-tabs.grow .mud-tabs-panels {
    flex-grow: 1;
    min-height: 0;
}

/* Tab label: icon + text inline */
.tab-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* MudTab Close adornment icon — smaller, only visible on active tab */
.mud-tab-close-icon {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    padding: 2px !important;
    visibility: hidden;
}

.mud-tab-active .mud-tab-close-icon {
    visibility: visible;
}

.mud-tab-close-icon .mud-icon-root {
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
    color: var(--mud-palette-error) !important;
}
/* Tab MoreVert menu button — hidden on inactive/non-hovered tabs */
.tab-more-btn {
    display: inline-flex;
    align-items: center;
    visibility: hidden;
}

.mud-tab-active .tab-more-btn,
.mud-tab:hover .tab-more-btn {
    visibility: visible;
}

.tab-more-btn .mud-icon-button {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    padding: 0 !important;
}

.tab-more-btn .mud-icon-root {
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
}

/* SpeechTextArea */
.speech-textarea-root {
    position: relative;
    flex: 1;
    min-height: 0;
}

.speech-textarea {
    flex: 1;
    padding: 12px 40px 12px 14px;
    border: none;
    background: transparent;
    resize: vertical;
    overflow-y: auto;
    outline: none;
    box-sizing: border-box;
    color: inherit;
}

.speech-textarea::placeholder {
    color: var(--mud-palette-text-disabled);
}

.speech-textarea[readonly] {
    opacity: 0.6;
}

.speech-textarea-mic {
    position: absolute !important;
    top: 4px;
    right: 4px;
}

/* File viewer panel */
.file-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
}

.file-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}

.file-viewer-iframe {
    width: 100%;
    flex: 1;
    min-height: 0;
    border: none;
}

.mic-chip-btn {
    text-transform: none !important;
    font-size: 0.75rem !important;
    border-radius: 16px !important;
    min-height: 28px !important;
    padding: 2px 8px !important;
    max-width: 160px;
}

.mic-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 110px;
}

/* Legal document pages (Terms/Privacy/DPA) - typography for plain-HTML content
   pasted verbatim into a MudPaper, since the source copy already comes as h1/h2/p/ul. */
.legal-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--mud-palette-text-primary);
}

.legal-content h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--mud-palette-text-primary);
}

.legal-content h2:first-of-type {
    margin-top: 0;
}

.legal-content p {
    font-size: 0.9375rem;
    line-height: 1.7;
    margin: 0 0 1rem;
    color: var(--mud-palette-text-primary);
}

.legal-content ul {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}

.legal-content li {
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 0.4rem;
    color: var(--mud-palette-text-primary);
}

.legal-content strong {
    font-weight: 600;
}

.legal-content a {
    color: var(--mud-palette-primary);
}