/* ===========================
   MARKET HEADER
=========================== */
.market-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.market-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.market-title-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-dark, #4f46e5));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(var(--accent-rgb, 124,58,237),0.3);
}

.market-title {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
    line-height: 1.1;
}

.market-subtitle {
    font-size: 12px;
    color: #555;
    margin-top: 2px;
}

.market-search-wrap {
    position: relative;
    flex-shrink: 0;
}

.market-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #444;
    font-size: 12px;
    pointer-events: none;
}

.market-search {
    background: #111318;
    border: 1px solid #1e2030;
    border-radius: 8px;
    padding: 9px 14px 9px 32px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    width: 220px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.market-search::placeholder { color: #444; }

.market-search:focus {
    border-color: var(--accent, #7c3aed);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 124,58,237),0.15);
}

/* ===========================
   MARKET LAYOUT
=========================== */
.market-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* ===========================
   SIDEBAR
=========================== */
.market-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #111318;
    border-radius: 12px;
    padding: 16px 12px;
    position: sticky;
    top: 20px;
}

.sidebar-title {
    font-size: 9px;
    font-weight: 700;
    color: #444;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-left: 4px;
}

.sidebar-divider {
    height: 1px;
    background: #1e2030;
    margin: 14px 0;
}

.cat-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cat-item, .sort-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: background 0.18s, color 0.18s;
    user-select: none;
}

.cat-item:hover, .sort-item:hover {
    background: #1a1c24;
    color: #aaa;
}

.cat-item.active, .sort-item.active {
    background: linear-gradient(90deg, rgba(var(--accent-rgb, 124,58,237),0.15), rgba(var(--accent-dark-rgb, 79,70,229),0.08));
    color: var(--accent-lighter, #c084fc);
    border: 1px solid rgba(var(--accent-rgb, 124,58,237),0.2);
}

.cat-icon {
    font-size: 12px;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.cat-badge {
    margin-left: auto;
    background: #1e2030;
    color: #555;
    font-size: 10px;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 7px;
    min-width: 22px;
    text-align: center;
}

.cat-item.active .cat-badge {
    background: rgba(var(--accent-rgb, 124,58,237),0.2);
    color: var(--accent-lighter, #c084fc);
}

/* ===========================
   PRODUCT GRID
=========================== */
.market-content {
    flex: 1;
    min-width: 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.product-card {
    background: #111318;
    border-radius: 12px;
    border: 1px solid #1a1c24;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.22s, transform 0.22s, box-shadow 0.22s;
    position: relative;
}

.product-card:hover {
    border-color: var(--accent, #7c3aed);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(var(--accent-rgb, 124,58,237),0.15);
}

/* Badge */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 20px;
    z-index: 2;
    text-transform: uppercase;
}

.badge-vip      { background: rgba(var(--accent-rgb, 124,58,237),0.85); color: #fff; }
.badge-hot      { background: rgba(239,68,68,0.85);  color: #fff; }
.badge-arac     { background: rgba(14,165,233,0.85); color: #fff; }
.badge-karakter { background: rgba(16,185,129,0.85); color: #fff; }
.badge-ozel     { background: rgba(245,158,11,0.85); color: #fff; }

/* Product image area */
.product-img-wrap {
    width: 100%;
    height: 130px;
    overflow: hidden;
    flex-shrink: 0;
}

.product-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: rgba(255,255,255,0.4);
    transition: transform 0.3s;
}

.product-img-real {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s;
}

.product-card:hover .product-img-real {
    transform: scale(1.05);
}

.product-card:hover .product-img-placeholder {
    transform: scale(1.05);
}

/* Product info */
.product-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.product-desc {
    font-size: 11.5px;
    color: #555;
    line-height: 1.5;
    flex: 1;
}

    .product-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        overflow: hidden;
    }

.product-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-lighter, #c084fc);
    letter-spacing: -0.3px;
}

.btn-buy {
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-dark, #4f46e5));
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}

.btn-buy:hover {
    opacity: 0.88;
    transform: scale(1.03);
}

/* Empty state */
.market-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: #333;
    font-size: 13px;
}

.market-empty i {
    font-size: 36px;
}

/* ===========================
   MODAL
=========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: #111318;
    border: 1px solid var(--accent-dark, #2a1f4a);
    border-radius: 16px;
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    position: relative;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(var(--accent-rgb, 124,58,237),0.15);
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: #1a1c24;
    border: 1px solid #2a2c38;
    border-radius: 8px;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: var(--accent-dark, #2a1f4a);
    color: var(--accent-lighter, #c084fc);
}

.modal-img-wrap {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.modal-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: rgba(255,255,255,0.35);
}

.modal-body {
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-badge-wrap .product-badge {
    position: static;
    display: inline-flex;
}

.modal-name {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.modal-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

.modal-features {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: #0d0f14;
    border-radius: 8px;
    border: 1px solid #1a1c24;
}

.modal-feature {
    font-size: 12px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-feature i {
    font-size: 10px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    gap: 12px;
}

.modal-price {
    font-size: 26px;
    font-weight: 900;
    color: var(--accent-lighter, #c084fc);
    letter-spacing: -0.5px;
}

.btn-buy-modal {
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-dark, #4f46e5));
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 16px rgba(var(--accent-rgb, 124,58,237),0.3);
}

.btn-buy-modal:hover {
    opacity: 0.88;
    transform: scale(1.02);
}

/* ===========================
   MARKET MOBILE
=========================== */

/* Tablet: 2-column grid + narrower sidebar */
@media (max-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .market-sidebar {
        width: 160px;
        padding: 12px 10px;
    }

    .cat-item, .sort-item {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Mobile: full stacked layout */
@media (max-width: 768px) {

    /* Stack sidebar above content */
    .market-layout {
        flex-direction: column;
        gap: 10px;
    }

    /* Sidebar goes full width, horizontal scroll pill layout */
    .market-sidebar {
        width: 100%;
        position: static;
        padding: 12px 12px 10px;
        border-radius: 10px;
    }

    .sidebar-title {
        display: none; /* hidden on mobile — pills are self-explanatory */
    }

    /* Categories become horizontally scrollable pills */
    .cat-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cat-list::-webkit-scrollbar {
        display: none;
    }

    .cat-item, .sort-item {
        flex-shrink: 0;
        white-space: nowrap;
        justify-content: center;
        font-size: 12px;
        padding: 7px 12px;
        border-radius: 20px;
        gap: 6px;
        min-width: unset;
    }

    /* Hide sort section on mobile — saves space */
    .sidebar-divider,
    .sidebar-sort-section {
        display: none;
    }

    .cat-badge {
        display: none;
    }

    /* Page header stacks vertically */
    .market-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 6px;
    }

    .market-title-block {
        gap: 10px;
    }

    .market-title-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-radius: 10px;
    }

    .market-title {
        font-size: 18px;
    }

    /* Search bar full width */
    .market-search-wrap {
        width: 100%;
        flex-shrink: unset;
    }

    .market-search {
        width: 100%;
        font-size: 14px;
        padding: 10px 14px 10px 34px;
    }

    /* 2 column grid on tablets/mid-mobile */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Taller images on mobile for visual clarity */
    .product-img-wrap {
        height: 120px;
    }

    .product-info {
        padding: 10px 12px 12px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-desc {
        font-size: 11px;
    }

    .product-price {
        font-size: 14px;
    }

    .btn-buy {
        font-size: 10px;
        padding: 5px 9px;
        gap: 4px;
    }

    /* Modal as bottom sheet on mobile */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-box {
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-overlay.open .modal-box {
        transform: translateY(0);
    }

    /* Drag handle indicator */
    .modal-box::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: #2a2c38;
        border-radius: 4px;
        margin: 12px auto 0;
    }

    .modal-img-wrap {
        height: 160px;
    }

    .modal-name {
        font-size: 17px;
    }

    .modal-price {
        font-size: 22px;
    }

    .btn-buy-modal {
        padding: 10px 18px;
        font-size: 12px;
    }

    .modal-body {
        padding: 14px 18px 28px;
    }
}

/* Very small phones: single column grid */
@media (max-width: 420px) {

    .product-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .product-img-wrap {
        height: 150px;
    }

    .product-img-placeholder {
        font-size: 44px;
    }

    .product-name {
        font-size: 14px;
    }

    .product-desc {
        font-size: 11.5px;
    }

    .product-price {
        font-size: 15px;
    }

    .btn-buy {
        font-size: 11px;
        padding: 6px 11px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn-buy-modal {
        justify-content: center;
        width: 100%;
    }
}
