/**
 * Brainsap Manager theme — professional light skin on top of Bootstrap 5.
 * Loaded LAST so it wins over bootstrap, bs3-compat and legacy style.css.
 */

/* ------------------------------------------------------------- density */
/* BS5 defaults to a 16px root — the whole app grew ~15% vs. the old BS3
   look. 14px root restores the familiar compact density; every rem-based
   size (buttons, inputs, spacing) scales with it. */
html { font-size: 14px; }

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.45rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: .85rem; }

/* -------------------------------------------------------------- canvas */
body {
    background: #eceef2;
    color: #1f2329;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------- cards */
.panel, .card {
    border: 1px solid #d3d9e0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .09);
    background: #fff;
}
.panel-heading {
    font-weight: 600;
    color: #344054;
    background: #f2f4f7;
    border-bottom: 1px solid #e1e5ea;
    border-radius: 8px 8px 0 0;
}
.well {
    background: #f2f4f7;
    border: 1px solid #d3d9e0;
    border-radius: 8px;
    padding: 14px;
}

/* -------------------------------------------------------------- tables */
.table { --bs-table-hover-bg: #eaf1fb; }
.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #667085;
    background: #f2f4f7;
    border-bottom: 2px solid #d3d9e0;
    white-space: nowrap;
}
.table tbody td { vertical-align: middle; }
.table > tbody > tr:hover > td { background-color: #eaf1fb; }
/* keep severity rows readable on hover */
.table > tbody > tr.success:hover > td { background-color: #c4e3d3; }
.table > tbody > tr.danger:hover > td  { background-color: #f2c6cb; }
.table > tbody > tr.warning:hover > td { background-color: #f7ecc2; }

/* ------------------------------------------------------------- buttons */
/* Streamlined default: compact everywhere (the legacy views used oversized
   default buttons); .btn-lg stays available for deliberate big targets. */
.btn {
    --bs-btn-padding-y: .32rem;
    --bs-btn-padding-x: .7rem;
    --bs-btn-font-size: .93rem;
    border-radius: 6px;
    font-weight: 500;
    box-shadow: 0 1px 1px rgba(16, 24, 40, .04);
}
.btn-lg {
    --bs-btn-padding-y: .55rem;
    --bs-btn-padding-x: 1rem;
    --bs-btn-font-size: 1.1rem;
}
.streamlined-group { display: inline-flex; vertical-align: middle; }
.btn:active { box-shadow: none; }
.btn-default {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #d0d5dd;
    --bs-btn-color: #344054;
    --bs-btn-hover-bg: #f2f4f7;
    --bs-btn-hover-border-color: #c3c9d4;
    --bs-btn-hover-color: #1f2329;
}
.btn-xs, .btn-group-xs > .btn {
    padding: .2rem .45rem;
    font-size: .82rem;
    border-radius: 5px;
    box-shadow: none;
}
/* Row quick actions need a real click target — pure xs was too tiny. */
.order-quick-actions > .btn {
    padding: .45rem .7rem;
    font-size: 1.1rem;
    line-height: 1;
}

/* ---------------------------------------------------------------- tabs */
/* Modern underline tabs — clear active indicator, no boxy borders. */
.nav-tabs {
    border-bottom: 1px solid #d3d9e0;
    gap: 2px;
    flex-wrap: wrap;
}
.nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0;
    color: #475467;
    padding: .5rem .85rem;
    margin-bottom: -1px;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 5px;
}
.nav-tabs .nav-link:hover { background: #f2f4f7; color: #1f2329; border-color: transparent; }
.nav-tabs .nav-link.active,
.nav-tabs li.active > a {
    border: 0;
    border-bottom: 2px solid #2563eb;
    color: #1d4ed8;
    font-weight: 600;
    background: transparent;
}

/* --------------------------------------------------------------- modal */
.modal-content {
    border: 0;
    border-radius: 10px;
    box-shadow: 0 24px 64px rgba(16, 24, 40, .28);
}
.modal-header {
    border-bottom: 1px solid #e1e5ea;
    padding: .8rem 1.1rem;
}
.modal-title { font-weight: 600; }
.modal-footer { border-top: 1px solid #e1e5ea; padding: .6rem 1.1rem; }
/* The order dialog carries a lot of content — give it room on desktop. */
@media (min-width: 1200px) {
    .modal-lg { --bs-modal-width: 1080px; }
}

/* --------------------------------------------------------------- forms */
.form-control, .form-select {
    border-color: #d0d5dd;
    border-radius: 6px;
}
.form-control:focus, .form-select:focus {
    border-color: #93b4f8;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
label { font-weight: 500; color: #344054; }

/* -------------------------------------------------------------- navbar */
.navbar.bg-white { border-bottom: 1px solid #d3d9e0; }
.navbar .nav-link { font-size: .95rem; padding-top: .55rem; padding-bottom: .55rem; color: #344054; }
.navbar .nav-link:hover { color: #0d6efd; }
.dropdown-menu {
    border: 1px solid #d3d9e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
    font-size: .93rem;
}
.dropdown-item { padding: .32rem 1rem; }

/* Dialog tab bars sat directly on the tab content — give them air. */
.modal .nav-tabs { margin-bottom: 14px; }

/* ------------------------------------------------- order dialog facelift */
/* The Order tab duplicated the modal title as a big h3 — hide it unless it
   carries a status color (canceled/return/lost), then render it as a slim
   alert strip. */
[id^="order-dialog-tab-order-"] > h3:not(.bg-danger):not(.bg-warning) { display: none; }
[id^="order-dialog-tab-order-"] > hr { display: none; }
/* Same for every other tab: the active tab already names the section, so the
   redundant first headline (Addresses, Invoice, Notes, …) and its divider go. */
.modal [id^="order-dialog-tab-"] > h3:first-child:not(.bg-danger):not(.bg-warning),
.modal [id^="order-dialog-vat-exempt-"] > h3:first-child { display: none; }
.modal [id^="order-dialog-tab-"] > h3:first-child + hr,
.modal [id^="order-dialog-tab-"] > hr:first-child { display: none; }
[id^="order-dialog-tab-order-"] > h3.bg-danger,
[id^="order-dialog-tab-order-"] > h3.bg-warning {
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 12px !important;
    border-radius: 6px;
    margin: 0 0 12px;
}
/* readable status strips: white on red, dark on yellow */
[id^="order-dialog-tab-order-"] > h3.bg-danger { color: #fff !important; background-color: #dc3545 !important; }
[id^="order-dialog-tab-order-"] > h3.bg-warning { color: #664d03 !important; background-color: #ffe69c !important; }

/* BS5 renders its own dropdown caret (::after) — hide the legacy BS3 span so
   dropdown buttons don't show two carets. */
.dropdown-toggle .caret { display: none; }

/* Every table in the dialog gets the card treatment — incl. the top info
   tables and the eBay/SKU item lists. */
.modal [id^="order-dialog-tab-"] table.table {
    background: #fff;
    border: 1px solid #d3d9e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .09);
}
.modal [id^="order-dialog-tab-"] table.table > tbody > tr > td,
.modal [id^="order-dialog-tab-"] table.table > tr > td { padding: .45rem .75rem; }
.modal [id^="order-dialog-tab-"] .desc-cell { width: 220px; color: #667085; background: #f2f4f7; }

/* Section headings inside the dialog (eBay Items, SKU Items, Orders by
   Customer, Addresses, …) — consistent slim section titles. */
.modal [id^="order-dialog-tab-"] h3,
.modal [id^="order-dialog-tab-"] h4 {
    font-size: .95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #667085;
    margin: 14px 0 8px;
}

/* --------------------------------------------------------------- misc */
.glyphicon { vertical-align: -1px; }
.badge { border-radius: 10px; font-weight: 600; }
kbd {
    background: #1f2329;
    border-radius: 4px;
    padding: 2px 6px;
}
::selection { background: rgba(37, 99, 235, .18); }

/* ------------------------------------------------------------ ship nav */
/* ZURÜCK/WEITER stay reachable while scrolling an order section (navbar is
   fixed-top ~56px, so stick right below it). */
.ship-nav-row {
    position: sticky;
    top: 58px;
    z-index: 900;
    background: #fff;
    padding: 6px 4px;
    margin-left: -4px;
    margin-right: -4px;
    border-bottom: 1px solid #e1e5ea;
    box-shadow: 0 2px 6px rgba(16, 24, 40, .05);
}

/* -------------------------------------------------------------- mobile */
/* Ship-page anchor jumps (Nachrichten ↓ / Nach oben) must not hide under
   the sticky navbar. */
[id^="order-top-"], [id^="order-messages-"] { scroll-margin-top: 64px; }

@media (max-width: 768px) {
    /* Denser base: smaller root font, tighter paddings — less scrolling. */
    html { font-size: 12.5px; }
    .container-fluid { padding-left: 6px; padding-right: 6px; }
    .panel { margin-bottom: 8px; }
    .panel-body { padding: 8px; }
    .well { padding: 6px; margin-bottom: 8px; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.15rem; }
    h4 { font-size: 1rem; }
    .modal-body { padding: 8px; }
    .table > :not(caption) > * > * { padding: .28rem .35rem; }

    /* Compact controls: BS5 defaults are desktop-sized — shrink inputs,
       selects and buttons across the board. */
    .form-control, .form-select {
        padding: .28rem .5rem;
        font-size: .95rem;
        min-height: 0;
    }
    .form-group { margin-bottom: 6px; }
    label { margin-bottom: 1px; font-size: .9em; }
    .btn {
        --bs-btn-padding-y: .28rem;
        --bs-btn-padding-x: .55rem;
        --bs-btn-font-size: .9rem;
    }
    .bootstrap-select > .btn, .btn.dropdown-toggle {
        padding-top: .28rem;
        padding-bottom: .28rem;
        font-size: .9rem;
    }

    /* Ship pages: compact address data (label left, value right; slightly
       larger than the desktop 12px for readability), primary nav thumb-sized. */
    .address-data-table td { padding: 2px 6px !important; font-size: 13px; }
    .address-item .next-address-button,
    .address-item .go-back-address-button { padding: .45rem .8rem; font-size: .9rem; }
    .address-check-icons { font-size: 15px !important; margin-right: 6px !important; }
    .switch-address-lines-link { padding: .28rem .2rem; font-size: .85rem; height: 100%; }
    .address-item textarea.form-control { height: 72px !important; }
    .order-messages-jump { font-size: .85rem; padding: .25rem .5rem; }

    /* Message bubbles in embeds: tighter */
    .order-thread-block { margin-bottom: 10px; }

    /* Quick actions stay finger-friendly but not oversized on phones. */
    .order-quick-actions > .btn { padding: .35rem .55rem; font-size: 1rem; }
}

/* DataTables polish */
div.dt-container div.dt-search input { border-radius: 6px; border-color: #d0d5dd; }
.dt-filter-row th { padding: .3rem .35rem !important; background: #fff; }
.dt-filter-row input { min-width: 70px; }
table.dataTable thead > tr > th.dt-orderable-asc:hover,
table.dataTable thead > tr > th.dt-orderable-desc:hover { background: #f2f4f7; }
