/*
   The Dealer Zone look, applied to the VMI Portal.

   The colours themselves come from app.css, which is Dealer Zone's copy of the theme
   (Bad Boy orange #F36C23 as the primary colour, the brand greys, Poppins as the font).
   This file adds the parts Dealer Zone does outside the theme: the black menu with its
   orange rules, the white page, the orange italic headings and the orange pop-up buttons.

   Dealer Zone sets its menu and headings in United Italic. That font is licensed and is
   not to be added to new work, so Poppins bold italic stands in for it here.
*/

/* ===== Poppins, served from this site (the content policy allows no outside fonts) ===== */
@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-BoldItalic.woff2") format("woff2");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Poppins";
    src: url("../fonts/Poppins-ExtraBoldItalic.woff2") format("woff2");
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

:root {
    --brand-orange: #F36C23;
    --brand-orange-text: #C24E12; /* orange for text on white: the fill colour is too light to read */
    --brand-ink: #231F20;
}

/* ===== Page ===== */
body {
    background-color: #ffffff;
    font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== Accessibility, as on Dealer Zone ===== */
/* Skip-to-content link: the first thing the Tab key reaches, visible only when focused. */
.skip-link {
    position: absolute;
    left: 0;
    top: -64px;
    z-index: 2000;
    padding: 0.6rem 1.25rem;
    background: var(--brand-orange);
    color: var(--brand-ink);
    font-weight: 700;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0;
    color: var(--brand-ink);
}

/* A keyboard focus ring that is always visible (the template hides some outlines). */
:focus-visible {
    outline: 2px solid var(--brand-orange) !important;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Left menu: black, with the logo on top and an orange rule between items ===== */
body[data-leftbar-theme=dark] .leftside-menu,
body[data-leftbar-theme=dark] .leftside-menu .logo {
    background: #000000 !important;
}

.leftside-menu .logo {
    height: auto;
    line-height: normal;
    padding: 0.75rem 0.5rem 0.5rem;
}

.leftside-menu .logo .logo-lg img {
    width: 250px;
    max-width: 100%;
    height: auto;
}

.leftside-menu .logo .logo-sm img {
    width: 44px;
    height: 44px;
}

/* The menu starts below the taller logo. */
.leftside-menu #leftside-menu-container {
    padding-top: 0.5rem;
}

.side-nav .side-nav-item {
    border-top: 1px solid var(--brand-orange);
}

.side-nav .side-nav-item:last-child {
    border-bottom: 1px solid var(--brand-orange);
}

body[data-leftbar-theme=dark] .side-nav .side-nav-link {
    color: #ffffff;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.2px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    transition: color 0.15s ease, transform 0.15s ease;
}

body[data-leftbar-theme=dark] .side-nav .side-nav-link i {
    color: #ffffff;
    font-style: normal;
}

body[data-leftbar-theme=dark] .side-nav .side-nav-link:hover,
body[data-leftbar-theme=dark] .side-nav .side-nav-link:focus,
body[data-leftbar-theme=dark] .side-nav .side-nav-link:hover i,
body[data-leftbar-theme=dark] .side-nav .side-nav-link:focus i,
body[data-leftbar-theme=dark] .side-nav .menuitem-active > a,
body[data-leftbar-theme=dark] .side-nav .menuitem-active > a i {
    color: var(--brand-orange);
}

body[data-leftbar-theme=dark] .side-nav .side-nav-second-level li a {
    color: #d9d9d9;
}

body[data-leftbar-theme=dark] .side-nav .side-nav-second-level li a:hover,
body[data-leftbar-theme=dark] .side-nav .side-nav-second-level li a:focus,
body[data-leftbar-theme=dark] .side-nav .side-nav-second-level li.menuitem-active > a {
    color: var(--brand-orange);
}

/* ===== Top bar ===== */
.navbar-custom .noti-icon,
.navbar-custom .button-menu-mobile {
    color: #000000;
}

/* The logo in the top bar is for phones only (see the phone section at the end). */
.navbar-custom .topbar-logo {
    display: none;
}

/* ===== Headings: orange bold italic, as Dealer Zone's page titles ===== */
/* The doubled selectors outrank the template's own small, uppercase .header-title. */
h1.header-title, h2.header-title, h3.header-title, h4.header-title,
.card .header-title,
.brand-heading {
    font-family: Poppins, sans-serif;
    font-weight: 800;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0.2px;
    font-size: 1.35rem;
    color: var(--brand-orange-text);
}

/* ===== Cards: a light border on the white page instead of a shadow ===== */
.card {
    border: 1px solid #e3e6ea;
    box-shadow: none;
}

/* ===== Dashboard: a greeting card, then one linked tile per count ===== */
.dashboard-avatar {
    width: 84px;
    height: 84px;
}

.dashboard-greeting {
    font-size: 1.6rem;
}

.dashboard-tile {
    display: block;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.dashboard-tile:hover,
.dashboard-tile:focus-visible {
    transform: scale(1.02);
    border-color: var(--brand-orange);
}

.dashboard-tile-label {
    font-weight: 800;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--brand-orange-text);
}

.dashboard-tile-count {
    margin-top: 0.35rem;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--brand-ink);
}

/* ===== Links in the footer ===== */
.form-link:link,
.form-link:visited {
    color: #313a46;
    text-decoration: none;
}

.form-link:hover {
    color: var(--brand-orange-text);
    text-decoration: underline;
}

/* ===== Pop-ups: the confirm button is always Bad Boy orange =====
   !important also beats the inline confirmButtonColor older Swal.fire calls pass. */
.swal2-styled.swal2-confirm {
    background-color: var(--brand-orange) !important;
}

.swal2-styled.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(243, 108, 35, .5) !important;
}

/* ===== Tables: the current page in the pager, in brand orange ===== */
.page-item.active .page-link {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
}

