/* ===================================================================
   TrocFrance — Stylesheet
   Warm, community-oriented barter site for France
   =================================================================== */

/* --- Variables --- */
:root {
    --green-dark:    #2d6a4f;
    --green-mid:     #40916c;
    --green-light:   #d8f3dc;
    --green-hover:   #357a5b;
    --orange-warm:   #e76f51;
    --orange-dark:   #c2410c;
    --orange-light:  #fce4d6;
    --earth-brown:   #6b4226;
    --sand:          #faf3e0;
    --cream:         #fefcf3;
    --gray-50:       #fafaf8;
    --gray-100:      #f3f2ef;
    --gray-200:      #e5e2db;
    --gray-300:      #ccc7bd;
    --gray-400:      #9c9689;
    --gray-500:      #7a756b;
    --gray-600:      #5c564c;
    --gray-700:      #3d3830;
    --gray-900:      #1c1917;
    --white:         #ffffff;
    --success:       #16a34a;
    --success-light: #dcfce7;
    --error:         #dc2626;
    --error-light:   #fee2e2;
    --warning:       #ca8a04;
    --warning-light: #fef9c3;
    --info:          #2563eb;
    --info-light:    #dbeafe;
    --radius:        8px;
    --radius-lg:     12px;
    --radius-xl:     16px;
    --shadow:        0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:     0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:     0 8px 24px rgba(0,0,0,.1);
    --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --max-width:     1140px;
    --nav-height:    56px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--sand);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--green-mid); text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* --- Screen Reader Only --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.sr-only--focusable:focus { position: static; width: auto; height: auto; overflow: visible; clip: auto; }

/* --- Site Header / Nav --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--green-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.nav-bar {
    display: flex;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    height: var(--nav-height);
    gap: .5rem;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white) !important;
    text-decoration: none !important;
    white-space: nowrap;
}
.nav-logo-icon { font-size: 1.3rem; }
.nav-public {
    display: flex;
    gap: .25rem;
    margin-left: 1.5rem;
}
.nav-public a, .nav-links a {
    color: rgba(255,255,255,.85);
    padding: .4rem .7rem;
    border-radius: var(--radius);
    font-size: .8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-public a:hover, .nav-links a:hover {
    color: var(--white);
    background: rgba(255,255,255,.12);
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: auto;
}
.nav-user {
    color: rgba(255,255,255,.7);
    font-size: .75rem;
    padding: 0 .4rem;
}
.nav-btn-signup {
    background: var(--orange-warm) !important;
    color: var(--white) !important;
    font-weight: 600 !important;
    padding: .4rem .9rem !important;
    border-radius: var(--radius) !important;
}
.nav-btn-signup:hover {
    background: var(--orange-dark) !important;
}
.nav-logout { opacity: .7; }
.nav-logout:hover { opacity: 1; }
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--orange-warm);
    color: var(--white);
    font-size: .65rem;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 6px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
}
.nav-hamburger span {
    display: block;
    height: 2px;
    background: var(--white);
    border-radius: 1px;
    transition: transform .2s, opacity .2s;
}
.nav-mobile-only { display: none !important; }

/* --- Mobile Nav --- */
@media (max-width: 720px) {
    .nav-public { display: none; }
    .nav-hamburger { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--green-dark);
        padding: .5rem;
        box-shadow: var(--shadow-md);
        border-top: 1px solid rgba(255,255,255,.1);
    }
    .nav-bar.nav-open .nav-links { display: flex; }
    .nav-mobile-only { display: flex !important; }
    .nav-links a { padding: .7rem 1rem; font-size: .875rem; }
    .nav-user { padding: .5rem 1rem; font-size: .8rem; }
    .nav-bar.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-bar.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; }
    .nav-bar.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* --- Main Content --- */
.main-content {
    min-height: calc(100vh - var(--nav-height) - 200px);
}

