/* ---------------------------------------------------------------------------
   Shared data-entry form styling (ls-form)
   ---------------------------------------------------------------------------
   Opt-in: add class="ls-form" to the container that wraps a data-entry form.
   Gives every form a tidy two-column, left-aligned layout:
     - labels form a fixed-width left column
     - controls line up in a second, left-aligned column
     - consistent vertical spacing between fields
   Scoped to .ls-form so listing/grid tables (which also live inside a <form>,
   e.g. BookingIndex) are never affected.
--------------------------------------------------------------------------- */

/* Remove the default fieldset chrome so grouped sections blend in. */
.ls-form fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

/* Two-column grid for the table-based forms. */
.ls-form table {
    border-collapse: separate;
    border-spacing: 0 6px; /* vertical spacing between fields */
}

.ls-form td {
    vertical-align: top;
    padding: 2px 10px 2px 0;
}

/* Left column: labels. Fixed width so every control starts at the same x.
   Targets both the explicit .label-col class and the first cell of a row so
   existing forms line up without needing per-cell class changes. */
.ls-form td.label-col,
.ls-form tr > td:first-child {
    width: 210px;
    font-weight: bold;
    white-space: nowrap;
}

/* Right column: controls, left-aligned so they form a tidy second column. */
.ls-form td.field-col,
.ls-form tr > td:first-child + td {
    text-align: left;
    font-weight: normal;
}

.ls-form input[type="text"],
.ls-form input[type="password"],
.ls-form input[type="email"],
.ls-form input[type="date"],
.ls-form input[type="number"],
.ls-form select,
.ls-form textarea {
    box-sizing: border-box;
}

/* Consistent default width for single-line text inputs. */
.ls-form input.form-input,
.ls-form input[type="text"],
.ls-form input[type="password"],
.ls-form input[type="email"],
.ls-form input[type="date"],
.ls-form input[type="number"] {
    width: 320px;
}

/* File inputs and checkbox-group wrappers should not be forced to 320px. */
.ls-form input[type="file"],
.ls-form input[type="checkbox"],
.ls-form input[type="radio"] {
    width: auto;
}

.ls-form .field-hint {
    color: #555;
    margin-left: 8px;
}

/* ---------------------------------------------------------------------------
   Div-based forms using the ASP.NET MVC editor-label / editor-field pattern
   (e.g. LogOn). Lay them out with the same label width and spacing so they
   match the table-based forms.
--------------------------------------------------------------------------- */
.ls-form .editor-label {
    display: inline-block;
    width: 210px;
    font-weight: bold;
    vertical-align: top;
    padding: 6px 10px 6px 0;
}

.ls-form .editor-field {
    display: inline-block;
    vertical-align: top;
    padding: 6px 0;
}

.ls-form .editor-field input[type="text"],
.ls-form .editor-field input[type="password"],
.ls-form .editor-field input[type="email"] {
    width: 320px;
}

/* ---------------------------------------------------------------------------
   Sticky footer
   ---------------------------------------------------------------------------
   Keeps the black #footer section pinned to the bottom of the viewport on
   short pages (so it doesn't "float up" into the middle), while still sitting
   below the content normally on long pages. Uses a flex column on the body so
   the main content area grows to absorb any spare vertical space.
--------------------------------------------------------------------------- */
html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Body section order is: (1) spacer feature-wrapper, (2) content
   feature-wrapper (renders @RenderBody), (3) #footer. The content section
   (2nd <section>) grows to fill spare space and push the footer down; the
   footer keeps its natural height. */
body > section:nth-of-type(2) {
    flex: 1 0 auto;
}

body > section#footer {
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Header background
   ---------------------------------------------------------------------------
   The theme leaves the header transparent at the top of the page and only adds
   a black background once you scroll (via the .affix class). Give the header a
   black background at all scroll positions so it's consistent on load too.
--------------------------------------------------------------------------- */
body .header,
body .header.affix {
    background: #000;
}

/* ---------------------------------------------------------------------------
   Side menu (two-column: action links left, content right)
   ---------------------------------------------------------------------------
   The menu partials (Admin/Client/ClientAgent/Interpreter/Booking) render their
   bulleted action links inside a .side-menu wrapper. We lay the page out as two
   distinct, NON-overlapping columns: a fixed-width menu column on the left and
   the page content in its own column to the right.

   Technique: the content container (.container.aligncenter, which holds both the
   menu and the body) gets a left padding equal to the menu column width, and the
   .side-menu is absolutely positioned inside that left gutter. Because the
   content is padded clear of the gutter, nothing can overlap the menu regardless
   of how long a menu label is.
--------------------------------------------------------------------------- */
:root {
    --side-menu-width: 180px;
    --side-menu-gap: 12px;
    /* Height of the fixed site header once it affixes to the top of the viewport
       on scroll (logo 60px + 12px top/bottom padding ≈ 84px). The sticky side
       menu freezes just below this so its first item isn't hidden behind the
       header. A little extra breathing room is included. */
    --site-header-height: 96px;
}

