@import url('https://fonts.googleapis.com/css2?family=Forum&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bark: #0F2A1D;
    --moss: #2D5A30;
    --leaf: #4A6B4F;
    --sage: #6A7C69;
    --paperh: #FAF8F2;
    --paper: #FFFFFF;
    --cream: #F5F1E8;
    --soil: #B56510;
    --amber: #C09464;
    --rust: #B83A1F;
    --ink: #142819;
    --white: #FFFFFF;
    --line: rgba(15, 42, 29, .12);
    --pad: max(16px, 1.05vw);
}

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

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    line-height: 1.45;
    background: var(--paperh);
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* HEADER */

.site-header {
    width: 100%;
    background: var(--paperh);
    border-bottom: 1px solid rgba(15, 42, 29, .18);
}

.header-inner {
    width: 100%;
    min-height: max(62px, 4.2vw);
    padding: max(8px, .55vw) var(--pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: max(14px, 1.5vw);
}

.logo-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.logo-header {
    width: max(170px, 10vw);
    max-width: none;
    object-fit: contain;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: max(22px, 3vw);
    flex-wrap: wrap;
}

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    white-space: nowrap;
}

.nav-link {
    color: var(--leaf);
    font-size: max(.82rem, .68vw);
    font-weight: 500;
    border-radius: 8px;
    padding: .7em 1em;
}

.nav-link:hover,
.nav-link.active {
    background: var(--cream);
    color: var(--bark);
}

/* Cache "Base connectée" */
.db-status {
    display: none;
}

/* BOUTON AUTH HEADER */

.btn-auth {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: .45em 1em;
    border-radius: 7px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: max(.78rem, .62vw);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
    border: 1.5px solid var(--moss);
    background: transparent;
    color: var(--moss);
    text-decoration: none;
}

.btn-auth:hover {
    background: var(--moss);
    color: var(--white);
}

/* PAGE */

.page-content {
    width: 100%;
    padding: max(42px, 4vw) var(--pad) max(68px, 5vw);
}

.page-hero {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: end;
    gap: max(24px, 4vw);
    padding-bottom: max(26px, 2.2vw);
    border-bottom: 1px solid var(--line);
}

.page-kicker {
    color: var(--leaf);
    font-family: 'JetBrains Mono', monospace;
    font-size: max(.72rem, .58vw);
    letter-spacing: .2em;
    margin-bottom: .9rem;
}

.page-hero h1 {
    max-width: none;
    color: var(--bark);
    font-family: 'Forum', Georgia, serif;
    font-size: max(2.5rem, 3vw);
    line-height: 1.05;
    font-weight: 400;
}

.page-hero p {
    max-width: 72ch;
    margin-top: 1rem;
    color: var(--leaf);
    font-size: max(.95rem, .82vw);
    line-height: 1.6;
}

.back-link {
    color: var(--moss);
    font-size: max(.82rem, .68vw);
    font-weight: 700;
    margin-bottom: .55rem;
}

/* NOTICE */

.notice {
    width: 100%;
    margin: max(26px, 2vw) 0;
    padding: 1rem 1.2rem;
    border-left: 3px solid var(--amber);
    border-radius: 8px;
    background: var(--cream);
    color: var(--ink);
    font-size: max(.82rem, .68vw);
}

/* FORMULAIRE */
.tree-form {
    width: 100%;
    padding: 20px 16px;
    border-radius: 10px;
}

.form-section {
    padding: max(18px, 1.6vw) 0;
    border-bottom: 1px solid var(--line);
}

.form-section:first-child {
    padding-top: 0;
}

.form-section h2 {
    color: var(--bark);
    font-family: 'Forum', Georgia, serif;
    font-size: max(1.35rem, 1.25vw);
    font-weight: 400;
}

.form-section p {
    max-width: 80ch;
    margin-top: .45rem;
    margin-bottom: 1.3rem;
    color: var(--leaf);
    font-size: max(.82rem, .68vw);
}

.field-grid {
    width: 100%;
    display: grid;
    gap: max(14px, 1.1vw);
}

.field-grid.two {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.field,
.field-grid > * {
    min-width: 0;
}

label {
    display: block;
    margin-bottom: .48rem;
    color: var(--leaf);
    font-family: 'JetBrains Mono', monospace;
    font-size: max(.67rem, .52vw);
    letter-spacing: .12em;
    overflow-wrap: anywhere;
}

input,
select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    border: 1px solid rgba(15, 42, 29, .22);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', Arial, sans-serif;
    font-size: max(.9rem, .72vw);
    padding: .78rem .9rem;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--moss);
    box-shadow: 0 0 0 3px rgba(45, 90, 48, .11);
}

