@import url('address.css');
@import url('login.css');
@import url('guest.css');

/* MudBlazor's own .mud-input rule hardcodes line-height:1.1876em (relative to the
   input's own font-size), so shrinking the form font-size via Typography also shrinks
   the input's box height, which throws off the floating label's fixed-pixel position.
   Restore the original ~19px line-height (1.1876 * 16px) using rem so it stays
   independent of the smaller input font-size. */
.mud-input {
    line-height: 1.1876rem;
}

/* Bump hyperlink text (row/card names in listing pages) up slightly from the
   reduced base form font size, for better readability/tap targets. */
.mud-link {
    font-size: 13px;
}

/* Match all listing/table column values (MudTable hardcodes .875rem/14px) to the
   same 13px as the hyperlink text above, so link and non-link columns line up. */
.mud-table-cell {
    font-size: 13px;
}

/* Drawer-style Add/Edit dialog: opt-in via <MudDialog Class="drawer-dialog">, paired
   with DialogOptions { Position = DialogPosition.CenterRight } so the container
   anchors it to the right edge. The container's default centerright padding/centering
   is overridden here so the panel spans full height flush with the viewport edge. */
.mud-dialog-centerright:has(.drawer-dialog) {
    padding-right: 0 !important;
    align-items: stretch !important;
}

.drawer-dialog {
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    animation: drawer-dialog-slide-in 0.25s ease-out;
}

@keyframes drawer-dialog-slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Floating labels on every form field app-wide (search bars, Add/Edit forms and
   dialogs) - MudBlazor hardcodes this at 1rem/16px, so it doesn't follow our Body1/
   Subtitle1 Typography change. When a field is empty, this label sits in the same
   resting position a placeholder would, so it needs to match the 13px value text. */
.mud-input-label {
    /* !important needed: MudBlazor's own label rule chains 3 classes via child
       combinators (higher specificity than a plain 2-class selector). */
    font-size: 13px !important;
}

/* Tips popover (MyAvailabilities) - global because MudPopover may render outside scoped CSS */
.tips-popover,
.tips-popover * {
    box-sizing: border-box;
}

.tips-popover,
.tips-popover.mud-popover-open,
.tips-popover .mud-popover,
.tips-popover .mud-paper,
.tips-popover .mud-popover-content {
    width: auto !important;
    min-width: 280px !important;
    max-width: min(420px, 90vw) !important;
}

.tips-popover-text {
    white-space: normal !important;
    word-break: break-word;
}

/* Fullscreen transparent overlay to close tips popover on outside click */
.tips-popover-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1200;
}

/* Branch dashboard panel shared styles */
.branch-panel{
    background:#fff;
    border:1px solid rgba(0,0,0,0.06);
    border-radius:3px;
    overflow:hidden;
}