/* --- Flash Messages --- */
.flash {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}
.flash:empty { display: none; }
.flash--success, .flash--error, .flash--warning, .flash--info {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin: 1rem auto;
    font-size: .875rem;
    font-weight: 500;
    max-width: var(--max-width);
}
.flash--success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.flash--error   { background: var(--error-light);   color: #991b1b; border: 1px solid #fecaca; }
.flash--warning { background: var(--warning-light); color: #854d0e; border: 1px solid #fde68a; }
.flash--info    { background: var(--info-light);     color: #1e40af; border: 1px solid #bfdbfe; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary {
    background: var(--green-mid);
    color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); color: var(--white); }
.btn-warm {
    background: var(--orange-warm);
    color: var(--white);
}
.btn-warm:hover { background: var(--orange-dark); color: var(--white); }
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-outline {
    background: transparent;
    color: var(--green-mid);
    border: 1.5px solid var(--green-mid);
}
.btn-outline:hover { background: var(--green-light); color: var(--green-dark); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.6rem; font-size: 1rem; }
.btn-danger { background: var(--error); color: var(--white); }
.btn-danger:hover { background: #b91c1c; color: var(--white); }
.btn-block { width: 100%; }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    margin-bottom: .3rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--gray-700);
}
.form-label .required { color: var(--orange-warm); }
.form-control {
    width: 100%;
    padding: .55rem .75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: .9rem;
    background: var(--white);
    color: var(--gray-900);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(64,145,108,.15);
}
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint {
    font-size: .75rem;
    color: var(--gray-500);
    margin-top: .2rem;
}
.form-error {
    font-size: .75rem;
    color: var(--error);
    margin-top: .2rem;
}
.form-errors {
    background: var(--error-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    color: #991b1b;
    font-size: .85rem;
}
.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group { flex: 1; }
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    cursor: pointer;
    padding: .2rem 0;
}
.checkbox-label input, .radio-label input { accent-color: var(--green-mid); }

/* --- Cards --- */
.card {
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-photo {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--gray-100);
}
.card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
    font-size: 2.5rem;
}
.card-body { padding: .75rem; }
.card-title {
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: .3rem;
    color: var(--gray-900);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--green-mid); text-decoration: none; }
.card-meta {
    font-size: .75rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
}
.card-location { font-size: .75rem; color: var(--gray-500); }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* --- Type Badges --- */
.type-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.type-badge--offre {
    background: var(--green-light);
    color: var(--green-dark);
}
.type-badge--demande {
    background: var(--orange-light);
    color: var(--orange-dark);
}

/* --- Category Badges --- */
.cat-badge {
    display: inline-block;
    padding: .1rem .4rem;
    border-radius: 4px;
    font-size: .7rem;
    color: var(--gray-600);
    background: var(--gray-100);
}

/* --- Avatars --- */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar--sm { width: 32px; height: 32px; font-size: .7rem; }
.avatar--md { width: 44px; height: 44px; font-size: .85rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.1rem; }
.avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 700;
}

/* --- Rating Stars --- */
.rating { display: inline-flex; align-items: center; gap: .2rem; }
.rating-stars { color: #f59e0b; font-size: .85rem; letter-spacing: 1px; }
.rating-count { font-size: .75rem; color: var(--gray-500); }
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .7rem;
    color: var(--green-dark);
    background: var(--green-light);
    padding: .1rem .4rem;
    border-radius: 4px;
    font-weight: 600;
}

/* ===================================================================
   HOMEPAGE
   =================================================================== */

.home-hero {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
    color: var(--white);
    padding: 3rem 1rem;
}
.home-hero-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}
.home-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: .5rem;
    line-height: 1.15;
}
.home-hero-lead {
    font-size: 1.1rem;
    opacity: .9;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.home-location-bar {
    display: flex;
    gap: .5rem;
    max-width: 500px;
    margin: 0 auto 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.home-location-bar select {
    padding: .6rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: .9rem;
    min-width: 200px;
    background: var(--white);
    color: var(--gray-900);
}
.home-hero-buttons {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}
.home-hero-note {
    font-size: .8rem;
    opacity: .7;
    margin-top: 1rem;
}

/* Steps */
.home-section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1rem;
}
.home-section-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--gray-900);
}
.home-steps {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}
.home-step {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    text-align: center;
}
.home-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green-dark);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .75rem;
}
.home-step h3 { font-size: .95rem; margin-bottom: .3rem; }
.home-step p { font-size: .85rem; color: var(--gray-600); }

/* Categories grid */
.home-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
}
.home-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem .5rem;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: background .15s, border-color .15s;
    text-decoration: none !important;
    color: var(--gray-700);
}
.home-cat-card:hover {
    background: var(--green-light);
    border-color: var(--green-mid);
    color: var(--green-dark);
}
.home-cat-icon { font-size: 1.5rem; margin-bottom: .3rem; }
.home-cat-name { font-size: .8rem; font-weight: 600; }

/* Trust section */
.home-trust {
    background: var(--green-light);
    padding: 3rem 1rem;
}
.home-trust-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}
.home-trust-points {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}
.home-trust-point {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 500;
    color: var(--green-dark);
}
.home-trust-point::before {
    content: "\2713";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green-dark);
    color: var(--white);
    font-size: .7rem;
    flex-shrink: 0;
}