/* The greeting's text shrinks and wraps inside its card instead of pushing out of it. */
.dashboard-greeting-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* =====================================================================================
   Phones and small tablets (under 768px wide)
   ===================================================================================== */
@media (max-width: 767.98px) {

    /* --- Page furniture --- */

    /* The template pins the footer to the bottom and leaves 65px for it. On a phone the
       footer wraps to several lines and would cover the end of the page, so it simply
       follows the content instead. */
    .footer {
        position: static;
        left: 0;
        padding: 16px 12px;
    }

    .content-page {
        padding-bottom: 12px;
        min-height: 0;
    }

    /* The logo sits in the top bar, beside the menu button. */
    .navbar-custom .topbar-logo {
        display: inline-flex;
        align-items: center;
        height: 70px;
        margin-left: 4px;
    }

    .navbar-custom .topbar-logo img {
        width: auto;
        height: 26px;
        max-width: 46vw;
    }

    h1.header-title, h2.header-title, h3.header-title, h4.header-title,
    .card .header-title,
    .brand-heading {
        font-size: 1.15rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* --- Dashboard --- */
    .dashboard-avatar {
        width: 56px;
        height: 56px;
        flex: 0 0 auto;
    }

    .dashboard-greeting {
        font-size: 1.2rem;
    }

    /* --- A page's main button, kept in reach ---
       On a phone the cards make the page long, and a button under the table (Create PO
       Number on New Movements) would only be reached after scrolling past every row. It is
       pinned to the bottom of the screen instead. It is "fixed" and not "sticky" because
       the template clips .content-page, which stops sticky from working.
       z-index 9 keeps it under the slide-out menu (10) and the loading overlay (99). */
    .phone-sticky-action {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9;
        padding: 0.6rem 0.75rem;
        background-color: #ffffff;
        border-top: 1px solid #e3e6ea;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    }

    .phone-sticky-action .btn {
        margin-top: 0 !important;
    }

    /* Room at the end of the page so the pinned button never covers the footer's last line. */
    body:has(.phone-sticky-action) .footer {
        padding-bottom: 84px;
    }

    /* --- Things to tap: big enough for a thumb --- */
    .btn,
    .form-control,
    .form-select,
    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        min-height: 40px;
    }

    table.dataTable input[type=checkbox].form-check-input {
        width: 24px;
        height: 24px;
        margin: 0;
    }

    /* --- Tables on a phone: one card per row ---
       A wide table would need sideways scrolling, so under 768px each row is laid out as
       a card with one "Heading: value" line per column. The heading comes from the
       data-label that site.js (labelCellsForPhoneCards) puts on every cell. */

    /* The table's controls stack: rows-per-page, export buttons, then search. */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dt-buttons {
        float: none;
        text-align: left;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
    }

    /* The column headings are not shown: every card line carries its own. */
    .dataTables_wrapper .dataTables_scrollHead,
    .dataTables_wrapper .dataTables_scrollBody thead,
    .dataTables_wrapper table.dataTable > thead {
        display: none;
    }

    .dataTables_wrapper .dataTables_scrollBody {
        overflow: visible !important;
        border: 0 !important;
    }

    .dataTables_wrapper table.dataTable,
    .dataTables_wrapper table.dataTable > tbody,
    .dataTables_wrapper table.dataTable > tbody > tr,
    .dataTables_wrapper table.dataTable > tbody > tr > td {
        display: block;
        width: auto !important;
    }

    .dataTables_wrapper table.dataTable {
        width: 100% !important;
        margin: 0 !important;
        border: 0;
    }

    /* One row = one card. A row's own colour (active / inactive stock codes) is kept. */
    .dataTables_wrapper table.dataTable > tbody > tr {
        margin-bottom: 0.75rem;
        padding: 0.35rem 0.85rem;
        border: 1px solid #e3e6ea;
        border-left: 4px solid var(--brand-orange);
        border-radius: 6px;
        background-color: #ffffff;
    }

    .dataTables_wrapper table.dataTable > tbody > tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.4rem 0;
        border: 0;
        border-bottom: 1px solid #eef0f2;
        white-space: normal;
        text-align: right;
        overflow-wrap: anywhere;
        background-color: transparent !important;
        box-shadow: none !important;
    }

    .dataTables_wrapper table.dataTable > tbody > tr > td:last-child {
        border-bottom: 0;
    }

    .dataTables_wrapper table.dataTable > tbody > tr > td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        text-align: left;
        font-weight: 600;
        color: var(--brand-ink);
    }

    /* A blank value would only be a heading with nothing beside it. */
    .dataTables_wrapper table.dataTable > tbody > tr > td:empty {
        display: none;
    }

    /* "No data available" and an opened chargeback's list of claims span the whole card. */
    .dataTables_wrapper table.dataTable > tbody > tr > td.dataTables_empty,
    .dataTables_wrapper table.dataTable > tbody > tr > td[colspan] {
        display: block;
        text-align: left;
    }

    .dataTables_wrapper table.dataTable > tbody > tr > td.dataTables_empty::before,
    .dataTables_wrapper table.dataTable > tbody > tr > td[colspan]::before {
        content: none;
    }

    /* The list of claims inside an opened chargeback: three narrow columns, with the two
       buttons stacked so they fit the card. */
    .chargeback-claims {
        width: 100%;
        margin-bottom: 0;
    }

    .chargeback-claims th,
    .chargeback-claims td {
        padding: 0.35rem 0.25rem;
        white-space: normal;
        vertical-align: middle;
    }

    .chargeback-claims .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.25rem;
    }

    /* The pager and the "Showing 1 to 10" line sit under the cards, centred. */
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        white-space: normal;
    }

    .dataTables_wrapper .dataTables_paginate .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
}
