.cards-grid.marketplace-mode {
    display: block;
    padding: 1.25rem;
    background: var(--bg-dark);
}

.marketplace-main {
    width: 100%;
    min-height: calc(100vh - 90px);
}

.marketplace-loading,
.marketplace-empty {
    border: 1px solid rgba(91, 163, 205, 0.25);
    border-radius: 8px;
    background: rgba(10, 43, 63, 0.86);
    color: #bdd5e8;
    padding: 1rem;
}

.marketplace-empty {
    grid-column: 1 / -1;
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.55rem;
    text-align: center;
}

.marketplace-empty strong {
    color: #f2f8ff;
    font-size: 1.2rem;
}

.marketplace-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.marketplace-filter-panel,
.marketplace-results-panel,
.marketplace-detail-info,
.marketplace-create-modal {
    border: 1px solid rgba(91, 163, 205, 0.28);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(14, 59, 84, 0.98), rgba(8, 36, 55, 0.98));
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.marketplace-filter-panel {
    position: sticky;
    top: 54px;
    padding: 1rem;
}

.marketplace-kicker {
    color: #8fc6ec;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.marketplace-filter-panel h1,
.marketplace-results-header h2,
.marketplace-detail-title h1,
.marketplace-detail-section h2,
.marketplace-create-modal h2 {
    margin: 0;
    color: #f2f8ff;
    line-height: 1.05;
}

.marketplace-filter-panel h1 {
    margin: 0.15rem 0 1rem;
    font-size: 1.45rem;
}

.marketplace-filter-form,
.marketplace-create-modal {
    display: grid;
    gap: 0.85rem;
}

.marketplace-filter-form label,
.marketplace-create-modal label {
    display: grid;
    gap: 0.35rem;
    color: #cce0f0;
    font-size: 0.85rem;
    font-weight: 900;
}

.marketplace-filter-form input,
.marketplace-filter-form select,
.marketplace-create-modal input,
.marketplace-create-modal select,
.marketplace-create-modal textarea,
.marketplace-message-form textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(125, 177, 213, 0.28);
    border-radius: 8px;
    background: rgba(3, 24, 38, 0.72);
    color: #f4fbff;
    font: inherit;
    font-weight: 700;
    outline: none;
    padding: 0.72rem 0.8rem;
}

.marketplace-filter-form input::placeholder,
.marketplace-create-modal input::placeholder,
.marketplace-create-modal textarea::placeholder {
    color: #7199b5;
}

.marketplace-filter-form input:focus,
.marketplace-filter-form select:focus,
.marketplace-create-modal input:focus,
.marketplace-create-modal select:focus,
.marketplace-create-modal textarea:focus,
.marketplace-message-form textarea:focus {
    border-color: #51aee0;
    box-shadow: 0 0 0 3px rgba(81, 174, 224, 0.16);
}

.marketplace-search-field input {
    min-height: 44px;
}

.marketplace-filter-row,
.marketplace-form-row,
.marketplace-filter-actions,
.marketplace-modal-actions,
.marketplace-detail-actions {
    display: flex;
    gap: 0.65rem;
}

.marketplace-filter-row > *,
.marketplace-form-row > * {
    flex: 1 1 0;
}

.marketplace-check {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    flex-direction: row;
}

.marketplace-check input {
    width: auto;
}

.marketplace-primary-btn,
.marketplace-secondary-btn,
.marketplace-create-btn,
.marketplace-back-btn,
.marketplace-icon-btn {
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(96, 170, 218, 0.44);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0 0.95rem;
}

.marketplace-primary-btn,
.marketplace-create-btn {
    background: #2b8ab3;
    border-color: #3aa9dc;
    color: #ffffff;
}

.marketplace-secondary-btn,
.marketplace-back-btn {
    background: rgba(20, 45, 70, 0.95);
    color: #d8ebf8;
}

.marketplace-secondary-btn.danger {
    border-color: rgba(238, 109, 125, 0.55);
    background: rgba(92, 31, 43, 0.9);
    color: #ffd7dc;
}

.marketplace-create-btn {
    width: 100%;
    margin-top: 1rem;
}

.marketplace-results-panel {
    min-width: 0;
    padding: 1rem;
}

.marketplace-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.marketplace-results-header p {
    margin: 0.25rem 0 0;
    color: #9fc5df;
    font-weight: 800;
}

.marketplace-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.9rem;
}

.marketplace-card {
    min-width: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(8, 37, 57, 0.78);
    color: #eff8ff;
    cursor: pointer;
    padding: 0;
    text-align: left;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(91, 163, 205, 0.22);
}

