/* ── Reset / base (replaces Bootstrap reboot) ──────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    line-height: 1.5;
}

body {
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

ul, ol {
    margin-top: 0;
    margin-bottom: 1rem;
}

img, svg {
    vertical-align: middle;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
}

button {
    cursor: pointer;
    background: none;
    border: 0;
    color: inherit;
}

button:disabled {
    cursor: default;
}

table {
    border-collapse: collapse;
}

a {
    text-decoration: none;
}

/* ── Theme base ────────────────────────────────────────── */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

/* ── Button utility (replaces Bootstrap .btn / .btn-primary) ── */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
    opacity: 0.65;
    cursor: default;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #175ba0;
    border-color: #14528f;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ── Form inputs (replaces Bootstrap .form-control / .form-select) ── */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    border-color: #86b7fe;
    outline: 0;
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    appearance: none;
}

.form-select:focus {
    border-color: #86b7fe;
    outline: 0;
}

.content {
    padding: 1.1rem 1.5rem 0 1.5rem;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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;
    }

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

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

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

body {
    background: #101214;
    color: #e3e4e6;
}

.navbar {
    background: #12151b;
}

.page {
    min-height: 100vh;
}

.top-row {
    border-bottom: 1px solid #272b34;
}

.market-page {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
    height: calc(100vh - 3.5rem - 1.1rem);
    overflow: hidden;
}

.market-sidebar, .market-main {
    min-height: 0;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.market-panel {
    background: #181c22;
    border: 1px solid #2c323a;
    border-radius: 0.4rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    color: #e3e4e6;
    font-size: 0.85rem;
}

.market-panel--sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.market-tree-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

.market-panel--main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.market-panel__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #2c323a;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
    flex-shrink: 0;
}

.market-section-title {
    font-size: 1rem;
    font-weight: 700;
}

.market-section-subtitle {
    color: #9aa1b3;
    margin-top: 0;
    font-size: 0.75rem;
}

.market-search input {
    width: 100%;
    background: #0f1318;
    border: 1px solid #2c323a;
    color: #e3e4e6;
    font-size: 0.8rem;
    padding: 0.3rem 1.4rem 0.3rem 0.5rem;
}

.market-category {
    margin-bottom: 0.1rem;
}

.market-category__title {
    color: #8a93a8;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

.market-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.market-tree__item {
    padding: 0.4rem 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: background 0.15s ease;
    color: #d7dade;
    font-size: 0.8rem;
}

.market-tree__item:hover,
.market-tree__item.selected {
    background: #232a33;
}

.market-panel__actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.market-panel__actions .form-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    margin: 0 0.4rem;
}

.market-panel__actions .btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    margin: 0 0.4rem;
}

.market-tabs {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    justify-content: flex-start;
}

.market-tab {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    border: 1px solid #2c323a;
    background: #13171d;
    color: #cfd4de;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-size: 0.85rem;
}

.market-tab.active,
.market-tab:hover {
    background: #1f2834;
    border-color: #3d4a5d;
}

.market-subtabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid #2c323a;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    flex-shrink: 0;
}

.market-subtab {
    padding: 0.3rem 0.6rem;
    border: none;
    background: transparent;
    color: #8a93a8;
    cursor: pointer;
    transition: color 0.15s ease, border-bottom 0.15s ease;
    border-bottom: 2px solid transparent;
    font-size: 0.8rem;
}

.market-subtab:hover {
    color: #c8cdd8;
}

.market-subtab.active {
    color: #00c4ff;
    border-bottom-color: #00c4ff;
}

.market-subtabs-spacer {
    flex: 1;
}

.history-range-btn {
    padding: 0.2rem 0.45rem;
    border: 1px solid #2c3a4a;
    background: transparent;
    color: #6a7c94;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.72rem;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    align-self: center;
    margin-left: 3px;
}

.history-range-btn:hover {
    color: #c8cdd8;
    border-color: #4a5a70;
}

.history-range-btn.active {
    color: #c8a040;
    border-color: #7a6030;
    background: rgba(200, 160, 64, 0.08);
}

.market-empty {
    padding: 1rem;
    color: #8a93a8;
    text-align: center;
    font-size: 0.8rem;
}

.market-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: #c8cdd8;
    flex-shrink: 0;
}

.market-summary div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.market-summary span {
    display: block;
    color: #7f8596;
    font-size: 0.7rem;
}

.market-summary strong {
    font-size: 0.85rem;
}

.market-order-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.market-order-panel {
    background: #11151a;
    border: 1px solid #222a33;
    border-radius: 0.3rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.market-order-panel__header {
    padding: 0.4rem 0.6rem;
    background: #161b22;
    border-bottom: 1px solid #232d39;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.market-order-panel__header .header-note {
    color: #8b949e;
    font-weight: 400;
    font-size: 0.7rem;
    font-style: italic;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    overflow-y: auto;
}

.market-table th,
.market-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #20272f;
    text-align: left;
}

.market-table th {
    color: #8a93a8;
    font-weight: 600;
    background: #0f1318;
    position: sticky;
    top: 0;
}

.market-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.market-table--history {
    width: auto;
}

.market-table-wrapper {
    overflow-y: auto;
    flex: 1;
}

