/* === NEK Market — Vermont Forest Theme === */

:root {
    --green-dark: #1a3a1a;
    --green-primary: #2d5016;
    --green-medium: #3d6b22;
    --green-light: #5a8a3c;
    --green-pale: #e8f0e0;
    --cream: #faf8f2;
    --brown: #5c4033;
    --brown-light: #8b6f47;
    --text: #2c2c2c;
    --text-muted: #6b6b6b;
    --border: #d4d0c8;
    --white: #ffffff;
    --red: #c0392b;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

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

main { flex: 1; }

/* === Header with forest silhouette === */

.site-header {
    background: var(--green-dark);
    position: relative;
    overflow: hidden;
}

.header-forest {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0,60 L0,35 L20,35 L35,10 L50,35 L65,15 L80,35 L95,20 L110,35 L130,35 L145,8 L160,35 L175,18 L190,35 L210,35 L225,5 L240,35 L255,22 L270,35 L290,35 L305,12 L320,35 L335,20 L350,35 L370,35 L385,8 L400,35 L415,25 L430,35 L450,35 L465,10 L480,35 L495,18 L510,35 L530,35 L545,5 L560,35 L575,22 L590,35 L610,35 L625,12 L640,35 L655,20 L670,35 L690,35 L705,8 L720,35 L735,25 L750,35 L770,35 L785,10 L800,35 L815,18 L830,35 L850,35 L865,5 L880,35 L895,22 L910,35 L930,35 L945,12 L960,35 L975,20 L990,35 L1010,35 L1025,8 L1040,35 L1055,25 L1070,35 L1090,35 L1105,10 L1120,35 L1135,18 L1150,35 L1170,35 L1185,12 L1200,35 L1200,60 Z' fill='%232d5016' opacity='0.5'/%3E%3Cpath d='M0,60 L0,40 L30,40 L45,18 L60,40 L80,40 L95,12 L110,40 L130,40 L150,20 L165,40 L185,40 L200,15 L215,40 L235,40 L250,10 L265,40 L285,40 L305,22 L320,40 L340,40 L355,14 L370,40 L390,40 L410,20 L425,40 L445,40 L460,12 L475,40 L495,40 L515,18 L530,40 L550,40 L565,10 L580,40 L600,40 L620,22 L635,40 L655,40 L670,14 L685,40 L705,40 L725,20 L740,40 L760,40 L775,12 L790,40 L810,40 L830,18 L845,40 L865,40 L880,10 L895,40 L915,40 L935,22 L950,40 L970,40 L985,14 L1000,40 L1020,40 L1040,20 L1055,40 L1075,40 L1090,12 L1105,40 L1125,40 L1145,18 L1160,40 L1180,40 L1200,15 L1200,60 Z' fill='%231a3a1a' opacity='0.3'/%3E%3C/svg%3E") repeat-x bottom;
    background-size: 600px 40px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--white);
}

.logo-icon { font-size: 2rem; }

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 0.8rem;
    opacity: 0.8;
    display: block;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.main-nav a:hover { opacity: 1; }

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* === Container === */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* === Buttons === */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--green-medium);
    border-color: var(--green-medium);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border-color: rgba(255,255,255,0.5);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--white);
}

.btn-full { width: 100%; text-align: center; }

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}

/* === Hero === */

.hero {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--green-pale), var(--white));
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.hero h2 {
    font-size: 1.8rem;
    color: var(--green-dark);
    margin-bottom: 8px;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* === Search Bar === */

.search-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.search-row .search-form {
    margin-bottom: 0;
}

.create-listing-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

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

.search-select { min-width: 160px; }

.search-zip { width: 100px; }

.search-form input,
.search-form select {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--white);
}

.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: var(--green-primary);
}

/* === Listings Grid === */

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

.listing-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.listing-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--green-pale);
}

.listing-card-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.listing-card-body {
    padding: 16px;
}

.listing-card-body h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: var(--text);
}

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

.listing-card-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.category-badge {
    display: inline-block;
    background: var(--green-pale);
    color: var(--green-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* === Listing Detail === */

.listing-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.listing-images img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.listing-info h2 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.listing-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green-primary);
}

.listing-meta {
    display: flex;
    gap: 12px;
    margin: 12px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    align-items: center;
}

.listing-description {
    margin: 20px 0;
    line-height: 1.7;
}

.listing-actions { margin-top: 24px; }
.listing-actions .btn-outline {
    color: var(--text-muted);
    border-color: var(--border);
}

.no-image {
    background: var(--green-pale);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-muted);
}

/* === Auth Forms === */