/* Two-column layout for logged-in menu pages. Only applies when a .side-menu is
   present, so public/login pages are unaffected.

   The content container is widened to reclaim Bootstrap's large centered side
   margins. The menu is absolutely positioned into a fixed-width left gutter and
   the container is padded left by that same width, so ALL content (including wide
   invoice/booking grids) stays in the right column and never drops below the
   menu, regardless of content width or height. */
section#features .container.aligncenter:has(.side-menu) {
    position: relative;
    /* Left-align the whole content block near the screen's left edge (override
       Bootstrap's auto-centering) so there's no big empty gap before the menu. */
    width: auto !important;
    max-width: none;
    margin-left: 8px;
    margin-right: 8px;
    box-sizing: border-box;
    padding-left: calc(var(--side-menu-width) + var(--side-menu-gap));
    /* Hold at least the longest (admin) menu's height so a short-content page
       can't let the absolutely-positioned menu overflow past the container. */
    min-height: 360px;
    /* Establish a block formatting context so the page title's top margin stays
       INSIDE the container (no margin collapse). That makes the title and the
       menu share the same top edge on every page. */
    display: flow-root;
    /* Draw the column divider as a vertical line in the gutter so it spans the
       full container height without clipping the (natural-height) menu. */
    background-image: linear-gradient(#ddd, #ddd);
    background-size: 1px 100%;
    background-position: var(--side-menu-width) 0;
    background-repeat: no-repeat;
}

/* Views wrap the menu partial in layout <br/> tags (before and after it), and
   the page title (<h2>) sits in different places relative to them. Those breaks
   are what pushed the menu and title down by different amounts on each page, so
   neutralise just the ones adjacent to the menu. The title then starts at the
   very top of the content column on every page, and the menu (top: 0 below)
   starts at the same line. */
section#features .container.aligncenter:has(.side-menu) br:has(+ .side-menu),
section#features .container.aligncenter:has(.side-menu) .side-menu + br {
    display: none;
}

/* Page title: no top margin, so its top edge is the container's top edge. */
section#features .container.aligncenter:has(.side-menu) h2 {
    margin-top: 0;
}

.side-menu {
    /* Float the menu into the left gutter (the container reserves the space with
       its matching padding-left) and make it sticky so it stays in view while the
       content pane scrolls. A floated element lets the page content flow in the
       column to its right; `position: sticky` keeps the floated box pinned near
       the top of the viewport once the page is scrolled down far enough. The
       negative left margin pulls the box out of the content column and into the
       padded gutter so it lines up with the left edge like before.

       `top` is the offset from the top of the viewport at which the menu freezes.
       The site header affixes (position: fixed) to the top of the viewport on
       scroll, so the menu must freeze BELOW it or the first item is hidden behind
       the header. Offset by the header's height. */
    float: left;
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: var(--site-header-height);
    margin-left: calc(-1 * (var(--side-menu-width) + var(--side-menu-gap)));
    width: var(--side-menu-width);
    box-sizing: border-box;
    padding-right: 10px;
}

.side-menu ul {
    list-style: disc;
    margin: 0;
    /* Keep bullets near the left edge; the li padding gives breathing room
       between the bullet and the link text. */
    padding-left: 16px;
}

/* The menu links carry an inline font-size:large, which made most labels wrap
   onto 2-3 lines and pushed the list off the bottom of the page. A slightly
   smaller size lets every item fit (an inline style can only be overridden
   with !important). */
.side-menu a {
    font-size: 14px !important;
}

.side-menu li {
    margin-bottom: 4px;
    /* A little space between the bullet and the link text so items don't look
       cramped against the marker. */
    padding-left: 6px;
    text-align: left;
}

/* On narrow viewports, stack the menu above the content (original behaviour). */
@media (max-width: 768px) {
    section#features .container.aligncenter:has(.side-menu) {
        width: auto !important;
        padding-left: 0;
    }

    .side-menu {
        position: static;
        float: none;
        width: auto;
        top: auto;
        bottom: auto;
        margin-left: 0;
        border-right: none;
        padding-right: 0;
        margin-bottom: 15px;
    }
}

/* ---------------------------------------------------------------------------
   Invoice results table
   ---------------------------------------------------------------------------
   The invoice results grid has many columns, so its header labels (set inline
   with white-space:nowrap) force wide columns and a cramped layout. Allow the
   HEADER cells (first row) to wrap over two lines so e.g. "Travel Expenses"
   stacks, narrowing the columns. The inline nowrap needs !important to override.
   Data rows keep their own styling.
--------------------------------------------------------------------------- */
table.invoice-results {
    border-collapse: collapse;
    table-layout: auto;
    /* Separate the results from the Start/End date and action controls above. */
    margin-top: 22px;
}

table.invoice-results > tbody > tr:first-child > td {
    white-space: normal !important;
    vertical-align: bottom;
    padding: 2px 6px;
    line-height: 1.2;
}

/* Give every invoice cell a little horizontal breathing room so adjacent
   columns don't touch, while keeping the columns fairly close together. */
table.invoice-results > tbody > tr > td {
    padding-right: 10px;
}