.market-history-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem;
    background: #11151a;
    border: 1px solid #222a33;
    border-radius: 0.3rem;
    flex: 1;
    min-height: 0;
}

.eve-chart {
    width: 100%;
    height: 100%;
    min-height: 260px;
}

.chart-grid {
    stroke: #1d2a38;
    stroke-width: 0.7;
    stroke-dasharray: 4,4;
}

.chart-sep {
    stroke: #2a3a4e;
    stroke-width: 1;
}

.price-band {
    fill: rgba(38, 130, 170, 0.18);
    stroke: rgba(38, 160, 200, 0.35);
    stroke-width: 0.6;
}

.price-avg {
    stroke: #c8a040;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.price-dot {
    fill: #c8a040;
    stroke: #e0c060;
    stroke-width: 1;
}

.vol-bar {
    fill: rgba(40, 110, 175, 0.55);
}

.chart-label {
    fill: #6a7c94;
    font-size: 9px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* JS-injected SVG hover elements */
.chart-crosshair-line {
    stroke: rgba(200, 210, 220, 0.22);
    stroke-width: 1;
    stroke-dasharray: 3, 3;
    pointer-events: none;
}

.chart-crosshair-dot {
    fill: #c8a040;
    stroke: #e8c060;
    stroke-width: 1.5;
    pointer-events: none;
}

/* JS-injected tooltip */
.eve-chart-tooltip {
    position: fixed;
    background: rgba(14, 20, 30, 0.96);
    border: 1px solid #2d3d52;
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 0.73rem;
    color: #c8cdd8;
    pointer-events: none;
    z-index: 9999;
    min-width: 130px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    line-height: 1.4;
}

.eve-tt-date {
    color: #7ec8e8;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.eve-tt-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin: 1px 0;
}

.eve-tt-lbl {
    color: #5a6a80;
}

.eve-tt-div {
    border-top: 1px solid #253040;
    margin: 4px 0;
}

.esi-budget-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #2a1a00;
    border-bottom: 1px solid #7a4a00;
    color: #ffb347;
    font-size: 0.8rem;
}

.esi-budget-warning--critical {
    background: #2a0000;
    border-bottom-color: #7a0000;
    color: #ff6b6b;
}

.esi-budget-warning__icon {
    flex-shrink: 0;
}

.home-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 4rem);
    padding: 2rem;
}

.home-hero__content {
    background: #141820;
    padding: 2rem;
    border: 1px solid #2b323b;
    border-radius: 1rem;
    max-width: 780px;
}

.home-hero h1 {
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.home-hero p {
    margin-bottom: 1.5rem;
    color: #c7cbd5;
    line-height: 1.8;
}

.home-actions .btn {
    padding: 0.9rem 1.4rem;
}

/* ── Mobile layout ───────────────────────────────────── */
@media (max-width: 768px) {
    /* Market page: single-column, clipped at the grid level.
       min-width:0 on grid items is required — without it, min-width:auto lets items
       expand their 1fr track to match content width, making the page wider than the
       viewport. With min-width:0, the track stays at viewport width and overflow-x:hidden
       clips anything that leaks, while inner scroll containers still work. */
    .market-page {
        grid-template-columns: 1fr;
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .market-sidebar,
    .market-main {
        min-width: 0;
        max-height: none;
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .market-panel--sidebar {
        flex: none;
        height: auto;
        overflow: visible;
        max-height: none;
    }

    .market-tree-scroll {
        flex: none;
        max-height: 40vh;
        overflow-y: auto;
        overflow-x: auto;
    }

    .market-panel--main {
        flex: none;
        height: auto;
        overflow: visible;
    }

    /* min-width:0 must be applied all the way down the flex/grid chain to the wrapper.
       Each intermediate element has min-width:auto by default, which lets the element
       grow to match its content (the wide table) rather than staying at the viewport
       width. Without min-width:0 at every level, the wrapper ends up the same width
       as the table, so there is no overflow and nothing to scroll. */
    .market-order-stack {
        min-width: 0;
        flex: none;
        height: auto;
        overflow: visible;
    }

    .market-order-panel {
        min-width: 0;
        overflow: visible;
        max-height: none;
    }

    .market-table-wrapper {
        min-width: 0;
        width: 100%;
        flex: none;
        max-height: 35vh;
        min-height: 120px;
        overflow-y: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables: natural width so they overflow the wrapper and trigger scroll.
       width:100% cramps columns into the viewport with no overflow to scroll. */
    .market-table {
        width: auto;
        min-width: 100%;
    }

    /* History chart needs an explicit height (SVG requires a sized container) */
    .market-history-chart {
        flex: none;
        height: 280px;
    }

    .eve-chart {
        min-height: 0;
    }

    /* Summary stat grid: keep 2 cols, they fit fine on mobile */
    .market-summary {
        padding: 0.25rem 0;
    }

    /* Home hero: less padding on small screens */
    .home-hero {
        padding: 1rem;
        min-height: 0;
        align-items: flex-start;
    }

    .home-hero__content {
        padding: 1.25rem;
    }

    .home-hero h1 {
        font-size: 1.75rem;
    }
}
