:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --success: #16a34a;
    --error: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem 1.25rem;
    flex-wrap: wrap;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.search-form {
    flex: 1;
    display: flex;
    min-width: 200px;
}

.search-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px 0 0 6px;
    font-size: 0.9rem;
}

.search-form button {
    padding: 0.5rem 1rem;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
}

.main-nav a:hover { color: var(--primary); }

.btn-link {
    background: var(--primary);
    color: #fff !important;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
}

.btn-link:hover { background: var(--primary-dark); }

.inline-form { display: inline; }

.link-button {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    font-family: inherit;
}

.link-button:hover { color: var(--primary); }

/* Content */
.content {
    padding: 2rem 1.25rem;
    min-height: 60vh;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
}

.alert-error ul { margin: 0; padding-left: 1.25rem; }

/* Page heading */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 { margin: 0; font-size: 1.6rem; }

/* Filters */
.filters {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.filters button {
    padding: 0.5rem 1.25rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Listing grid */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.listing-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s, transform 0.15s;
}

.listing-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.listing-card .thumb {
    width: 100%;
    height: 160px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.85rem;
    overflow: hidden;
}

.listing-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-card .card-body {
    padding: 0.85rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.listing-card .price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.05rem;
}

.listing-card .title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

.listing-card .meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #eff6ff;
    color: var(--primary);
    align-self: flex-start;
}

.badge-sold { background: #fef2f2; color: var(--error); }
.badge-expired { background: #f3f4f6; color: var(--muted); }

/* Forms */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 640px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Show page */
.listing-detail {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

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

.listing-detail .main-image {
    width: 100%;
    border-radius: 8px;
    background: #f3f4f6;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--muted);
}

.listing-detail .main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.gallery img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.sidebar-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.sidebar-card h3 {
    margin-top: 0;
    font-size: 1rem;
}

.detail-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.detail-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.category-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
}

.category-card .icon { font-size: 2rem; }
.category-card .name { font-weight: 600; margin-top: 0.5rem; }
.category-card .count { color: var(--muted); font-size: 0.85rem; }

/* Pagination */
.pagination {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
}

.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Auth */
.auth-card {
    max-width: 420px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.auth-card h1 { margin-top: 0; font-size: 1.4rem; }

.auth-links {
    margin-top: 1rem;
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}