.branch-panel__header{
    padding:16px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.branch-panel__header--tight{
    padding:14px 18px;
}

.branch-panel__title{
    font-weight:700;
}

/* MySessions - expanded child row table header */
.child-row-header {
    background-color: #bcdcf7 !important;
}

/* Light-grey grid header (used in ManageSessionLines services/treatments tables) */
.grid-header-light-grey {
    background-color: #f5f5f5 !important;
}

/* Table alignment utilities */
.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.text-phone {
    font-size: .875rem !important;
    text-align: start !important;
}
/* Buttons and toggles use normal case ("Add Appointment"), not ALL CAPS */
.mud-button-root, .mud-fab, .mud-toggle-item, .mud-tab, .mud-button-label {
    text-transform: none !important;
}

/* Card views: more breathing room between cards (list pages' card toggle) */
.mud-grid:not(.br-kpi-row) > .mud-grid-item:has(> .mud-card) {
    padding: 6px !important;
}

/* Booking / Session card views: narrower cards with generous gaps */
.br-card-grid {
    display: grid;
    gap: 28px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    justify-content: start;
    padding: 12px;
}
.br-card-grid > div > .mud-card { height: 100%; }
@media (max-width: 600px) {
    .br-card-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* Tables whose toolbar buttons moved to the host page: drop the empty toolbar strip */
.br-no-toolbar .mud-toolbar { display: none !important; }

/* Desktop list pages: table toolbar buttons (Add / Reload / view toggle) sit at the top right,
   beside the page title, instead of inside the table. Dialogs render outside .mud-main-content. */
@media (min-width: 960px) {
    .mud-main-content .mud-container { position: relative; }
    .mud-main-content .mud-table > .mud-toolbar:has(> :only-child) {
        background: transparent;
        height: auto !important;
        min-height: 0;
        display: flex;
        justify-content: flex-end;
        left: 0;
        padding: 0;
        pointer-events: none;
        position: absolute;
        right: 24px;
        top: 34px;
        width: auto;
        z-index: 5;
    }
    .mud-main-content .mud-table > .mud-toolbar:has(> :only-child) > * { pointer-events: auto; }
    .mud-main-content .mud-table > .mud-toolbar:has(> :only-child) > div { align-items: center; display: flex; gap: 8px; height: 36px; }
    .mud-main-content .mud-table > .mud-toolbar:has(> :only-child) > div > * + * { margin-left: 0 !important; }
    /* leave a gap between Add and Reload for the search icon: Add, Search, Reload, view toggle */
    .mud-main-content:has(.br-desk-search) .mud-table > .mud-toolbar:has(> :only-child) button[title="Reload"] { margin-left: 44px !important; }
    /* no Reload button: Add, then the search icon on its right */
    .mud-main-content:has(.br-desk-search) .mud-table > .mud-toolbar:has(> :only-child):not(:has(button[title="Reload"])) > * { margin-right: 44px; }
}

/* Desktop: the search/filter card is hidden until the search icon (left of Reload) is toggled */
.br-desk-search { display: none; }
@media (min-width: 960px) {
    .mud-main-content .br-desk-search {
        align-items: center;
        background: var(--mud-palette-secondary);
        border: 0;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        height: 36px;
        justify-content: center;
        position: absolute;
        right: calc(24px + var(--br-tb-w, 0px) + 8px);
        top: 34px;
        width: 36px;
        z-index: 5;
    }
    .mud-main-content .br-desk-search.br-on { background: var(--mud-palette-primary); }
    .mud-main-content .br-collapse:not(.br-open) > .br-collapse-body { display: none; }
    .br-host-page .br-desk-search { display: none; }
    /* tables inside tab panels keep their toolbar in place (the panel clips anything pinned outside it) */
    .mud-main-content .mud-tabs .mud-table > .mud-toolbar {
        justify-content: flex-start;
        left: auto !important;
        pointer-events: auto;
        position: static !important;
        right: auto !important;
        top: auto !important;
        width: auto;
    }
    /* toolbars that also hold the filter card (Services, ...) stay in place; the search icon sits with their buttons */
    .mud-main-content .mud-table > .mud-toolbar:has(.br-collapse) {
        left: auto !important;
        pointer-events: auto;
        position: static !important;
        right: auto !important;
        top: auto !important;
        width: auto;
    }
    .mud-main-content .mud-tabs .br-desk-search { float: right; margin: 0 0 8px; position: static !important; }
}

/* Working Hours & Time Off: reload/search live at the right end of the tab bar */
@media (min-width: 960px) {
    .br-hostx .br-desk-search,
    .br-hostx .mud-table > .mud-toolbar:has(> :only-child) { display: none !important; }
}
@media (min-width: 960px) {
    .br-hostx .mud-tabs button[title="Reload"] { display: none !important; }
}

/* Toolbars with extra content: only the button group is pinned top right; Reload text buttons shrink to icons */
.br-reload-icon.mud-button-root { min-width: 0 !important; padding: 0 !important; height: 36px; width: 36px; }
.br-reload-icon .mud-button-label { font-size: 0 !important; }
.br-reload-icon .mud-button-icon-start { margin: 0 !important; }
@media (min-width: 960px) {
    .mud-main-content .mud-table > .mud-toolbar:has(> .br-pin-group) { height: auto !important; min-height: 0 !important; padding-top: 0; padding-bottom: 0; }
    .mud-main-content .br-pin-group {
        align-items: center;
        display: flex;
        gap: 8px;
        height: 36px;
        left: auto;
        position: absolute;
        top: 34px;
        z-index: 5;
    }
    .mud-main-content:has(.br-desk-search) .br-pin-group button[title="Reload"] { margin-left: 44px !important; }
    .mud-main-content:has(.br-desk-search) .br-pin-group:not(:has(button[title="Reload"])) { margin-right: 44px; }
}

/* The toolbar that held a tab-pinned button shrinks to nothing */
@media (min-width: 960px) {
    .br-hostx .mud-table > .mud-toolbar:has(.br-issue-btn) { height: 0 !important; min-height: 0 !important; overflow: visible; padding: 0; }
}

/* Same list header height everywhere (matches Clients): dense tables get the same header padding */
@media (min-width: 960px) {
    .mud-main-content .mud-table:not(.mud-table-body .mud-table) .mud-table-head .mud-table-cell { padding: 16px !important; }
}

/* Inline toolbar search field sits on the button row, left of the pinned buttons */
@media (min-width: 960px) {
    .mud-main-content .br-pin-search { margin: 0 !important; position: absolute; width: 260px; z-index: 5; }
}

/* Phones only: a toolbar that keeps a visible action button (e.g. "Collect payment") gets breathing room above and below */
@media (max-width: 959.95px) {
    .mud-main-content .mud-table > .mud-toolbar:has(.mud-button-root:not(.br-fab-mobile):not(.br-btn-hide):not([title="Reload"]):not([title="Search"])) {
        padding: 12px 0 !important;
    }
}

/* Phones, Bookings & Sessions: "Add Appointment" is the floating + circle; the search / view icons share the toggle's row, on its right */
@media (max-width: 959.95px) {
    .br-host-page .br-host-row { flex-wrap: nowrap !important; }
    .br-host-page .br-host-row > .d-flex { margin-left: auto; flex-shrink: 0; }
}

/* Phones: the tab-bar action icons (Working Hours & Time Off, Invoices, Therapist Payouts) become a normal row above the tabs instead of floating over them */
@media (max-width: 959.95px) {
    .br-hostx-actions { flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; position: static !important; }
}

@media (min-width: 960px) {
    .mud-main-content .br-pin-group > * + * { margin-left: 0 !important; }
    .mud-main-content .br-pin-group > *:not(:last-child), .mud-main-content .mud-table > .mud-toolbar:has(> :only-child) > div > *:not(:last-child) { margin-right: 0 !important; }
}

/* Row action cells keep the next-step button and the "..." menu on one line */
@media (min-width: 960px) {
    .mud-table td.mud-table-cell[data-label="Actions"] { white-space: nowrap; }
}
