/* Shared right slide-out drawer shell. Served from AAAWebApp/wwwroot at css/drawer.css and
   linked globally from AAAWebApp/App/App.razor. Used by AttributesDrawer, NotesDrawer and any
   future right-hand drawer rendered inside a Radzen side dialog. Component-specific content
   (sections, grids, footers) stays in each component's scoped .razor.css. */
.drawer {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
}

/* Header - pinned; the drawer body is the only scrolling region. */
.drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    flex: 0 0 auto;
    background: color-mix(in srgb, var(--acc) 8%, #fff);
    border-bottom: 1px solid var(--border);
}

/* Title column: the title alone, or the title over an optional strapline. */
.drawer-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.drawer-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--txt);
}

.drawer-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.drawer-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--txt);
    cursor: pointer;
    transition: background-color .12s;
}

.drawer-icon-btn:hover {
    background: var(--border);
}

/* Body */
.drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 24px 24px 12px;
}

/* Footer - pinned below the scrolling body (flex column + bounded body) so action
   buttons stay visible while the body scrolls. Buttons are right-aligned,
   secondary-then-primary, matching the centred-modal footer standard. */
.drawer-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.drawer-footer-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    padding: 8px 0;
}

.drawer-footer-back:hover {
    color: var(--txt);
}

.drawer-footer-back .rz-icon {
    font-size: 18px;
}

/* Shared lift for any modal opened on top of an open right-hand drawer. The drawer is itself a
   Radzen side dialog at --rz-dialog-zindex (1001); these modals must sit above it. One source of
   truth for the value, shared by the centred and the docked-right variants below.
   --aaa-under-drawer-zindex is the mirror image: a panel that must sit BELOW the side-dialog layer
   so the drawers opened from it stack over it (see .content-area-panel). */
:root {
    --aaa-over-drawer-zindex: 1051;
    --aaa-under-drawer-zindex: 1000;
}

/* A modal dialog that opens centred on screen (default Radzen layout) but on top of an open
   right-hand drawer (e.g. the add/edit Note dialog over the Notes drawer). Only lifts the
   z-index above the drawer; keeps the default centred positioning. Applied via WrapperCssClass. */
.modal-centered-over-drawer {
    z-index: var(--aaa-over-drawer-zindex);
}

/* A right-hand drawer opened on top of another open drawer (e.g. HMO Classification opened from
   the Local Authority Info drawer's read-only reference link). Radzen has a single side-dialog
   slot, so the second drawer is opened as a modal (DialogService.OpenAsync) and docked to the
   right here so it still reads as a slide-over stacked above the first. Closing it returns to the
   underlying drawer, untouched. Applied via WrapperCssClass; the modal's Width sets its width. */
.drawer-over-drawer {
    z-index: var(--aaa-over-drawer-zindex);
}

.drawer-over-drawer .rz-dialog {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
}

/* Let the DrawerShell (.drawer, height:100%) fill the dialog edge-to-edge, like the side dialog. */
.drawer-over-drawer .rz-dialog .rz-dialog-content {
    height: 100%;
    padding: 0;
}

/* A stacked drawer that is full width. The modal's Width of 100% is 100% of the viewport, which
   covers the sidebar, so a full-width register stacked over another drawer would sit further left
   than the same register opened on its own. Size it to the content area instead, matching
   .full-width-drawer in aaa-theme.css, so it stops at the sidebar wherever it is opened from.
   Opt in with Drawers.DrawerOverDrawerFullWidthCssClass. */
.drawer-over-drawer.full-width-drawer .rz-dialog {
    width: calc(100vw - var(--sbw)) !important;
    max-width: calc(100vw - var(--sbw)) !important;
}

body.shell-sb-collapsed .drawer-over-drawer.full-width-drawer .rz-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
}

@media (max-width: 768px) {
    .drawer-over-drawer.full-width-drawer .rz-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
    }
}

/* A full-width panel filling the content area, opened as a modal (DialogService.OpenAsync) over the
   page beneath it - the Property Details panel over the property list. It is deliberately a modal
   and not a side dialog: Radzen has a single side-dialog slot, and this panel's own cards each open
   their section drawer into it, so the panel has to leave that slot free and sit BELOW it. Sized to
   match .full-width-drawer (viewport minus the sidebar) so it reads as the same full-width drawer.
   Applied via WrapperCssClass. */
.content-area-panel {
    z-index: var(--aaa-under-drawer-zindex);
}

.content-area-panel .rz-dialog {
    position: fixed;
    top: 0;
    right: 0;
    width: calc(100vw - var(--sbw)) !important;
    max-width: calc(100vw - var(--sbw)) !important;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
}

body.shell-sb-collapsed .content-area-panel .rz-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
}

@media (max-width: 768px) {
    .content-area-panel .rz-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
    }
}

.content-area-panel .rz-dialog .rz-dialog-content {
    height: 100%;
    padding: 0;
}

/* Slide in from the right like a side drawer. A Radzen modal fades and scales by default
   (rz-dialog-open-opacity / -scale); reuse Radzen's own side-dialog keyframes and timing variable so
   this panel opens with exactly the same motion as the drawers that stack over it. */
.content-area-panel .rz-dialog.rz-open {
    animation: var(--rz-dialog-transition) rz-side-dialog-right-open;
}

.help-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.help-content {
    color: var(--txt);
    line-height: 1.55;
}

.help-content h1,
.help-content h2,
.help-content h3 {
    color: var(--txt);
    font-weight: 700;
    margin: 20px 0 10px;
}

.help-content h1 {
    font-size: 26px;
    margin-top: 0;
}

.help-content h2 {
    font-size: 19px;
}

.help-content h3 {
    font-size: 16px;
}

.help-content p,
.help-content ul,
.help-content ol {
    margin-bottom: 12px;
}

.help-content ul,
.help-content ol {
    padding-left: 22px;
}

.help-content a {
    font-weight: 600;
}

.help-content code {
    background: color-mix(in srgb, var(--acc) 8%, #fff);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 4px;
}

.help-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.help-content th,
.help-content td {
    border: 1px solid var(--border);
    padding: 8px;
    vertical-align: top;
}

.help-content th {
    background: color-mix(in srgb, var(--acc) 8%, #fff);
}

/* ---- Centred record modal header ----------------------------------------------------------
   Shared by the record modals that open with ShowTitle off and own their own chrome (the agency
   record, the tenant / prospective tenant card). A tinted bar carrying the record's initial, its
   name and strapline, then whatever the modal puts after them - a status chip and a close. */

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--acc) 6%, var(--surface));
}

.modal-head-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--aaa-radius);
    background: color-mix(in srgb, var(--acc) 15%, var(--surface));
    color: var(--acc);
    font-weight: 700;
}

.modal-head-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.modal-head-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--acc);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-head-sub {
    font-size: 12px;
    color: var(--muted);
}