.marketplace-card:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(99, 191, 238, 0.48), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.marketplace-card-photo {
    display: block;
    aspect-ratio: 1.16 / 1;
    background: #092235;
}

.marketplace-card-photo img,
.marketplace-detail-photo img,
.marketplace-photo-viewer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.marketplace-card-body {
    display: grid;
    gap: 0.2rem;
    padding: 0.7rem;
}

.marketplace-card-body strong {
    color: #ffffff;
    font-size: 1.05rem;
}

.marketplace-card-body span {
    color: #edf8ff;
    font-weight: 800;
    line-height: 1.25;
}

.marketplace-card-body small,
.marketplace-card-body em {
    color: #95bad4;
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 800;
}

.marketplace-detail {
    display: grid;
    grid-template-columns: minmax(420px, 760px) minmax(360px, 540px);
    gap: 1rem;
    align-items: start;
    justify-content: center;
}

.marketplace-back-btn {
    grid-column: 1 / -1;
    justify-self: start;
}

.marketplace-detail-photo {
    height: min(620px, calc(100vh - 170px));
    max-height: 620px;
    border-radius: 8px;
    background: rgba(2, 19, 30, 0.82);
    overflow: hidden;
}

.marketplace-detail-photo button {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: zoom-in;
}

.marketplace-detail-photo img {
    object-fit: contain;
}

.marketplace-detail-info {
    position: sticky;
    top: 54px;
    padding: 1rem;
    display: grid;
    gap: 1rem;
}

.marketplace-detail-title {
    display: grid;
    gap: 0.35rem;
}

.marketplace-detail-title h1 {
    font-size: 1.7rem;
}

.marketplace-detail-title strong {
    color: #ffffff;
    font-size: 1.3rem;
}

.marketplace-detail-title span,
.marketplace-detail-section p {
    color: #bfd7e9;
    font-weight: 700;
}

.marketplace-message-form {
    display: grid;
    gap: 0.65rem;
    width: 100%;
}

.marketplace-message-form textarea {
    min-height: 86px;
    resize: vertical;
}

.marketplace-detail-section {
    display: grid;
    gap: 0.8rem;
    border-top: 1px solid rgba(125, 177, 213, 0.2);
    padding-top: 1rem;
}

.marketplace-detail-section dl {
    display: grid;
    gap: 0.55rem;
    margin: 0;
}

.marketplace-detail-section dl div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.75rem;
}

.marketplace-detail-section dt {
    color: #8fb7d3;
    font-weight: 900;
}

.marketplace-detail-section dd {
    color: #f0f8ff;
    margin: 0;
    font-weight: 800;
}

.marketplace-modal-overlay,
.marketplace-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(1, 13, 24, 0.76);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.marketplace-create-modal {
    width: min(720px, 100%);
    max-height: min(880px, calc(100vh - 2rem));
    overflow: auto;
    padding: 1rem;
}

.marketplace-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.marketplace-modal-header p {
    margin: 0 0 0.2rem;
    color: #8fc6ec;
    font-weight: 900;
    text-transform: uppercase;
}

.marketplace-icon-btn {
    width: 38px;
    min-height: 38px;
    padding: 0;
    background: rgba(19, 38, 58, 0.95);
    color: #eaf6ff;
}

.marketplace-form-status {
    min-height: 1.2rem;
    color: #9fd6f6;
    font-weight: 800;
}

.marketplace-photo-viewer {
    z-index: 2100;
}

.marketplace-photo-viewer .marketplace-icon-btn {
    position: fixed;
    right: 1rem;
    top: 1rem;
}

.marketplace-photo-viewer img {
    width: min(1200px, calc(100vw - 2rem));
    height: min(900px, calc(100vh - 2rem));
    object-fit: contain;
    border-radius: 8px;
    background: #061d2e;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .cards-grid.marketplace-mode {
        padding: 0.8rem;
    }

    .marketplace-layout,
    .marketplace-detail {
        grid-template-columns: 1fr;
    }

    .marketplace-filter-panel,
    .marketplace-detail-info {
        position: static;
    }

    .marketplace-detail-photo {
        height: min(520px, 70vh);
        max-height: 520px;
    }
}

@media (max-width: 620px) {
    .marketplace-filter-row,
    .marketplace-form-row,
    .marketplace-filter-actions,
    .marketplace-results-header,
    .marketplace-modal-actions {
        flex-direction: column;
    }

    .marketplace-listings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }
}
