/* /portal/css/market.css */

/* --- Header Balance --- */
.market-balance {
    margin-inline-start: auto;
    background: #fef3c7;
    color: #d97706;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Tabs --- */
.market-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-light);
}
.tab-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab-btn.active {
    color: var(--primary-accent);
    border-bottom-color: var(--primary-accent);
    font-weight: 700;
}

/* --- Views --- */
.market-view { display: none; animation: fadeIn 0.3s ease; }
.market-view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Controls (Search & Chips) --- */
.market-controls {
    margin-bottom: 25px;
}
.search-bar {
    position: relative;
    margin-bottom: 15px;
}
.search-bar i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 15px;
    color: var(--text-secondary);
}
[dir="rtl"] .search-bar i { left: auto; right: 15px; }

.search-bar input {
    width: 100%;
    padding: 12px 15px;
    padding-left: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    font-size: 15px;
    background: var(--card-background);
}
[dir="rtl"] .search-bar input { padding-left: 15px; padding-right: 40px; }

.category-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}
.category-chips::-webkit-scrollbar { display: none; }

.chip {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.chip:hover { background: var(--portal-background); }
.chip.active {
    background: var(--primary-accent);
    color: white;
    border-color: var(--primary-accent);
}

/* --- Product Grid --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding-bottom: 30px;
}

.product-card {
    background: var(--card-background);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); }

.product-img {
    height: 140px;
    width: 100%;
    position: relative;
}
.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.price-tag {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(4px);
}
.price-tag.free { background: #2ecc71; }
[dir="rtl"] .price-tag { right: auto; left: 8px; }

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-info small {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.product-info h3 {
    font-size: 15px;
    margin: 0 0 12px 0;
    line-height: 1.3;
    flex-grow: 1;
}

.btn-add {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary-accent);
    background: white;
    color: var(--primary-accent);
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-add:hover {
    background: var(--primary-accent);
    color: white;
}

/* --- Order History Items --- */
.order-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
}
.order-item:last-child { border-bottom: none; }
.order-icon {
    width: 40px; height: 40px;
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.order-info { flex-grow: 1; }
.order-info h4 { margin: 0 0 4px 0; font-size: 15px; }
.order-info p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.order-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
}
.order-status.delivered { background: #ecfdf5; color: #059669; }
.order-status.completed { background: #eff6ff; color: #2563eb; }

@media (max-width: 600px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .product-img { height: 120px; }
    .product-info { padding: 12px; }
}