:root {
    --mk-bg: linear-gradient(120deg, #eef7ff 0%, #fdf3e7 100%);
    --mk-card: #ffffff;
    --mk-primary: #0a6c7d;
    --mk-secondary: #f29e4c;
    --mk-muted: #6c757d;
    --mk-border: #e9ecef;
}

.market-hero {
    background: var(--mk-bg);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--mk-border);
}

.market-section-title {
    font-weight: 700;
    color: #17313a;
}

.market-search-panel {
    background: #fff;
    border-radius: 22px;
    border: 1px solid var(--mk-border);
    box-shadow: 0 18px 36px rgba(26, 42, 71, 0.08);
    padding: 1.35rem;
    margin-bottom: 2rem;
}

.market-search-panel .form-control {
    border-radius: 12px;
    border-color: #d6e1e7;
}

.market-search-panel .btn {
    border-radius: 12px;
}

.filter-chip {
    border-radius: 999px;
    border: 1px solid #dce6ea;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    color: #30444f;
    background: #f7fafb;
    display: inline-block;
}

.market-card {
    border: 1px solid var(--mk-border);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: var(--mk-card);
    height: 100%;
}

.market-listing-card {
    border: 1px solid #dbe5ec;
}

.market-card-body {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.market-card-title {
    font-size: 1.02rem;
    color: #13313d;
    line-height: 1.35;
}

.price-bubble {
    border-radius: 999px;
    padding: 0.24rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #0b6c8f;
    color: #fff;
    white-space: nowrap;
}

.listing-meta-row {
    padding-left: 2px;
}

.card-tags .badge-soft {
    margin-right: 0.2rem;
}

.station-chip {
    border-color: #cde8d8;
    background: #edf9f1;
    color: #1f6f3c;
}

.market-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(23, 49, 58, 0.12);
}

.market-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #f2f4f5;
}

.badge-soft {
    background: #eaf4f7;
    color: #174b59;
    border: 1px solid #d5e9ee;
    border-radius: 999px;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
    display: inline-block;
}

.badge-action {
    background: #fff3e6;
    color: #8f4f00;
    border-color: #ffd9b1;
}

.slider-wrap label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #324a53;
}

.slider-wrap input[type='range'] {
    width: 100%;
}

.price-slider-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.7rem 0.8rem;
    background: #f8fbff;
}

.price-pill {
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0b4f6c;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 0.2rem 0.55rem;
}

.range-input-modern {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #0d8bb5 0%, #dbeafe 0%);
    outline: none;
    margin-top: 8px;
}

.range-input-modern::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: #0b6c8f;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.32);
    cursor: pointer;
}

.range-input-modern::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: #0b6c8f;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.32);
    cursor: pointer;
}

.range-input-modern::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: transparent;
}

.market-subtle {
    color: var(--mk-muted);
    font-size: 0.9rem;
}

.preset-chip {
    border-radius: 999px;
    border: 1px solid #d6e4f0;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    color: #1e3a4a;
    background: #f7fbff;
    font-weight: 600;
    display: inline-block;
}

.preset-chip:hover {
    color: #0c4a6e;
    background: #eaf5ff;
}

.preset-chip.active {
    color: #fff;
    border-color: #0b6c8f;
    background: linear-gradient(120deg, #0b6c8f 0%, #0d8bb5 100%);
}

.saved-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.saved-filter-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f8fafc;
}

.saved-filter-link {
    font-weight: 600;
    color: #0f4c5c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-box {
    border: 1px solid var(--mk-border);
    border-radius: 14px;
    padding: 1rem;
    background: #fff;
}

.listing-builder-panel {
    border-radius: 22px;
    padding: 1.5rem;
}

.builder-section {
    border: 1px solid #e8edf1;
    border-radius: 16px;
    padding: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.builder-section h5 {
    font-weight: 600;
    color: #17313a;
    font-size: 1.1rem;
}

.builder-section .row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.375rem;
}

.builder-section [class*='col-'] {
    padding: 0.375rem;
}

.builder-section .form-label,
.builder-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    color: #445a64;
}

.builder-section .form-control,
.builder-section .form-select {
    display: block !important;
    width: 100% !important;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #dfe7ec;
    background: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
}