/* Featured listings */
.home-featured {
    background: var(--white);
    padding: 3rem 1rem;
}
.home-featured-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* ===================================================================
   BROWSE / SEARCH
   =================================================================== */

.browse-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.browse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.browse-count { font-size: .85rem; color: var(--gray-500); }
.browse-filters {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
}
.browse-filters select, .browse-filters input[type="text"] {
    padding: .45rem .7rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: .85rem;
    background: var(--white);
    min-width: 150px;
}
.browse-filters select:focus, .browse-filters input:focus {
    border-color: var(--green-mid);
    outline: none;
}
.type-toggle {
    display: flex;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}
.type-toggle label {
    padding: .4rem .8rem;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    border-right: 1px solid var(--gray-200);
}
.type-toggle label:last-child { border-right: none; }
.type-toggle input { display: none; }
.type-toggle input:checked + span {
    background: var(--green-mid);
    color: var(--white);
}
.type-toggle label:has(input:checked) {
    background: var(--green-mid);
    color: var(--white);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: .3rem;
    margin-top: 2rem;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .5rem;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 500;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    text-decoration: none;
}
.pagination a:hover { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); }
.pagination .active {
    background: var(--green-mid);
    color: var(--white);
    border-color: var(--green-mid);
}

/* ===================================================================
   LISTING DETAIL
   =================================================================== */

.listing-detail {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.listing-back {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .85rem;
    margin-bottom: 1rem;
    color: var(--gray-500);
}
.listing-back:hover { color: var(--green-mid); }
.listing-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 768px) {
    .listing-grid { grid-template-columns: 1fr; }
}
.listing-photos { border-radius: var(--radius-lg); overflow: hidden; }
.listing-main-photo {
    aspect-ratio: 4/3;
    background: var(--gray-100);
    overflow: hidden;
}
.listing-main-photo img { width: 100%; height: 100%; object-fit: cover; }
.listing-thumbs {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
}
.listing-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s;
}
.listing-thumb.active, .listing-thumb:hover { border-color: var(--green-mid); }
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-info { margin-top: 1rem; }
.listing-badges {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}
.listing-title { font-size: 1.35rem; margin-bottom: .3rem; }
.listing-meta {
    display: flex;
    gap: 1rem;
    font-size: .8rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.listing-description {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
    white-space: pre-line;
}
.listing-exchange {
    background: var(--orange-light);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}
.listing-exchange-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--orange-dark);
    margin-bottom: .2rem;
}

/* Poster card (sidebar) */
.poster-card {
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
}
.poster-card .avatar { margin: 0 auto .75rem; }
.poster-name { font-weight: 600; margin-bottom: .2rem; }
.poster-since { font-size: .75rem; color: var(--gray-500); margin-bottom: .5rem; }
.poster-stats { font-size: .8rem; color: var(--gray-600); margin-bottom: 1rem; }

/* ===================================================================
   REGISTRATION
   =================================================================== */

.reg-wrap {
    max-width: 520px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.reg-progress {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}
.reg-step {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--gray-400);
    padding: .5rem .75rem;
}
.reg-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: .75rem;
    font-weight: 700;
}
.reg-step--active .reg-step-num {
    background: var(--green-mid);
    color: var(--white);
}
.reg-step--active { color: var(--green-dark); font-weight: 600; }
.reg-step--done .reg-step-num {
    background: var(--green-light);
    color: var(--green-dark);
}
.reg-step-line {
    width: 40px;
    height: 2px;
    background: var(--gray-200);
    align-self: center;
}
.reg-card {
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.reg-title {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: .3rem;
}
.reg-lead {
    text-align: center;
    font-size: .9rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}
.reg-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
    margin-bottom: 1rem;
}
.reg-cat-checkbox {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .6rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .8rem;
    transition: border-color .15s, background .15s;
}
.reg-cat-checkbox:has(input:checked) {
    border-color: var(--green-mid);
    background: var(--green-light);
}
.reg-cat-checkbox input { accent-color: var(--green-mid); }

