:root {
    /* Same palette as the old 1.3.2 ThemeFFX (Blue Darken4 / Orange Darken3) */
    --brand: #0d47a1;
    --brand-dark: #093579;
    --brand-light: #1565c0;
    --brand-soft: #e3ecf7;
    --accent: #ef6c00;
    --footer-h: 48px;
}

html, body {
    margin: 0;
    font-family: 'Roboto', 'Segoe UI', 'Malgun Gothic', sans-serif;
    color: #2b2c33;
}

/* mobile guard: any element wider than the viewport must scroll inside its own
   container (.table-scroll etc.), never widen the page itself.
   NOTE: overflow on <html> alone is transferred to the viewport (no real clipping),
   which lets Android Chrome expand the layout viewport to fit wide content - the
   "page looks zoomed in" bug. Clipping on <body> actually clips, stopping that. */
html {
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    overflow-x: clip;
    max-width: 100%;
}

/* iOS Safari auto-zooms (and STAYS zoomed) when focusing any input whose font-size
   is under 16px - that zoom then makes every page look wider than the screen.
   Force 16px form text on phones (covers our inputs and MudBlazor's). */
@media (max-width: 767.98px) {
    input,
    select,
    textarea,
    .mud-input input,
    .mud-input textarea,
    .mud-select-input {
        font-size: 16px !important;
    }
}

h1:focus {
    outline: none;
}

/* ---------- Shared page elements (static SSR pages) ---------- */

.page-title {
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0 0 1rem;
}

.panel {
    background: #fff;
    border: 1px solid #e3e4ec;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    max-width: 640px;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0 0 0.75rem;
}

.panel-wide {
    max-width: none;
    margin-bottom: 1rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-select-form {
    margin: 0;
}

    .inline-select-form select {
        padding: 0.35rem 0.6rem;
        font-size: 0.88rem;
        font-family: inherit;
        border: 1px solid #c9cbd8;
        border-radius: 6px;
        background: #fff;
    }

        .inline-select-form select:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
        }

.loading-note {
    color: #9094a6;
}

.chart-wrap {
    width: 100%;
    overflow-x: auto;
}

    .chart-wrap svg {
        width: 100%;
        min-width: 560px;
        height: auto;
        display: block;
    }

.info-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.25rem;
    margin: 0;
}

    .info-list dt {
        font-weight: 500;
        color: #6b6e80;
    }

    .info-list dd {
        margin: 0;
        overflow-wrap: anywhere;
    }

@media (max-width: 599.98px) {
    .info-list {
        grid-template-columns: 1fr;
        gap: 0;
    }

        .info-list dt {
            margin-top: 0.6rem;
        }
}

/* ---------- Shared form styles (static SSR forms) ---------- */

.auth-title {
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0 0 1rem;
    text-align: center;
}

.form-field {
    margin-bottom: 0.9rem;
}

    .form-field label {
        display: block;
        font-size: 0.85rem;
        font-weight: 500;
        color: #4a4c59;
        margin-bottom: 0.3rem;
    }

    .form-field input {
        width: 100%;
        box-sizing: border-box;
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
        font-family: inherit;
        border: 1px solid #c9cbd8;
        border-radius: 6px;
        transition: border-color 0.15s, box-shadow 0.15s;
    }

        .form-field input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
        }

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.form-error {
    background: #fdecec;
    border: 1px solid #f5b5b5;
    border-radius: 6px;
    color: #b3261e;
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.form-success {
    background: #e8f6ec;
    border: 1px solid #a9dcb8;
    border-radius: 6px;
    color: #1e7a3c;
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.6rem 1.4rem;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--brand-dark);
        box-shadow: 0 2px 6px rgba(13, 71, 161, 0.4);
    }

.btn-outline {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--brand);
    text-decoration: none;
    display: inline-block;
    padding: calc(0.6rem - 1px) 1.4rem;
}

    .btn-outline:hover {
        background: var(--brand-soft);
    }

.btn-secondary {
    background: #eceef2;
    color: #3a3b45;
    text-decoration: none;
    display: inline-block;
}

    .btn-secondary:hover {
        background: #dde0e7;
    }

.btn-block {
    display: block;
    width: 100%;
}

