/* ── Garden Swap — Style ────────────────────────────────────── */

:root {
    --green-dark: #1b4332;
    --green-mid: #2d6a4f;
    --green-light: #40916c;
    --green-pale: #95d5b2;
    --green-faint: #d8f3dc;
    --blue-tag: #0077b6;
    --blue-light: #caf0f8;
    --orange-warn: #e76f51;
    --bg: #f8faf8;
    --card-bg: #ffffff;
    --text: #1b1b1b;
    --text-muted: #6c757d;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ── Top Bar ───────────────────────────────────────────────── */

#topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--fern-600);
    color: white;
}

.topbar-left .logo {
    font-size: 1.2rem;
    white-space: nowrap;
    font-size: 1.2rem;
    white-space: nowrap;
    
    /* Try adding any of these: */
    font-weight: 700;           /* Make it bold */
    letter-spacing: 0.5px;      /* Spread letters apart */
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);  /* Add shadow */
    color: white;               /* Change text color */
}

.topbar-center {
    flex: 1;
}

#search-input {
    width: 100%;
    padding: 8px 14px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.15);
    color: white;
}

#search-input::placeholder { color: rgba(255,255,255,0.6); }
#search-input:focus { outline: none; background: rgba(255,255,255,0.25); }

.topbar-right {
    display: flex;
    gap: 8px;
}

.topbar-right button {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
}

.topbar-right button:hover { background: rgba(255,255,255,0.1); }

/* ── Navigation ────────────────────────────────────────────── */

#main-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 8px 0;
}

.nav-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.nav-btn.active {
    color: var(--green-mid);
    font-weight: 600;
}

/* ── Feed Status & Filters ─────────────────────────────────── */

.feed-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filter-bar {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
    flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.8rem;
    background: white;
}

.filter-bar button {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

#filter-apply {
    background: var(--green-mid);
    color: white;
}

#filter-clear {
    background: #eee;
    color: #666;
}

/* ── Plant Grid ────────────────────────────────────────────── */

.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 0 16px 16px;
}

.plant-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.plant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.plant-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.plant-card-info {
    padding: 12px 14px;
}

.plant-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.plant-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-swap {
    background: var(--green-faint);
    color: var(--green-dark);
}

.badge-free {
    background: var(--blue-light);
    color: var(--blue-tag);
}

.badge-type {
    background: #f0f0f0;
    color: #555;
}

.badge-condition {
    background: #fff3cd;
    color: #856404;
}

.plant-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.plant-card-distance {
    font-weight: 500;
}

.plant-card-rating {
    color: #f0ad4e;
}

/* ── Detail Modal ──────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    padding: 16px;
}

.modal.hidden { display: none; }

.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(0,0,0,0.5);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
}

.detail-content img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.detail-info {
    padding: 16px 20px 20px;
}

.detail-info h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.detail-desc {
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 12px;
}

.detail-meta, .detail-distance {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

/* ── Auth Modal ────────────────────────────────────────────── */

.auth-content {
    padding: 24px;
}

.auth-content h2 {
    margin-bottom: 16px;
    text-align: center;
}

.auth-content form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-content input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.auth-content input:focus {
    outline: none;
    border-color: var(--green-light);
}

.auth-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--green-mid);
    text-decoration: none;
    font-weight: 600;
}

/* ── New Listing Form ──────────────────────────────────────── */

.listing-form-content {
    padding: 24px;
}

.listing-form-content h2 {
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-light);
}

.radio-group {
    display: flex;
    gap: 20px;
    padding: 8px 0;
}

.radio-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.image-preview {
    margin-top: 8px;
}

.image-preview img {
    max-height: 120px;
    border-radius: 8px;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
    background: var(--green-mid);
    color: white;
}

.btn-danger {
    background: var(--orange-warn);
    color: white;
}

.btn-full {
    width: 100%;
}

/* ── FAB ───────────────────────────────────────────────────── */