.auth-container {
    max-width: 400px;
    margin: 40px auto;
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-container h2 {
    margin-bottom: 24px;
    text-align: center;
    color: var(--green-dark);
}

.auth-form .form-group {
    margin-bottom: 16px;
}

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

.auth-switch a { color: var(--green-primary); }

/* === Forms === */

.form-container {
    max-width: 700px;
    margin: 20px auto;
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-container h2 {
    margin-bottom: 24px;
    color: var(--green-dark);
}

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
}

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

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-error {
    color: var(--red);
    font-size: 0.9rem;
    margin-bottom: 12px;
    min-height: 20px;
}

.image-preview {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* === About === */

.about-page {
    max-width: 700px;
    margin: 20px auto;
}

.about-page h2 {
    color: var(--green-dark);
    margin-bottom: 24px;
}

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

.about-section h3 {
    color: var(--green-primary);
    margin-bottom: 8px;
}

.about-section ul {
    padding-left: 20px;
}

.about-section li {
    margin-bottom: 4px;
}

/* === Admin === */

.admin-dashboard h2 {
    color: var(--green-dark);
    margin-bottom: 20px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green-primary);
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--green-primary);
    border-bottom-color: var(--green-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.admin-card {
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.admin-card-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--green-pale);
    color: var(--green-primary);
}

.badge-report { background: #fde8e8; color: var(--red); }
.badge-flagged { background: #fde8e8; color: var(--red); }
.badge-removed { background: #fde8e8; color: var(--red); }
.badge-active { background: var(--green-pale); color: var(--green-primary); }

/* === Business Directory === */

.business-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.business-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    gap: 16px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.business-card-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green-pale);
    border-radius: var(--radius);
}

.business-card-body h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: var(--text);
}

.business-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.business-card-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* === Business Detail === */

.business-profile {
    max-width: 700px;
    margin: 20px auto;
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.business-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.business-profile-header h2 {
    color: var(--green-dark);
    margin: 0;
}

.business-description {
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 20px;
}

.business-info-grid {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.business-info-grid p {
    margin-bottom: 8px;
}

.business-info-grid a {
    color: var(--green-primary);
}

.business-hours pre {
    font-family: inherit;
    margin-top: 4px;
    white-space: pre-line;
}

.business-since {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === ISO / Wanted Board === */

.iso-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.iso-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border-left: 4px solid var(--brown-light);
}

.iso-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.iso-card-header h3 {
    font-size: 1rem;
    margin: 0;
}

.iso-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.iso-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* === Trust Indicators === */

.seller-info-box {
    background: var(--green-pale);
    padding: 16px;
    border-radius: var(--radius);
    margin: 16px 0;
}

.seller-info-box strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.trust-badge {
    display: inline-block;
    background: var(--white);
    color: var(--green-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
    margin-top: 4px;
}

/* === Save Button === */

.save-btn {
    color: var(--green-primary) !important;
    border-color: var(--green-primary) !important;
}

.save-btn.saved {
    background: var(--green-primary) !important;
    color: var(--white) !important;
}

/* === My Listings === */

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-row h2 {
    color: var(--green-dark);
    margin: 0;
}

.listing-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.badge-sold { background: var(--brown); color: var(--white); }
.badge-expired { background: #f0e6d0; color: var(--brown); }
.badge-flagged { background: #fde8e8; color: var(--red); }

/* === Footer === */

.site-footer {
    background: var(--green-dark);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 24px 20px;
    font-size: 0.85rem;
    margin-top: 40px;
}

.site-footer a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

/* === Utilities === */

.loading, .error {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.error { color: var(--red); }

.text-center { text-align: center; margin: 20px 0; }

/* === Post Listing Button (floating) === */

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--green-primary);
    color: var(--white);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 100;
    text-decoration: none;
}

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

/* === Mobile === */

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-top: 12px;
        gap: 12px;
    }

    .main-nav.open { display: flex; }

    .mobile-menu-btn { display: block; }

    .logo-text h1 { font-size: 1.2rem; }

    .hero h2 { font-size: 1.3rem; }
    .hero p { font-size: 0.95rem; }

    .search-row {
        flex-direction: column;
    }

    .create-listing-btn {
        width: 100%;
        text-align: center;
    }

    .search-form {
        flex-direction: column;
    }

    .search-zip { width: 100%; }

    .listings-grid {
        grid-template-columns: 1fr;
    }

    .listing-detail {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .listing-header-row {
        flex-direction: column;
    }

    .business-grid {
        grid-template-columns: 1fr;
    }

    .iso-grid {
        grid-template-columns: 1fr;
    }

    .page-header-row {
        flex-direction: column;
        align-items: stretch;
    }
}