.builder-section .form-control:focus,
.builder-section .form-select:focus {
    outline: none;
    border-color: #3aa2b7;
    box-shadow: 0 0 0 3px rgba(58, 162, 183, 0.1);
}

.builder-section .form-control-lg {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

.builder-section .invalid-feedback,
.builder-section .errorlist {
    display: block;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.upload-dropzone {
    border: 2px dashed #b8d5de;
    background: linear-gradient(135deg, #f6fbfe 0%, #f3f7fa 100%);
    border-radius: 14px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: #3aa2b7;
    background: #eef8fc;
    transform: translateY(-1px);
}

.upload-dropzone-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #e1f2f7;
    color: #0b6373;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.upload-dropzone-title {
    font-weight: 600;
    color: #17313a;
    margin-bottom: 0.25rem;
}

.upload-dropzone-subtitle {
    color: #5b717b;
    font-size: 0.88rem;
}

.upload-preview-grid {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.upload-preview-card {
    border: 1px solid #dfe7ec;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.upload-preview-image {
    width: 100%;
    height: 86px;
    object-fit: cover;
    background: #f0f4f8;
}

.upload-preview-name {
    font-size: 0.75rem;
    color: #445a64;
    padding: 0.35rem 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes mk-rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .market-hero {
        padding: 1.1rem;
        border-radius: 16px;
        box-shadow: 0 10px 22px rgba(19, 49, 61, 0.08);
    }

    .market-section-title {
        font-size: 1.7rem;
        line-height: 1.2;
    }

    .market-subtle {
        font-size: 0.9rem;
        line-height: 1.42;
    }

    .market-search-panel,
    .listing-builder-panel {
        border-radius: 14px;
        padding: 0.95rem;
        box-shadow: 0 14px 30px rgba(16, 57, 74, 0.1);
        .builder-section {
            border-radius: 12px;
            padding: 0.85rem;
        }

        .builder-section [class*='col-'] {
            padding: 0.4rem;
        }

        .builder-section .form-label,
        .builder-section label {
            font-size: 0.9rem;
            margin-bottom: 0.3rem;
        }

        .builder-section .form-control,
        .builder-section .form-select {
            font-size: 16px;
            padding: 0.5rem 0.75rem;
        }

        .builder-section .form-control-lg {
            font-size: 1rem;
        }
    }

    .market-image {
        height: 170px;
    }

    .builder-section {
        padding: 0.8rem;
        border-radius: 12px;
    }

    .builder-section h5 {
        font-size: 1.45rem;
        line-height: 1.2;
        margin-bottom: 0.75rem !important;
    }

    .upload-dropzone {
        min-height: 140px;
    }

    .market-search-panel .form-control,
    .market-search-panel .form-select,
    .listing-builder-panel .form-control,
    .listing-builder-panel .form-select {
        min-height: 44px;
        font-size: 15px;
    }

    #listing-builder-form .d-flex.gap-2.justify-content-end {
        position: sticky;
        bottom: 82px;
        z-index: 40;
        padding: 0.65rem;
        border-radius: 12px;
        background: rgba(245, 250, 253, 0.96);
        border: 1px solid rgba(183, 207, 219, 0.72);
        backdrop-filter: blur(6px);
    }

    #listing-builder-form .d-flex.gap-2.justify-content-end .btn {
        flex: 1 1 0;
        min-height: 44px;
    }

    .saved-filters {
        grid-template-columns: 1fr;
    }

    .market-hero {
        animation: mk-rise-in 0.45s ease-out both;
    }

    #listing-builder-form .builder-section {
        animation: mk-rise-in 0.5s ease-out both;
    }

    #listing-builder-form .builder-section:nth-of-type(1) {
        animation-delay: 0.06s;
    }

    #listing-builder-form .builder-section:nth-of-type(2) {
        animation-delay: 0.14s;
    }

    #listing-builder-form .builder-section:nth-of-type(3) {
        animation-delay: 0.22s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-hero,
    #listing-builder-form .builder-section {
        animation: none !important;
    }
}

@media (max-width: 420px) {
    .market-search-panel .row > [class*='col-'] {
        width: 100%;
    }

    .preset-chip {
        width: 100%;
        text-align: center;
    }
}
