@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

/* MainLayout .content is a column flex container (align-items: stretch).
   Keep page action buttons (New Invoice, New Recap, …) compact like normal buttons. */
.content > .btn,
.content > button.btn,
.content > a.btn {
    align-self: flex-start;
    width: auto;
    max-width: max-content;
}

.content {
    padding-top: 1.1rem;
}

/* Side menu hide/show (global so it always wins over scoped/flex defaults) */
.page.sidebar-hidden > .sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    flex: 0 0 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #c5d0dc;
    background: #fff;
    color: #1b3a5a;
    border-radius: 0.35rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.sidebar-toggle:hover {
    background: #eef3f9;
    border-color: #9eb6ce;
    color: #0b5cab;
}

.sidebar-backdrop,
.sidebar-float-close {
    display: none;
}

@media (max-width: 640.98px) {
    /* Phone: compact top bar with Menu when closed */
    .page > .main > .top-row {
        display: flex !important;
        position: sticky;
        top: 0;
        z-index: 30;
        background: #f7f7f7;
        border-bottom: 1px solid #d6d5d5;
        min-height: 2.85rem;
        padding: 0.4rem 0.75rem !important;
        gap: 0.5rem;
        align-items: center;
    }

    .page > .main > .top-row .top-title,
    .page > .main > .top-row .platts-header-strip {
        display: none !important;
    }

    .page > .main > .top-row .sidebar-toggle {
        min-height: 2.25rem;
        padding: 0.4rem 0.85rem;
        font-size: 0.95rem;
    }

    /* Default / closed: no sidebar taking vertical space */
    .page:not(.sidebar-ready) > .sidebar,
    .page.sidebar-hidden > .sidebar {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        flex: 0 0 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: translateX(-105%);
    }

    /* Open: side drawer covering the screen */
    .page.is-mobile:not(.sidebar-hidden) {
        position: relative;
    }

    .page.is-mobile:not(.sidebar-hidden) > .sidebar {
        display: flex !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 300px) !important;
        max-width: 300px !important;
        min-width: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        z-index: 120;
        flex: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: auto !important;
        transform: translateX(0);
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.28);
        animation: ilaf-drawer-in 0.22s ease-out;
    }

    .page.is-mobile:not(.sidebar-hidden) > .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 110;
        background: rgba(15, 23, 42, 0.45);
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
        animation: ilaf-fade-in 0.18s ease-out;
    }

    .page.is-mobile:not(.sidebar-hidden) > .sidebar-float-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0.85rem;
        right: 0.85rem;
        z-index: 130;
        min-height: 2.4rem;
        padding: 0.45rem 0.9rem;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        background: #0b5cab;
        color: #fff;
        font-size: 0.9rem;
        font-weight: 600;
        box-shadow: 0 6px 18px rgba(11, 92, 171, 0.35);
        cursor: pointer;
    }

    .page.is-mobile:not(.sidebar-hidden) > .main {
        /* Keep content under the drawer; don't push layout from top */
        filter: none;
    }
}

@keyframes ilaf-drawer-in {
    from { transform: translateX(-105%); }
    to { transform: translateX(0); }
}

@keyframes ilaf-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.regional-product-card {
    overflow: hidden;
}

.regional-product-card .card-header {
    background: #f7f9fc;
}

.regional-product-toggle {
    width: 100%;
    border: 0;
    background: #f7f9fc;
    cursor: pointer;
}

.regional-product-toggle:hover {
    background: #eef3f9;
}

.regional-fold-icon {
    width: 1rem;
    flex-shrink: 0;
    line-height: 1.4;
    color: #555;
}

.regional-product-card .btn-group .btn {
    min-width: 3.2rem;
}

.regional-lookback-bar {
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.regional-month-select {
    width: auto;
    min-width: 8.25rem;
}

.regional-year-select {
    width: auto;
    min-width: 6rem;
}

.regional-date-select {
    width: auto;
    min-width: 11rem;
}

.regional-date-controls > .form-select,
.regional-date-controls > .btn {
    min-height: 38px;
}

.regional-item-date-controls > .form-select,
.regional-item-date-controls > .btn {
    min-height: 31px;
}

.regional-header-avgs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.85rem;
}

.regional-header-avg {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    white-space: nowrap;
    line-height: 1.2;
}

.regional-header-avg-label {
    font-size: 0.8rem;
    color: #555;
}

.regional-header-avg-value {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1b6ec2;
}

.regional-price-table {
    max-height: 260px;
    overflow: auto;
}

.regional-price-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
}

.regional-pin-col {
    width: 2rem;
    padding-left: 0.5rem !important;
    padding-right: 0.25rem !important;
    vertical-align: middle;
    position: relative; /* containing block for any absolute checkbox styles */
}

/* Bootstrap .form-check-input is position:absolute — that detaches ticks from scrolling rows */
.regional-pin-col input[type="checkbox"],
.regional-row-pin {
    position: static !important;
    float: none !important;
    margin: 0 !important;
    display: inline-block;
    vertical-align: middle;
    width: 1rem;
    height: 1rem;
}

