/* bazaar.css */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
}

.section {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.page-header h1 {
    font-size: 2rem;
}

.page-header p {
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.bazaar-layout {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 1.25rem;
    min-height: 0;
    align-items: start;
}

.filters-panel {
    background: var(--surface);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.filters-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filters-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.filter-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.filter-input__icon {
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.filter-input__field {
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-size: 0.9rem;
    min-width: 0;
    width: 100%;
}

.filters-form select {
    font-size: 0.9rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--ink);
    width: 100%;
}

.volume-input {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.volume-input input[type="number"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--ink);
}

.facet-filters summary,
.column-toggle summary {
    cursor: pointer;
    list-style: none;
    color: var(--accent-strong);
    font-weight: 600;
}

.facet-filters summary::marker,
.column-toggle summary::marker {
    content: "";
}

.facet-filters-grid {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.facet-filters-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.facet-filters-grid input[type="number"] {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--ink);
}

.column-toggle-grid {
    margin-top: 0.35rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.35rem 0.7rem;
}

.column-toggle-grid label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.filters-submit {
    margin-top: 0.3rem;
    font-size: 0.9rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    align-self: flex-start;
    box-shadow: var(--shadow-soft);
}

.filters-submit:hover {
    background: var(--accent-strong);
}

.table-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.card-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border-radius: 0.8rem;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background-color: var(--surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table th,
.table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid rgba(229, 220, 209, 0.8);
    white-space: nowrap;
    text-align: right;
}

.table th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.table td {
    font-size: 0.88rem;
    color: var(--ink);
}

.table .item-col {
    text-align: left;
}

.item-link {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}

.item-sub {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.profit-positive {
    color: var(--success);
    font-weight: 700;
}

.profit-negative {
    color: var(--danger);
    font-weight: 700;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th.sortable::after {
    content: "";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
}

th.sortable.sorted-asc::after {
    content: "\25B2";
}

th.sortable.sorted-desc::after {
    content: "\25BC";
}

.hidden-column {
    display: none !important;
}

.card-footer-text {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

@media (max-width: 900px) {
    .page {
        padding: 0.75rem 0;
    }

    .bazaar-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .filters-panel {
        position: static;
        max-height: none;
        width: 100%;
    }

    .filters-submit {
        align-self: stretch;
        text-align: center;
    }

    .column-toggle-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}