small {
    display: block;
    margin-top: .45rem;
    color: var(--sage);
    font-size: max(.72rem, .58vw);
}

/* SWITCH */

.switch-row {
    width: 100%;
    margin-top: 1.4rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paperh);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-family: 'Inter', Arial, sans-serif;
    letter-spacing: 0;
    cursor: pointer;
}

.switch-row strong {
    display: block;
    color: var(--ink);
    font-size: max(.86rem, .68vw);
}

.switch-row small {
    color: var(--leaf);
}

.switch-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch {
    flex: 0 0 auto;
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--moss);
    position: relative;
}

.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--white);
    transition: transform .2s ease;
}

.switch-row input:not(:checked) + .switch {
    background: rgba(15, 42, 29, .22);
}

.switch-row input:not(:checked) + .switch::after {
    transform: translateX(-14px);
}

/* CARTE RÉELLE */

.real-map {
    width: 100%;
    height: max(300px, 34vw);
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid rgba(15, 42, 29, .16);
    border-radius: 10px;
    background: var(--cream);
    z-index: 1;
}

.leaflet-container {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}

.leaflet-control-attribution {
    font-size: .68rem;
}

/* ANCIENNE MAP SI TU L’AS ENCORE */

.map-preview {
    width: 100%;
    height: max(260px, 24vw);
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid rgba(15, 42, 29, .16);
    border-radius: 10px;
    background: var(--cream);
}

/* ACTIONS */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: max(20px, 1.7vw);
}

.btn {
    min-height: 40px;
    border-radius: 7px;
    border: 1px solid rgba(15, 42, 29, .18);
    padding: .75rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

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

.btn-secondary {
    background: var(--white);
    color: var(--ink);
}

/* FOOTER */

.site-footer {
    width: 100%;
    background: var(--bark);
    color: var(--white);
}

.footer-inner {
    width: 100%;
    padding: max(34px, 3.2vw) var(--pad);
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(420px, 1fr);
    gap: max(28px, 5vw);
}

.footer-logo {
    width: max(150px, 10vw);
    margin-bottom: 12px;
}

.footer-brand p {
    max-width: 34ch;
    color: rgba(255, 255, 255, .68);
    font-size: max(.85rem, .72vw);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    justify-content: end;
    gap: max(34px, 4vw);
}

.footer-column h3 {
    margin-bottom: .85rem;
    color: var(--amber);
    font-family: 'JetBrains Mono', monospace;
    font-size: max(.68rem, .52vw);
    letter-spacing: .18em;
}

.footer-column ul {
    list-style: none;
}

.footer-column li + li {
    margin-top: .52rem;
}

.footer-column a {
    color: rgba(255, 255, 255, .75);
    font-size: max(.82rem, .68vw);
}

.footer-bottom {
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding: 1rem var(--pad);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: rgba(255, 255, 255, .45);
    font-family: 'JetBrains Mono', monospace;
    font-size: max(.66rem, .5vw);
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-right,
    .main-nav ul {
        width: 100%;
        justify-content: flex-start;
    }

    .page-hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .page-hero h1,
    .page-hero p {
        max-width: none;
    }

    .back-link {
        margin-bottom: 0;
    }

    .field-grid.two {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-links {
        justify-content: start;
        grid-template-columns: repeat(3, minmax(0, max-content));
        text-align: left;
    }
}

@media (max-width: 560px) {
    :root {
        --pad: 14px;
    }

    .main-nav ul,
    .header-right {
        flex-wrap: wrap;
    }

    .logo-header {
        width: 170px;
    }

    .nav-link {
        padding: .55em .7em;
    }

    .page-content {
        padding-inline: 14px;
    }

    .page-hero h1 {
        font-size: clamp(2.15rem, 13vw, 3.25rem);
    }

    .notice {
        padding: .9rem 1rem;
    }

    .tree-form {
    width: 100%;
    padding: 20px 16px;
    border-radius: 10px;
    }

    .form-section h2 {
        font-size: clamp(1.45rem, 9vw, 2rem);
    }

    label {
        font-size: .68rem;
        letter-spacing: .08em;
    }

    .switch-row {
        align-items: flex-start;
        padding: .85rem;
    }

    .real-map,
    .map-preview {
        height: 330px;
    }

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

    .btn {
        width: 100%;
    }

    .footer-links {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-bottom {
        flex-direction: column;
    }
}

