/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&display=swap');

:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #238636;
    --accent-hover: #2ea043;
    --border: #30363d;
    --nav-bg: #161b22d0;
    /* glassmorphism */
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Header Restructure */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    padding: 0;
    /* Remove default padding, handle in inner elements */
    display: flex;
    flex-direction: column;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 60px;
    width: auto;
}

.search-header {
    flex-grow: 1;
    max-width: 600px;
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
}

.search-header:focus {
    border-color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Categories Bar */
.nav-categories {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 2rem;
    overflow-x: auto;
    white-space: nowrap;
    background: rgba(22, 27, 34, 0.95);
    /* Hide scrollbar but allow scroll */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-categories::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--border);
    color: var(--text-primary);
}

.container {
    padding: 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Controls modified - removed search bar from here as it moved to header */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    /* background: var(--card-bg); Removed background for cleaner look since search is gone */
    /* padding: 1rem; */
    /* border: 1px solid var(--border); */
}

/* Form Elements */
input[type="text"],
select {
    background: var(--bg-color);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
    border-color: var(--text-secondary);
}

select {
    cursor: pointer;
}

/* Grid & Spacing Fixes */
.listing-grid {
    display: grid;
    /* Reduced minmax slightly to allow more items and tighter feel */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    /* Tightened gap from 1.5rem */
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    /* Slightly tighter radius */
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure full height fill */
}

.card:hover {
    transform: translateY(-2px);
    /* Subtle lift */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-color: var(--text-secondary);
}

.card-img {
    width: 100%;
    height: 160px;
    /* Slightly smaller image area to compact the card */
    object-fit: cover;
    background: #21262d;
    display: block;
    /* Removes bottom whitespace of img inline */
}

.card-body {
    padding: 0.8rem;
    /* Reduced padding */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    /* Tighter vertical spacing */
}

.badge {
    align-self: flex-start;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.badge.auction {
    background: #9e6a03;
    color: #fff;
}

.badge.buynow {
    background: #238636;
    color: #fff;
}

.card-title {
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.card-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
}

/* Detail View */
.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.detail-img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.detail-info h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.action-btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--accent-hover);
}

@media (max-width: 768px) {
    .detail-container {
        grid-template-columns: 1fr;
    }
}