/* Login */
.login-wrap {
    max-width: 420px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ===================================================================
   DASHBOARD
   =================================================================== */

.dash-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.dash-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.dash-stat-card {
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    flex: 1;
    min-width: 160px;
    text-align: center;
}
.dash-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green-dark);
}
.dash-stat-label {
    font-size: .75rem;
    color: var(--gray-500);
    margin-top: .2rem;
}
.dash-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--gray-200);
}
.dash-listing-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .5rem;
}
.dash-listing-photo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-100);
}
.dash-listing-photo img { width: 100%; height: 100%; object-fit: cover; }
.dash-listing-info { flex: 1; min-width: 0; }
.dash-listing-title { font-weight: 600; font-size: .9rem; }
.dash-listing-meta { font-size: .75rem; color: var(--gray-500); }
.dash-listing-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ===================================================================
   CREATE / EDIT LISTING
   =================================================================== */

.create-wrap {
    max-width: 680px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.photo-dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--white);
    margin-bottom: 1rem;
}
.photo-dropzone:hover, .photo-dropzone.dragover {
    border-color: var(--green-mid);
    background: var(--green-light);
}
.photo-dropzone-text {
    font-size: .85rem;
    color: var(--gray-500);
}
.photo-dropzone-icon {
    font-size: 2rem;
    color: var(--gray-300);
    margin-bottom: .5rem;
}
.photo-preview-grid {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.photo-preview-item {
    position: relative;
    min-width: 100px;
    max-width: 150px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}
.photo-preview-item img { width: 100%; height: auto; object-fit: cover; }
.photo-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
}
.photo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
}
.photo-tag {
    font-size: .55rem;
    background: var(--green-light);
    color: var(--green-dark);
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.3;
}
.ai-suggested {
    border-color: var(--green-mid) !important;
    box-shadow: 0 0 0 2px rgba(64, 145, 108, .15);
}
.qr-panel {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
}
.qr-panel h3 { font-size: .9rem; margin-bottom: .5rem; }
.qr-panel p { font-size: .8rem; color: var(--gray-500); }
.qr-code-img { margin: .75rem auto; }

/* ===================================================================
   MESSAGES
   =================================================================== */

.msg-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.msg-list { }
.msg-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .5rem;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.msg-item:hover { background: var(--white); text-decoration: none; }
.msg-item.msg-unread {
    border-left: 3px solid var(--green-mid);
    background: var(--white);
}
.msg-info { flex: 1; min-width: 0; }
.msg-name { font-weight: 600; font-size: .9rem; }
.msg-listing { font-size: .75rem; color: var(--gray-500); }
.msg-preview {
    font-size: .8rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-time { font-size: .7rem; color: var(--gray-400); flex-shrink: 0; }
.msg-unread-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-mid);
    flex-shrink: 0;
}

/* Conversation */
.conv-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.conv-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}
.conv-header-info { flex: 1; }
.conv-header-name { font-weight: 600; }
.conv-header-listing { font-size: .8rem; color: var(--gray-500); }
.conv-back {
    display: inline-block;
    margin-bottom: .75rem;
    font-size: .85rem;
    color: var(--green-mid);
    text-decoration: none;
}
.conv-back:hover { text-decoration: underline; }
.conv-messages {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1rem;
    max-height: 60vh;
    min-height: 200px;
    overflow-y: auto;
    padding: .5rem;
    scroll-behavior: smooth;
}
@keyframes chat-slide-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.conv-bubble--new {
    animation: chat-slide-in .25s ease-out;
}
.conv-bubble {
    max-width: 75%;
    padding: .6rem .9rem;
    border-radius: var(--radius-lg);
    font-size: .875rem;
    line-height: 1.5;
    position: relative;
}
.conv-bubble--theirs {
    align-self: flex-start;
    background: var(--cream);
    border: 1px solid var(--gray-200);
}
.conv-bubble--mine {
    align-self: flex-end;
    background: var(--green-mid);
    color: var(--white);
}
.conv-bubble-time {
    font-size: .65rem;
    opacity: .6;
    margin-top: .2rem;
}
.conv-reply {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
}
.conv-reply textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
}

/* ===================================================================
   PROFILES
   =================================================================== */