/* ---------- Stat cards (dashboard) ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #e3e4ec;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b6e80;
    margin: 0 0 0.35rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
    overflow-wrap: anywhere;
}

.stat-hint {
    font-size: 0.75rem;
    color: #9094a6;
    margin: 0.25rem 0 0;
}

/* ---------- Filter bar (GET forms on list pages) ---------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem 0.8rem;
    margin-bottom: 1rem;
}

    .filter-bar .filter-field {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .filter-bar label {
        font-size: 0.75rem;
        font-weight: 500;
        color: #6b6e80;
    }

    .filter-bar input[type="text"],
    .filter-bar input[type="date"],
    .filter-bar select {
        box-sizing: border-box;
        padding: 0.45rem 0.6rem;
        font-size: 0.9rem;
        font-family: inherit;
        border: 1px solid #c9cbd8;
        border-radius: 6px;
        background: #fff;
        min-width: 10rem;
    }

        .filter-bar input[type="text"]:focus,
        .filter-bar input[type="date"]:focus,
        .filter-bar select:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
        }

@media (max-width: 599.98px) {
    .filter-bar .filter-field {
        flex: 1 1 100%;
    }

    .filter-bar input[type="text"],
    .filter-bar select {
        width: 100%;
    }
}

/* ---------- Data tables (static SSR lists) ---------- */

.table-scroll {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e3e4ec;
    border-radius: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    white-space: nowrap;
}

    .data-table th {
        position: sticky;
        top: 0;
        background: #f7f7fb;
        color: #4a4c59;
        font-weight: 600;
        text-align: left;
        padding: 0.6rem 0.8rem;
        border-bottom: 2px solid #e3e4ec;
    }

        .data-table th a {
            color: inherit;
            text-decoration: none;
        }

            .data-table th a:hover {
                color: var(--brand);
            }

    .data-table td {
        padding: 0.5rem 0.8rem;
        border-bottom: 1px solid #eef0f4;
        vertical-align: middle;
    }

    .data-table tbody tr:nth-child(even) {
        background: #fafafd;
    }

    .data-table tbody tr:hover {
        background: #eef3fa;
    }

    /* long-text column: wrap instead of stretching the table (data-table is nowrap by default).
       break-word (NOT anywhere) + min-width keep the column from collapsing to one
       character per line when the table is squeezed on mobile */
    .data-table .wrap-col {
        white-space: normal;
        min-width: 120px;
        max-width: 180px;
        overflow-wrap: break-word;
    }

    .data-table .num {
        text-align: right;
    }

    .data-table .ctr {
        text-align: center;
    }

    .data-table .wrap {
        white-space: normal;
        min-width: 12rem;
    }

.table-empty {
    padding: 2rem;
    text-align: center;
    color: #9094a6;
}

.row-link {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border-radius: 6px;
    padding: 0.25rem 0.7rem;
    font-weight: 500;
    text-decoration: none;
}

    .row-link:hover {
        background: var(--brand-dark);
    }

.item-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f4;
}

/* ---------- Status badges ---------- */

.badge {
    display: inline-block;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.7rem;
    white-space: nowrap;
}

