/* DropSwap — minimal clean CSS */
:root {
    --bg: #F9F7F4;
    --surface: #FFFFFF;
    --primary: #2D6A4F;
    --primary-dark: #1B4332;
    --accent: #E9A84C;
    --text: #2B2B2B;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --danger: #DC2626;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-user {
    font-size: .8rem;
    font-weight: 600;
    color: var(--surface);
    background: var(--primary);
    padding: .2rem .65rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Grid */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
@media (max-width: 768px) { .listing-grid { grid-template-columns: 1fr; } }
@media (min-width: 769px) and (max-width: 1024px) { .listing-grid { grid-template-columns: repeat(2, 1fr); } }

/* Listing card */
.listing-card { display: flex; flex-direction: column; }
.listing-card .card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    width: calc(100% + 2.5rem);
}
.listing-card .badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: .7rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .5rem;
    width: fit-content;
}
.listing-card h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.listing-card .meta { font-size: .8rem; color: var(--text-muted); }
.listing-card .looking-for {
    font-size: .8rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: auto;
    padding-top: .75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d4952e; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    background: var(--surface);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* Auth pages */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
}
.auth-container h1 { text-align: center; margin-bottom: 1.5rem; }

/* Detail page */
.detail-header { margin-bottom: 1.5rem; }
.detail-header h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.detail-meta { color: var(--text-muted); font-size: .85rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.detail-body { line-height: 1.7; margin-bottom: 1.5rem; }
.detail-img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

/* Dashboard */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border); }
.tab {
    padding: .6rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Exchange request cards */
.exchange-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: .75rem;
}
.exchange-card .status {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
}
.status-pending { background: #FEF3C7; color: #92400E; }
.status-accepted { background: #D1FAE5; color: #065F46; }
.status-declined { background: #FEE2E2; color: #991B1B; }
.status-completed { background: #DBEAFE; color: #1E40AF; }
.status-cancelled { background: #F3F4F6; color: #6B7280; }

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px - 4rem);
    max-width: 720px;
    margin: 0 auto;
}
.chat-header {
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.chat-msg {
    max-width: 75%;
    padding: .55rem .85rem;
    border-radius: var(--radius);
    font-size: .9rem;
    line-height: 1.5;
}
.chat-msg.mine { align-self: flex-end; background: var(--primary); color: #fff; }
.chat-msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.chat-msg .msg-sender { font-size: .72rem; font-weight: 700; margin-bottom: .15rem; opacity: .85; }
.chat-msg.theirs .msg-sender { color: var(--primary); }
.chat-msg.mine .msg-sender { color: rgba(255,255,255,.8); }
.chat-msg .msg-meta { font-size: .7rem; opacity: .7; margin-top: .2rem; }
.chat-input-bar {
    display: flex;
    gap: .5rem;
    padding: .75rem 0;
    border-top: 1px solid var(--border);
}
.chat-input-bar input {
    flex: 1;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
}
.chat-input-bar input:focus { outline: none; border-color: var(--primary); }
.reconnect-banner {
    background: var(--accent);
    color: #fff;
    text-align: center;
    padding: .35rem;
    font-size: .8rem;
    font-weight: 600;
    display: none;
}
.reconnect-banner.visible { display: block; }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input, .filter-bar select {
    padding: .45rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .85rem;
}

/* Alert */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-error { background: #FEE2E2; color: #991B1B; }
.alert-success { background: #D1FAE5; color: #065F46; }

/* Section titles */
.section-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }

/* Empty state */
.empty { text-align: center; padding: 2rem; color: var(--text-muted); }

/* Proposal section */
.proposal-section {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.proposal-section h3 { color: var(--primary); margin-bottom: .75rem; }

/* Chat list (Your Chats page) */
.chat-list { display: flex; flex-direction: column; gap: .5rem; max-width: 720px; }
.chat-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s, border-color .15s;
}
.chat-list-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(45,106,79,.1);
    text-decoration: none;
}
.chat-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.chat-list-body { flex: 1; min-width: 0; }
.chat-list-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .2rem; }
.chat-list-name { font-weight: 600; font-size: .95rem; }
.chat-list-time { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.chat-list-preview {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-list-badge {
    background: var(--accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .4rem;
    flex-shrink: 0;
}