/* The Detail cell renders its content in a bordered <pre> box; keep it off the
   next (Fee) column with a right margin and tidy its default spacing. */
table.invoice-results td pre {
    margin: 0 10px 0 0;
    display: inline-block;
    /* The Detail box now carries the whole cost breakdown (fee with hours x rate and
       VAT, travel time, travel expenses), so let it read as normal text lines
       instead of the cramped monospace of a code block, and never wrap mid-figure. */
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    white-space: pre;
}

/* ---------------------------------------------------------------------------
   Compact header and footer
   ---------------------------------------------------------------------------
   The template's header/footer carry a lot of vertical padding and margin.
   These overrides slim both bars down without changing their layout.
--------------------------------------------------------------------------- */

/* Header: a moderate height - slimmer than the template default but not as thin
   as the first pass, with a bit more breathing room top and bottom. */
body .header {
    padding-top: 12px;
    padding-bottom: 12px;
}

body .header .navbar-default {
    margin-top: 0;
    margin-bottom: 0;
    min-height: 0;
}

body .header .navbar-brand {
    height: auto;
    padding: 0 15px;
}

body .header .navbar-brand img {
    height: 60px;
    width: auto;
    padding: 0;
}

/* Nav link padding (Bootstrap default is 15px top/bottom); a touch tighter than
   default so the links sit centred against the larger logo. */
body .header .navbar-nav > li > a {
    padding-top: 20px;
    padding-bottom: 20px;
}

/* The "Interpreter / Client" sub-links under Sign In/Register were stacking
   under the link and adding ~40px of height. Show them as a hover dropdown
   instead so they no longer take up space in the bar. */
body .header .navbar-nav > li {
    position: relative;
}

body .header .navbar-nav > li > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    margin: 0;
    padding: 6px 12px;
    list-style: none;
    background: #000;
    z-index: 10000;
}

body .header .navbar-nav > li:hover > ul {
    display: block;
}

/* Spacer section under the header. The template gives every .feature-wrapper
   50px top / 40px bottom padding, which (on top of the spacer container) created
   a ~150px gap. The header is now taller (larger logo + more padding), so
   reserve ~90px to clear it. */
body > section.feature-wrapper:first-of-type {
    padding: 0;
}

body > section.feature-wrapper:first-of-type .container {
    height: 90px;
    overflow: hidden;
}

/* Content section: a comfortable gap under the header so the menu column and
   the content don't feel pinned right beneath it. The side menu and the title
   both start at the top of this padding, so increasing it moves the whole
   two-column block (menu + content) down together. */
body > section.feature-wrapper:nth-of-type(2) {
    padding: 48px 0 24px;
}

/* The greeting (now a span, not a link) needs the same vertical padding as the
   nav links so it lines up with them. */
body .header .navbar-nav > li > .user-greeting {
    display: block;
    padding: 20px 15px;
    white-space: nowrap;
}

/* Footer: a moderate height matching the header, with a slightly larger logo. */
body .footer-wrapper {
    padding: 20px 0;
}

body .footer-wrapper img {
    padding: 0;
    height: 52px;
    width: auto;
}

body .footer-wrapper .navbar-brand {
    height: auto;
    padding: 0 15px;
}

body .footer-wrapper .socialFooter .fa {
    margin: 4px 0 4px 10px;
}

body .footer-wrapper p {
    margin: 0 0 2px;
}

body .footer-wrapper i.fa.fa-angle-up {
    font-size: 22px;
    padding: 0;
}

/* ---------------------------------------------------------------------------
   Interpreter search results table
   ---------------------------------------------------------------------------
   Give every column a little horizontal breathing room so the headers and
   values don't touch, and let the Qualifications column wrap onto a few lines
   rather than stretching the row across the page.
--------------------------------------------------------------------------- */
table.interpreter-results > tbody > tr > td {
    padding: 4px 16px 4px 0;
    vertical-align: top;
}

/* The Qualifications column holds a long comma-separated list: let it wrap and
   constrain its width so it stacks neatly onto a few lines. A fixed width with
   word-wrap forces the wrap even under the table's auto layout. */
table.interpreter-results td.qualifications-col {
    white-space: normal;
    width: 340px;
    max-width: 340px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    line-height: 1.35;
}

/* ---------------------------------------------------------------------------
   Invoice-results wrapping columns
   ---------------------------------------------------------------------------
   Job Location, Job Type, Officer and Interpreter can hold long values. Let
   them wrap onto a second line (with a sensible max width) rather than forcing
   the whole row wide with white-space:nowrap.
--------------------------------------------------------------------------- */
/* Centre every invoice data cell vertically (the table lives inside .ls-form,
   whose "td { vertical-align: top }" would otherwise top-align them). This keeps
   a wrapped two-line value lined up with the single-line cells in the same row.
   The header row keeps its own bottom alignment (rule above). */
table.invoice-results > tbody > tr:not(:first-child) > td {
    vertical-align: middle;
}

table.invoice-results td.wrap-col {
    white-space: normal;
    width: 130px;
    max-width: 130px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    vertical-align: middle;
}
