﻿/* ==========================================================================
   MOBILE CARD LAYOUT — only activates on narrow screens
   ========================================================================== */

@media screen and (max-width: 860px) {

    .marketplace-container {
        padding: 12px 10px;
    }

    .card-list {
        display: block;
        width: 100%;
    }

    .card-list-header {
        display: none;
    }

    .card-item {
        display: flex;
        flex-direction: column;
        margin: 0 0 16px 0;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        background: white;
        box-shadow: 0 2px 6px rgba(0,0,0,0.07);
        overflow: hidden;
    }

        .card-item:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        }

    /* Image takes full width at top */
    .card-thumbnail {
        width: 100%;
        height: auto;
        max-height: 260px;
        object-fit: contain;
        background: #f9f9f9;
        padding: 12px;
        border-bottom: 1px solid #eee;
        border-radius: 10px 10px 0 0;
        margin: 0;
    }

    /* Key info — big and prominent */
    .card-name {
        font-size: 1.22rem;
        font-weight: 700;
        color: #1a2533;
        padding: 12px 14px 4px;
        line-height: 1.35;
    }

    .card-price {
        font-size: 1.38rem;
        font-weight: 700;
        color: #d32f2f;
        padding: 0 14px 8px;
    }

    .card-quantity {
        padding: 0 14px 12px;
        font-size: 1rem;
    }

    /* All other fields — compact two-column style when possible */
    .card-item > div:not(.card-name):not(.card-price):not(.card-quantity):not(.add-to-cart-cell):not(.card-thumbnail) {
        font-size: 0.94rem;
        color: #444;
        padding: 6px 14px;
        border-top: 1px solid #f0f0f0;
    }

    /* Visual grouping with pseudo-labels */
    .card-item > div[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: #2c3e50;
        display: inline-block;
        width: 110px; /* fixed label width for alignment */
        margin-right: 8px;
    }

    /* Make secondary info feel less cramped */
    .card-serial,
    .card-page,
    .card-slot,
    .card-binder {
        font-size: 0.92rem;
        color: #555;
    }

    /* Owner link gets special treatment */
    .card-owner {
        color: #0066cc;
        font-weight: 500;
    }

    /* Full-width action area */
    .add-to-cart-cell {
        padding: 14px !important;
        background: #f8fafc;
        border-top: 1px solid #e5e7eb;
        text-align: center;
    }

    .add-to-cart-btn {
        width: 100%;
        max-width: 320px;
        padding: 12px 16px;
        font-size: 1.05rem;
        justify-content: center;
    }

        .add-to-cart-btn svg {
            width: 20px;
            height: 20px;
        }
}

/* Very small phones — hide least important fields */
@media screen and (max-width: 480px) {
    .card-item > div[data-label="Serial:"],
    .card-item > div[data-label="Page:"],
    .card-item > div[data-label="Slot:"] {
        display: none;
    }

    .card-thumbnail {
        max-height: 220px;
    }

    .card-name {
        font-size: 1.15rem;
    }

    .card-price {
        font-size: 1.3rem;
    }

    .filter-form select {
        width: 100%;
    }

    .filter-form input {
        width: 100%;
    }
        .filter-form input[type="number"] {
            width: 20%;
        }
}
}