.regional-pin-avg {
    white-space: nowrap;
}

.regional-pin-avg .form-check-input {
    position: static !important;
    float: none !important;
    margin: 0 0.25rem 0 0 !important;
}

.product-filter-card .product-filter-list {
    max-height: 220px;
    overflow-y: auto;
}

.product-filter-toggle {
    cursor: pointer;
    user-select: none;
}

.product-filter-toggle:hover {
    background: #f8f9fa;
}

.product-filter-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.35rem 0.4rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.product-filter-item:hover {
    background: #f5f7fa;
}

.product-filter-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.product-filter-text code {
    font-size: 0.75rem;
}

.items-list-scroll {
    max-height: min(70vh, 32rem);
    overflow: auto;
}

.items-list-scroll thead th {
    z-index: 1;
}

.platts-link-hint {
    font-size: 0.7rem;
    line-height: 1.2;
    max-width: 100%;
    margin-top: 0.15rem !important;
}

.pricing-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pricing-date-na {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #6c757d;
    user-select: none;
}

.pricing-date-na .form-check-input {
    margin-top: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.floating-alert-container {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(420px, calc(100vw - 2.5rem));
    pointer-events: none;
}

.floating-alert {
    margin: 0;
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.18);
    pointer-events: auto;
}

.floating-alert-dismissible {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-right: 0.65rem;
}

.floating-alert-text {
    flex: 1 1 auto;
    min-width: 0;
}

.floating-alert-close {
    flex: 0 0 auto;
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    font-size: 1.35rem;
    line-height: 1;
    padding: 0 0.15rem;
    margin: -0.1rem 0 0;
    cursor: pointer;
}

.floating-alert-close:hover,
.floating-alert-close:focus {
    opacity: 1;
    outline: none;
}

.platts-sync-toast {
    border: 1px solid #b6d4ea;
    background: #f0f7fc;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.platts-sync-toast.is-warning {
    border-color: #f0c36d;
    background: #fff8e8;
}

.platts-sync-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.7rem;
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.platts-sync-toast-actions {
    display: flex;
    gap: 0.25rem;
}

.platts-sync-icon-btn {
    border: 0;
    background: transparent;
    width: 1.6rem;
    height: 1.6rem;
    line-height: 1;
    border-radius: 0.25rem;
    font-size: 1rem;
    color: #334155;
    cursor: pointer;
}

.platts-sync-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.platts-sync-toast-body {
    padding: 0.55rem 0.7rem 0.7rem;
}

.platts-sync-toast-mini {
    padding: 0.35rem 0.7rem 0.55rem;
    font-size: 0.85rem;
    color: #475569;
}

.platts-sync-summary {
    font-size: 0.9rem;
    margin-bottom: 0.45rem;
}

.platts-sync-list {
    max-height: 240px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.platts-sync-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    align-items: start;
    padding: 0.35rem 0.45rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.3rem;
    font-size: 0.82rem;
}

.platts-sync-badge {
    display: inline-block;
    min-width: 4.6rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    background: #e2e8f0;
    color: #334155;
}

.platts-sync-item.change-new .platts-sync-badge {
    background: #dcfce7;
    color: #166534;
}

.platts-sync-item.change-updated .platts-sync-badge {
    background: #dbeafe;
    color: #1e40af;
}

.platts-sync-item.change-unchanged .platts-sync-badge {
    background: #f1f5f9;
    color: #64748b;
}

.platts-sync-item.change-error .platts-sync-badge {
    background: #fee2e2;
    color: #991b1b;
}

.platts-sync-item-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    align-items: baseline;
    min-width: 0;
}

.platts-sync-item-main code {
    font-size: 0.75rem;
}

.platts-sync-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    white-space: nowrap;
    color: #475569;
}

.platts-sync-price {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1b6ec2;
}

@media (max-width: 700px) {
    .platts-sync-item {
        grid-template-columns: auto 1fr;
    }

    .platts-sync-item-meta {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.75rem;
        align-items: center;
    }
}

.export-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.export-overlay-card {
    width: min(22rem, calc(100vw - 2rem));
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem 1.35rem 1.1rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
    text-align: center;
}

.export-overlay-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.export-overlay-message {
    font-size: 0.9rem;
    color: #475569;
    min-height: 1.35rem;
    margin-bottom: 0.85rem;
}

.export-overlay-bar {
    height: 0.55rem;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.export-overlay-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1b6ec2, #0ea5e9);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.export-overlay-pct {
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

/* List grids: search / pager / sortable headers */
.list-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
}

.list-table-search {
    max-width: 22rem;
    min-width: 12rem;
    flex: 1 1 12rem;
}

.list-table-summary {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.list-table-pager {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

th.th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.th-sort:hover {
    color: #1b6ec2;
}
