* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    color: #1e293b;
}

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0.85rem 5%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a {
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 7px 14px;
    border-radius: 8px;
    transition: background 0.18s, color 0.18s;
}

.nav-links a:hover {
    background: #f3f4f6;
    color: #6366f1;
}

/* Logged-in nav buttons */
.btn-nav-chat {
    background: linear-gradient(135deg, #43e6b0, #6fffcf) !important;
    color: #065f46 !important;
    box-shadow: 0 2px 8px rgba(67,230,176,0.2);
}

.btn-nav-chat:hover {
    filter: brightness(1.08);
    background: linear-gradient(135deg, #43e6b0, #6fffcf) !important;
}

.btn-reg {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.btn-reg:hover {
    filter: brightness(1.1);
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
}

/* Logged-out nav buttons */
.btn-nav-login {
    border: 1px solid #d1d5db !important;
    color: #374151 !important;
}

.btn-nav-login:hover {
    border-color: #6366f1 !important;
    color: #6366f1 !important;
    background: #eef2ff !important;
}

/* ── Search & Filter Header ──────────────────────────────────────── */
.search-container {
    max-width: 1100px;
    margin: 28px auto 20px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#searchInput {
    width: 100%;
    padding: 13px 18px;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #1e293b;
}

#searchInput:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Main filter row (category, location, date) ──────────────────── */
.filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: center;
}

.filters input,
.filters select {
    padding: 10px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    color: #374151;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Status filter row ───────────────────────────────────────────── */
.filter-row-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    white-space: nowrap;
}

.status-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.status-filter-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 5px 13px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.18s, background 0.18s;
}

.status-filter-item:hover {
    border-color: #a5b4fc;
    background: #eef2ff;
    color: #4f46e5;
}

.status-filter-item input {
    width: 15px;
    height: 15px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* ── Item Grid ───────────────────────────────────────────────────── */
.item-grid {
    max-width: 1100px;
    margin: 0 auto 40px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ── Item Card ───────────────────────────────────────────────────── */
.item-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.07);
    transition: transform 0.2s ease, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border: 1.5px solid #f1f5f9;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(99,102,241,0.14);
    border-color: #c7d2fe;
}

.item-card-img {
    height: 180px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
}

.item-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

.card-status-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
}

.card-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.card-info h3 {
    font-size: 1rem;
    color: #1a1a2e;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #6366f1;
    background: #eef2ff;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.04em;
}

.card-meta {
    font-size: 0.82rem;
    color: #64748b;
}

.card-location {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.posted-by {
    font-size: 0.78rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding-top: 7px;
    margin-top: auto;
}

.posted-at {
    font-size: 0.76rem;
    color: #94a3b8;
}

/* ── Status Pills ────────────────────────────────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

/* On image overlay — semi-transparent bg */
.card-status-overlay .status-pill {
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.sp-available     { background: rgba(220,252,231,0.95); color: #166534; border: 1px solid #4ade80; }
.sp-lost          { background: rgba(219,234,254,0.95); color: #1e40af; border: 1px solid #93c5fd; }
.sp-owner-confirm { background: rgba(237,233,254,0.95); color: #5b21b6; border: 1px solid #c4b5fd; }
.sp-resolved      { background: rgba(220,252,231,0.95); color: #14532d; border: 1px solid #4ade80; }
.sp-abandoned     { background: rgba(254,243,199,0.92); color: #92400e; border: 1px solid #fbbf24; }
.sp-claimed       { background: rgba(237,233,254,0.95); color: #4c1d95; border: 1px solid #a78bfa; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .filters { grid-template-columns: 1fr; }
    .navbar  { padding: 0.75rem 4%; }
}

/* ── Date field label wrappers ───────────────────────────────────── */
.date-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.date-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6366f1;
    padding-left: 2px;
}

.date-field input {
    width: 100%;
}