.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--green-mid);
    color: white;
    font-size: 2rem;
    border: none;
    box-shadow: 0 4px 12px rgba(45,106,79,0.4);
    cursor: pointer;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    background: var(--green-dark);
    transform: scale(1.05);
}

.fab.hidden { display: none; }

/* ── Profile View ──────────────────────────────────────────── */

#profile-view {
    padding: 16px;
}

.profile-header {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.profile-header h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

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

.profile-listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

/* ── Empty State ───────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-state p:first-child {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.hidden { display: none !important; }

/* ── Chats View ────────────────────────────────────────────── */

#chats-view {
    padding: 16px;
}

.chats-header h2 {
    margin-bottom: 12px;
}

.chat-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}

.chat-card:hover { transform: translateY(-1px); }

.chat-card img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
}

.chat-card-info {
    flex: 1;
    min-width: 0;
}

.chat-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.chat-card-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-card-state {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.state-pending { background: #fff3cd; color: #856404; }
.state-accepted { background: var(--green-faint); color: var(--green-dark); }
.state-completed { background: #d4edda; color: #155724; }
.state-declined { background: #f8d7da; color: #721c24; }

/* ── Chat Modal ────────────────────────────────────────────── */

.chat-content {
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 600px;
    padding: 0;
}

.chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.msg-mine {
    align-self: flex-end;
    background: var(--green-pale);
    color: var(--green-dark);
}

.msg-theirs {
    align-self: flex-start;
    background: #f0f0f0;
    color: var(--text);
}

.msg-system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.msg-sender {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.chat-actions {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

.chat-actions:empty {
    display: none;
    padding: 0;
    border: none;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid #eee;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
}

.chat-input-area input:focus { outline: none; border-color: var(--green-light); }

.chat-input-area .btn { padding: 10px 16px; border-radius: 20px; }

/* ── Swap Request ──────────────────────────────────────────── */

.swap-request-plant {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 14px;
}

.swap-request-plant img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}

/* ── Star Rating ───────────────────────────────────────────── */

.star-rating {
    display: flex;
    gap: 4px;
}

.star-rating button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.1s;
}

.star-rating button.active { opacity: 1; }

/* ── Tier Badges ───────────────────────────────────────────── */

.tier-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.tier-badge-sprout { background: var(--green-faint); color: var(--green-dark); }
.tier-badge-grower { background: #d4edda; color: #155724; }
.tier-badge-steward { background: #cce5ff; color: #004085; }

.profile-tier-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.badge-rarity {
    background: #f3e8ff;
    color: #6b21a8;
}

/* ── Advanced Filter Bar ───────────────────────────────────── */

.advanced-filter-bar {
    padding: 0 16px 12px;
}

.advanced-locked {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #78350f;
}

#advanced-filter-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#advanced-filter-controls select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.8rem;
    background: white;
}

/* ── Ad Banner ─────────────────────────────────────────────── */

.ad-banner {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 1px solid #fde047;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.1s;
}

.ad-banner:hover { transform: translateY(-1px); }

.ad-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #a16207;
    white-space: nowrap;
}

.ad-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.88rem;
}

.ad-body strong { color: var(--green-dark); }
.ad-body span { color: var(--text-muted); font-size: 0.8rem; }

.ad-upgrade-btn {
    padding: 6px 14px;
    background: var(--green-mid);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Notification Bell ─────────────────────────────────────── */

#notif-btn {
    position: relative;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* ── Notifications View ────────────────────────────────────── */

#notifications-view {
    padding: 16px;
}

.notif-card {
    padding: 14px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.1s;
    border-left: 3px solid transparent;
}

.notif-card:hover { transform: translateY(-1px); }

.notif-unread {
    border-left-color: var(--green-mid);
    background: #f0fdf4;
}

.notif-body {
    font-size: 0.9rem;
    margin-bottom: 4px;
    line-height: 1.4;
}

.notif-time {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.notif-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.notif-main {
    flex: 1;
    cursor: pointer;
}

.notif-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
}

.notif-delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.btn-text-danger {
    color: #dc2626;
}

/* ── Paywall Modal ─────────────────────────────────────────── */

.paywall-content {
    padding: 28px 24px 24px;
    max-width: 700px;
}

.paywall-header {
    text-align: center;
    margin-bottom: 20px;
}

.paywall-header h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.paywall-reason {
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 18px;
}

.tier-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.tier-card {
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.tier-featured {
    border-color: var(--green-mid);
    background: #f0fdf4;
}

.tier-badge-pop {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green-mid);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.tier-name {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.tier-price {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--green-dark);
    line-height: 1;
}

.tier-price span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.tier-features {
    list-style: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    margin-bottom: 10px;
}

.tier-no { color: var(--text-muted); }

.tier-card .btn {
    padding: 10px;
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
}

.btn-steward {
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-steward:hover { opacity: 0.9; }

.btn-outline {
    background: white;
    color: var(--text-muted);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: default;
}

.tier-coming-soon {
    opacity: 0.55;
    pointer-events: none;
}

.btn-coming-soon {
    width: 100%;
    padding: 10px;
    background: #e5e7eb;
    color: #9ca3af;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: not-allowed;
}

.paywall-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Inline upgrade / small buttons ───────────────────────── */

.btn-upgrade-inline {
    padding: 4px 12px;
    background: var(--green-mid);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-outline-small {
    padding: 4px 12px;
    background: white;
    color: var(--text-muted);
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
}

.btn-text {
    background: none;
    border: none;
    color: var(--green-mid);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ── Profile sections ──────────────────────────────────────── */

.profile-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 14px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.empty-inline {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 8px 0;
}

/* ── Wish List ─────────────────────────────────────────────── */

.wish-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.wish-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--green-faint);
    border-radius: 8px;
    font-size: 0.88rem;
}

.wish-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 4px;
}

.wish-delete-btn:hover { color: var(--orange-warn); }

.add-wish-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.add-wish-form input {
    flex: 1;
    min-width: 140px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* ── Detail attributes line ────────────────────────────────── */

.detail-attrs {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* ── Label optional ────────────────────────────────────────── */

.label-optional {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Chat card layout fix ──────────────────────────────────── */

.chat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 2px;
}

.chat-card-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-card-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-content {
    flex: 1;
    min-width: 0;
}

.badge-state-pending  { background: #fff3cd; color: #856404; }
.badge-state-accepted { background: var(--green-faint); color: var(--green-dark); }
.badge-state-completed { background: #d4edda; color: #155724; }
.badge-state-declined  { background: #f8d7da; color: #721c24; }

/* ── Message bubbles ───────────────────────────────────────── */

.msg-bubble.mine { align-self: flex-end; background: var(--green-pale); color: var(--green-dark); }
.msg-bubble.theirs { align-self: flex-start; background: #f0f0f0; color: var(--text); }
.msg-bubble.system { align-self: center; background: transparent; color: var(--text-muted); font-size: 0.8rem; font-style: italic; }

.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.text-muted { color: var(--text-muted); font-size: 0.88rem; padding: 4px 0; }

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 600px) {
    .plant-grid {
        grid-template-columns: 1fr;
    }

    #topbar {
        flex-wrap: wrap;
    }

    .topbar-center {
        order: 3;
        flex-basis: 100%;
        margin-top: 8px;
    }

    .tier-cards {
        grid-template-columns: 1fr;
    }

    .paywall-content {
        padding: 20px 16px;
    }
}

/* ── Stage 4: Shop ────────────────────────────────────────────────── */

/* Category bar */
.shop-category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px 4px;
    scrollbar-width: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.shop-category-bar::-webkit-scrollbar { display: none; }

.cat-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s;
}
.cat-btn.active, .cat-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Shop toolbar */
.shop-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface);
}
.shop-toolbar input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}
.shop-toolbar input:focus { outline: none; border-color: var(--primary); }

.btn-vendor-cta {
    padding: 8px 14px;
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.btn-vendor-cta:hover { background: var(--primary); color: white; }

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 12px 16px;
}

.product-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.product-card-img-wrap {
    position: relative;
    height: 140px;
    background: #eef6ee;
    overflow: hidden;
}
.product-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-cat-chip {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255,255,255,0.9);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}
.product-card-body {
    padding: 10px 12px;
}
.product-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}
.product-card-shop {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.product-price-tag {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}
.stock-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}
.stock-ok { background: #d4edda; color: #155724; }
.stock-low { background: #fff3cd; color: #856404; }

/* Product detail modal extras */
.product-category-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: #e8f5e9;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}
.product-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.product-price-big {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}
.product-stock-badge {
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 500;
}
.product-vendor-tag {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.product-qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.product-qty-row label { font-size: 0.9rem; font-weight: 500; }
.product-qty-row input {
    width: 56px;
    text-align: center;
    padding: 6px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
}
.product-qty-row button:not(.btn) {
    width: 30px;
    height: 30px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* Cart button badge */
.cart-badge {
    background: #e63946;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    padding: 1px 4px;
    margin-left: 2px;
    vertical-align: super;
}

/* Cart drawer */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 200;
}
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 100vw;
    height: 100vh;
    background: var(--surface);
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
    z-index: 201;
    display: flex;
    flex-direction: column;
}
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.cart-drawer-header h3 { margin: 0; font-size: 1rem; }
.cart-close-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
}
.cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.cart-empty-msg {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    padding: 20px;
}
.cart-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.cart-item-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    background: #eef6ee;
    flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-shop { font-size: 0.75rem; color: var(--text-muted); }
.cart-item-price { font-size: 0.8rem; color: var(--primary); font-weight: 500; margin-top: 2px; }
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.cart-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.9rem;
}
.cart-remove-btn {
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px;
    margin-left: 2px;
}
.cart-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}
.cart-total-row {
    font-size: 0.95rem;
    margin-bottom: 10px;
    text-align: right;
}
.steward-discount {
    font-size: 0.8rem;
    color: var(--primary);
    text-align: right;
    margin-bottom: 6px;
}

/* Checkout modal */
.checkout-summary {
    background: #f8fdf8;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 0.82rem;
}
.checkout-items { color: #555; line-height: 1.8; margin-bottom: 6px; }
.checkout-total { font-weight: 700; font-size: 0.95rem; color: var(--primary); }

/* Vendor portal */
.vendor-content {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}
.vendor-register-panel {
    padding: 24px;
    text-align: center;
}
.vendor-register-panel h2 { margin-bottom: 12px; }
.vendor-register-panel form { text-align: left; margin-top: 20px; }

.vendor-dashboard { padding: 16px; }
.vendor-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 12px;
}
.vendor-dash-header h2 { margin: 0 0 4px; }
.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}
.vendor-section { margin-bottom: 24px; }
.vendor-section h3 { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.vendor-products-list { display: flex; flex-direction: column; gap: 8px; }
.vendor-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fdf8;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.product-inactive { opacity: 0.5; }
.vendor-product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #eef6ee;
    flex-shrink: 0;
}
.vendor-product-info { flex: 1; font-size: 0.85rem; line-height: 1.5; }

.vendor-orders-list { display: flex; flex-direction: column; gap: 10px; }
.vendor-order-row {
    padding: 12px;
    background: #f8fdf8;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Admin panel (profile page, admin only) */
.admin-section {
    border-top: 2px dashed var(--border);
    padding-top: 16px;
    margin-top: 8px;
}
.admin-vendor-list { display: flex; flex-direction: column; gap: 10px; }
.admin-vendor-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #fff9f0;
    border: 1px solid #ffe0b2;
    border-radius: 8px;
}
.admin-vendor-info { flex: 1; font-size: 0.85rem; line-height: 1.6; }
.admin-vendor-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.admin-vendor-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.btn-danger {
    background: #e63946;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-danger:hover { background: #c1121f; }

/* Mobile overrides for shop */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 10px;
    }
    .cart-drawer { width: 100vw; }
    .vendor-content { max-width: 100vw; }
    .vendor-dash-header { flex-direction: column; }
}
