:root {
    --bg-main: rgba(43, 49, 54, 0.97);
    --bg-panel: #1f1f1f;
    --accent: #d4b06a;
    --text: #e0e0e0;
    --border: #3a3a3a;
    --table-border: rgba(132, 132, 132, 0.24);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-main);
    color: var(--text);
}

.flexbox {
    width: 100%;
    max-width: 100%;
    min-width: 1%;
}

.container {
    position: relative;
    width: 98%;
    display: block;
    min-height: 50vh;
}
/* ensure positioning context */

.tabs-toggle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%); /* overlaps the top border */
    display: inline-flex;
    gap: 6px;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.tab-btn {
    appearance: none;
    border: 0;
    z-index: 1; /* above the highlight */
    background: transparent;
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    font: inherit;
    cursor: pointer;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease, transform .08s ease;
}

.tab-btn:hover {
    background: rgba(212, 176, 106, 0.15); /* accent tint */
    color: var(--text);
}

.tab-btn:active {
    transform: translateY(1px);
}

.tab-btn.active {
    background: var(--accent);
    color: var(--bg-main);
}

.tab-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 999px;
}

/* Hide inactive list */
.history-list.hidden {
    display: none;
}

/* Optional: reinforce top border under pill so it looks continuous */
.container {
    background: var(--bg-panel);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
}

/* (Optional) Compact the legal link contrast on hover to match theme */
.link:hover {
    color: #fff;
}


.container {
    max-width: 1300px;
    margin: 0 auto;
    background: var(--bg-panel);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
}

header {
    border-bottom: 3px solid var(--border);
    padding: 12px;
    padding-top: 44px;
    text-align: center;
}

header h1 {
    color: var(--accent);
}

.shop-info {
    padding: 2rem;
}

.shop-info p {
    margin-top: 6px;
}

main {
    padding: 12px;
}

/* Responsive Table Styles */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr 1fr;
    background-color: #2c2c2c;
    font-weight: bold;
    border-bottom: 2px solid var(--table-border);
    padding: 0;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr 1fr;
    border-bottom: 1px solid var(--table-border);
    transition: background-color 0.5s ease, color 0.5s ease;
}

.table-row:hover {
    background-color: rgb(38 38 38);
}

.table-cell {
    padding: 12px 8px;
    border-right: 1px solid var(--table-border);
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
}

.table-cell:last-child {
    border-right: none;
}

.table-header .table-cell {
    background-color: #2c2c2c;
    font-weight: bold;
}

@media (max-width: 1324px) {

    .container {
        margin: 10px;
    }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .table-header {
        display: none;
    }

    .table-row {
        display: block;
        border: 1px solid var(--table-border);
        margin-bottom: 10px;
        border-radius: 4px;
    }

    .table-cell {
        display: block;
        border-right: none;
        border-bottom: 1px solid var(--table-border);
        padding: 8px 12px;
    }

    .table-cell:last-child {
        border-bottom: none;
    }

    .table-cell:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #ffffff;
    }
}

/* Optional: Style for buy/sell types */
.table-cell:last-child {
    font-weight: bold;
}

.positive-amount {
    color: #70ff70;
}

.negative-amount {
    color: #e15c5c;
}

@media (max-width: 600px) {
    .filters {
        flex-direction: column;
    }
}

.legal {
    position: fixed;
    left: auto;
    top: auto;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    margin-top: 0;
    margin-right: 10px;
    margin-bottom: 10px;
}

.link {
    color: #d8d8d8;
    text-decoration: none;
}

.link:hover {
    color: #ffffff;
}

.subname {
    font-size: 0.7rem;
    color: #ababab
}

.hidden {
    display: none
}

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

.stat-card {
    position: relative;
    text-align: right;
    background: #0e0e0e;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-20px);
    animation: flyIn 0.3s ease-out forwards;
}

.stat-card.positive {
    background: #275330;
}

.stat-card:before {
    content: "🪙";
    position: absolute;
    left: 10px;
    top: 5px;
}

.stat-card .label {
    display: block;
    font-size: 0.85rem;
    color: #c4c4c4;
    margin-bottom: 0.25rem;
}

.stat-card .value {
    font-weight: bold;
    font-size: 1rem;
    color: #f9f9f9;
}

.stat-card.total {
    background: #ffe9b5;
}

/* cascade: each card starts a bit later */
.stat-card:nth-child(1) {
    animation-delay: 0.05s;
}
.stat-card:nth-child(2) {
    animation-delay: 0.1s;
}
.stat-card:nth-child(3) {
    animation-delay: 0.15s;
}
.stat-card:nth-child(4) {
    animation-delay: 0.2s;
}
.stat-card:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes flyIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loader-bar {
    position: relative;
    height: 4px;
    width: 100%;
    background: #1f1f1f; /* track background */
    border-radius: 4px;
    overflow: hidden;
}

.loader-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 30%; /* size of the moving block */
    background: linear-gradient(90deg, #ad8b47, #d4b06a);
    border-radius: 4px;
    animation: loader-slide 1.2s ease-in-out infinite;
}

@keyframes loader-slide {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Grid */
.shop-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Card */
.shop-card {
    max-width: 300px; /* hard cap requested */
    width: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;

    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    overflow: hidden;

    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

/* Hover effect */
.shop-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
    border-color: #444;
}

/* Image area */
.shop-card__image {
    aspect-ratio: 16/9; /* consistent tile size */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1a1a1a, #0f0f0f);
}

.shop-card__image img {
    max-width: 70%;
    max-height: 70%;
    object-fit: contain;
}

/* Name */
.shop-card__name {
    padding: 12px 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