.profile-wrap {
    max-width: 680px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.pub-profile {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.pub-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.pub-info h1 { margin-bottom: .2rem; }
.pub-meta { font-size: .85rem; color: var(--gray-500); }

/* ===================================================================
   EXCHANGES
   =================================================================== */

.echange-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.echange-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .5rem;
}
.echange-status {
    padding: .2rem .5rem;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 600;
}
.echange-status--propose { background: var(--warning-light); color: var(--warning); }
.echange-status--accepte { background: var(--info-light); color: var(--info); }
.echange-status--complete { background: var(--success-light); color: var(--success); }
.echange-status--annule { background: var(--gray-100); color: var(--gray-500); }

/* Rating form */
.rating-form { margin-top: 1rem; }
.star-input { display: flex; gap: .2rem; direction: rtl; justify-content: flex-end; }
.star-input input { display: none; }
.star-input label {
    font-size: 1.5rem;
    color: var(--gray-300);
    cursor: pointer;
    transition: color .15s;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
    color: #f59e0b;
}

/* ===================================================================
   QR UPLOAD (standalone mobile page)
   =================================================================== */

.qr-upload-page {
    min-height: 100vh;
    background: var(--sand);
    padding: 1rem;
}
.qr-upload-brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
}
.qr-upload-card {
    background: var(--cream);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}
.qr-camera-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: 1rem;
    background: var(--green-mid);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: .75rem;
}
.qr-camera-btn:hover { background: var(--green-dark); }

/* ===================================================================
   HOW IT WORKS
   =================================================================== */

.ccm-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.ccm-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.ccm-hero h1 { font-size: 1.6rem; }
.ccm-hero p { color: var(--gray-600); max-width: 600px; margin: 0 auto; }
.ccm-steps {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 3rem;
}
.ccm-step {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    text-align: center;
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.ccm-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 700;
    margin-bottom: .75rem;
}
.ccm-faq { margin-top: 2rem; }
.ccm-faq h2 { text-align: center; margin-bottom: 1rem; }
.ccm-faq-item {
    background: var(--cream);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .5rem;
    overflow: hidden;
}
.ccm-faq-q {
    padding: .75rem 1rem;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ccm-faq-q::after { content: "+"; font-size: 1.2rem; color: var(--gray-400); }
.ccm-faq-item--open .ccm-faq-q::after { content: "\2212"; }
.ccm-faq-a {
    display: none;
    padding: 0 1rem .75rem;
    font-size: .85rem;
    color: var(--gray-600);
    line-height: 1.6;
}
.ccm-faq-item--open .ccm-faq-a { display: block; }

/* ===================================================================
   LEGAL PAGES
   =================================================================== */

.legal-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.legal-wrap h1 { margin-bottom: 1.5rem; }
.legal-wrap h2 { font-size: 1rem; margin-top: 1.5rem; }
.legal-wrap p, .legal-wrap li { font-size: .9rem; color: var(--gray-700); line-height: 1.7; }
.legal-wrap ul { padding-left: 1.5rem; list-style: disc; }
.legal-wrap ul li { margin-bottom: .3rem; }

/* ===================================================================
   ADMIN (skeleton)
   =================================================================== */

.admin-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.admin-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.admin-table th, .admin-table td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
.admin-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: .75rem;
    text-transform: uppercase;
}
.admin-table tr:hover { background: var(--cream); }

/* ===================================================================
   EMPTY STATES
   =================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}
.empty-state-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; max-width: 400px; margin: 0 auto; }

/* ===================================================================
   404
   =================================================================== */

.not-found {
    text-align: center;
    padding: 4rem 1rem;
}
.not-found h1 { font-size: 4rem; color: var(--gray-300); margin-bottom: .5rem; }
.not-found p { color: var(--gray-500); margin-bottom: 1.5rem; }

/* ===================================================================
   FOOTER
   =================================================================== */