.badge-status-1 { background: var(--brand-soft); color: var(--brand-dark); }   /* Order */
.badge-status-2 { background: #eceef2; color: #4a4c59; }   /* Updating */
.badge-status-3 { background: #fdf3dc; color: #9a6b00; }   /* Backorder */
.badge-status-4 { background: #e0f2fd; color: #045f8d; }   /* Packing */
.badge-status-5 { background: #e8f6ec; color: #1e7a3c; }   /* Completed */
.badge-status-6 { background: #fdecec; color: #b3261e; }   /* Canceled */

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1rem;
}

    .pagination a,
    .pagination span.current,
    .pagination span.disabled {
        display: inline-block;
        min-width: 2.1rem;
        text-align: center;
        padding: 0.35rem 0.5rem;
        border: 1px solid #d9dbe6;
        border-radius: 6px;
        background: #fff;
        color: #3a3b45;
        font-size: 0.85rem;
        text-decoration: none;
    }

    .pagination a:hover {
        border-color: var(--brand);
        color: var(--brand);
    }

    .pagination span.current {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
        font-weight: 600;
    }

    .pagination span.disabled {
        color: #b9bcc9;
    }

    .pagination .page-info {
        margin-left: 0.5rem;
        font-size: 0.8rem;
        color: #9094a6;
    }

.page-info-single {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #9094a6;
}

.conn-list {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

    .conn-list li {
        margin-bottom: 0.25rem;
    }

    .conn-list small {
        color: #9094a6;
    }

/* ---------- Reports ---------- */

.view-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.view-tab {
    padding: 0.45rem 1.2rem;
    border: 1px solid #d9dbe6;
    border-radius: 999px;
    background: #fff;
    color: #3a3b45;
    font-size: 0.9rem;
    text-decoration: none;
}

    .view-tab:hover {
        border-color: var(--brand);
        color: var(--brand);
    }

    .view-tab.active {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
        font-weight: 600;
    }

.summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.summary-cards {
    margin-bottom: 0;
}

.pie-panel {
    max-width: none;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.expand-link {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

    .expand-link .chev {
        display: inline-block;
        width: 1em;
    }

/* expand toggles that mutate island state are <button>s (an <a href=""> would
   enhanced-navigate to the base path); make them look like the link version */
button.expand-link {
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.detail-row > td {
    background: #f6f8fc;
    padding: 0.8rem 1rem;
}

.detail-grids {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.detail-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a4c59;
    margin: 0 0 0.4rem;
}

.inner-table {
    background: #fff;
    border: 1px solid #e3e4ec;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 959.98px) {
    .summary-row {
        grid-template-columns: 1fr;
    }
}

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

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h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DQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ---------- image zoom (catalog / cart / order detail thumbnails) ---------- */

.img-zoom {
    position: relative;
    cursor: zoom-in;
}

    /* hover overlay: dim + magnifier-plus icon (hidden for missing-image placeholders) */
    .img-zoom::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
        border-radius: inherit;
        background-color: rgba(13, 71, 161, 0.30);
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 30px 30px;
        opacity: 0;
        transition: opacity 0.15s;
        pointer-events: none;
    }

    .img-zoom:not(.img-missing):hover::after {
        opacity: 1;
    }

    .img-zoom.img-missing {
        cursor: default;
    }

/* fullscreen lightbox - opened/closed by the script in App.razor */
#img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(15, 18, 28, 0.82);
    cursor: zoom-out;
}

    #img-lightbox[hidden] {
        display: none;
    }

    #img-lightbox img {
        max-width: 92vw;
        max-height: 92vh;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    }

/* MudTable auto-inserts a "sort by" dropdown above the stacked rows on phones - not wanted anywhere */
.mud-table-smalldevices-sortselect {
    display: none !important;
}

/* ---------- Amazon-style order cards (phones) ---------- */

.order-cards {
    display: none; /* desktop keeps the table */
}

@media (max-width: 767.98px) {
    .m-hide {
        display: none !important;
    }

    .order-cards {
        display: block;
        background: #fff;
        border: 1px solid #e3e4ec;
        border-radius: 10px;
        overflow: hidden;
    }

    .order-card {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.9rem 0.9rem 0.9rem 1rem;
        border-bottom: 1px solid #eef0f5;
        text-decoration: none;
        color: #2b2c33;
    }

        .order-card:last-child {
            border-bottom: 0;
        }

        .order-card:active {
            background: #f2f5fa;
        }

    .oc-body {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }

    .oc-status {
        display: flex;
        align-items: center;
        gap: 0.6rem;
    }

    .oc-shipped {
        font-size: 0.78rem;
        color: #1e7a3c;
        font-weight: 600;
    }

    .oc-title {
        font-size: 0.98rem;
        font-weight: 600;
        overflow-wrap: break-word;
    }

    .oc-sub {
        font-size: 0.88rem;
        color: #4a4c59;
        overflow-wrap: break-word;
    }

    .oc-meta {
        font-size: 0.78rem;
        color: #8a8d9c;
    }

    .oc-chev {
        flex: 0 0 auto;
        font-size: 1.8rem;
        line-height: 1;
        color: #b8bbc9;
    }
}