.site-footer {
    background: var(--green-dark);
    color: rgba(255,255,255,.8);
    padding: 2rem 1rem;
    margin-top: 3rem;
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}
.footer-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: .3rem;
}
.footer-logo-icon { font-size: 1.2rem; }
.footer-tagline {
    font-size: .8rem;
    opacity: .7;
    margin: .3rem 0 1rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.footer-links a {
    color: rgba(255,255,255,.7);
    font-size: .8rem;
    text-decoration: none;
}
.footer-links a:hover { color: var(--white); text-decoration: underline; }
.footer-copy {
    font-size: .7rem;
    opacity: .5;
    margin: 0;
}

/* ===================================================================
   UTILITIES
   =================================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }

/* ===================================================================
   RESPONSIVE
   =================================================================== */

/* ===================================================================
   MISSING CLASS DEFINITIONS
   =================================================================== */

/* Browse page — filter form */
.browse-filters-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.browse-filter-group { flex: 1; min-width: 150px; }
.browse-filter-group select { width: 100%; }
.input-search { width: 100%; padding: .45rem .7rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: .85rem; background: var(--white); }
.input-search:focus { border-color: var(--green-mid); outline: none; box-shadow: 0 0 0 3px rgba(64,145,108,.12); }
.browse-type-toggle { display: flex; border: 1.5px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: var(--white); margin: .75rem 0; }
.browse-type-option { padding: .4rem .8rem; font-size: .8rem; font-weight: 500; cursor: pointer; transition: background .15s, color .15s; border-right: 1px solid var(--gray-200); }
.browse-type-option:last-child { border-right: none; }
.browse-type-option:has(input:checked) { background: var(--green-mid); color: var(--white); }
.browse-type-option input { display: none; }
.browse-submit { margin-top: .5rem; }

/* Listing detail — badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-type-badge--offre, .badge-offre { background: var(--green-light); color: var(--green-dark); }
.badge-type-badge--demande, .badge-demande { background: var(--orange-light); color: var(--orange-dark); }
.badge-category { background: var(--gray-100); color: var(--gray-600); }
.badge-icon { font-size: .85rem; }

/* Listing detail — sidebar and gallery */
.listing-gallery { margin-bottom: 1rem; }
.listing-sidebar { position: sticky; top: calc(var(--nav-height) + 1rem); }
.poster-avatar { margin-bottom: .75rem; }
.poster-info { margin-bottom: .75rem; }
.poster-meta { font-size: .8rem; color: var(--gray-600); margin-bottom: 1rem; display: flex; flex-direction: column; gap: .2rem; }
.poster-actions { margin-bottom: .75rem; }
.poster-profile-link { display: block; font-size: .85rem; color: var(--green-mid); margin-top: .5rem; }
.poster-profile-link:hover { text-decoration: underline; }
.poster-rating { font-size: .85rem; margin-bottom: .5rem; }
.poster-listings { font-size: .75rem; color: var(--gray-500); }
.listing-similar { max-width: var(--max-width); margin: 0 auto; padding: 1.5rem 1rem; }

/* Conversation — header and reply */
.conv-header-username { font-weight: 600; font-size: .95rem; }
.conv-header-actions { flex-shrink: 0; }
.conv-reply-inner { display: flex; gap: .5rem; align-items: flex-end; flex: 1; }
.conv-reply-input { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: .55rem .75rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: .9rem; font-family: inherit; background: var(--white); }
.conv-reply-input:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(64,145,108,.12); }

/* Messages page */
.msg-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; }

/* Exchanges page */
.echanges-wrap { max-width: var(--max-width); margin: 0 auto; padding: 1.5rem 1rem; }
.echanges-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; }
.echanges-list { }

/* Create/Edit listing form */
.form-page-wrap { max-width: 680px; margin: 1.5rem auto; padding: 0 1rem; }
.form-page-card { background: var(--cream); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.form-page-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; }
.form-radio-group { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-radio { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; padding: .5rem .75rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); background: var(--white); transition: border-color .15s, background .15s; }
.form-radio:has(input:checked) { border-color: var(--green-mid); background: var(--green-light); }
.form-radio input { accent-color: var(--green-mid); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-separator { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }

/* Registration checkbox */
.form-checkbox { display: flex; align-items: flex-start; gap: .5rem; font-size: .875rem; cursor: pointer; padding: .2rem 0; }
.form-checkbox input { accent-color: var(--green-mid); margin-top: .25rem; flex-shrink: 0; }

/* Registration progress */
.reg-card--wide { }
.reg-done-icon { font-size: 3rem; margin-bottom: 1rem; }
.reg-done-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* Listing location in create form */
.listing-location-current { font-size: .85rem; color: var(--gray-600); margin-bottom: .5rem; }
.listing-location-change { font-size: .8rem; }

/* Ghost button for hero CTA */
.btn-ghost-light { background: rgba(255,255,255,.15); color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn-ghost-light:hover { background: rgba(255,255,255,.25); color: #fff; text-decoration: none; }

/* Focus-visible for accessibility */
.btn:focus-visible { outline: 2px solid var(--green-mid); outline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--green-mid); outline-offset: 2px; border-radius: 2px; }

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 600px) {
    .home-hero h1 { font-size: 1.6rem; }
    .home-hero-lead { font-size: .95rem; }
    .form-row { flex-direction: column; gap: 0; }
    .dash-stats { flex-direction: column; }
    .browse-filters-row { flex-direction: column; }
    .browse-filter-group { min-width: 100%; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .listing-description { max-width: 65ch; }
    .form-page-card { padding: 1rem; }
}

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

@media (hover: hover) {
    .card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
}

@media print {
    .site-header, .site-footer, .nav-hamburger { display: none; }
    body { background: white; }
}
