/* ============================================================
   Trabouler - Les commerçants de la Croix-Rousse
   Feuille de style unique du site
   ============================================================ */

:root {
    --cream: #f6f1e7;
    --paper: #fffdf8;
    --ink: #2c2621;
    --muted: #7c7268;
    --brick: #a6493f;
    --brick-dark: #7f352e;
    --gold: #c99a3f;
    --sage: #5f7a6a;
    --line: #e4dbcc;
    --danger: #9c2f2f;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(44, 38, 33, 0.08);
    --serif: Georgia, 'Times New Roman', serif;
    --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--cream);
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
}

h1 { font-size: 1.9rem; margin: 0.4em 0 0.5em; }
h2 { font-size: 1.35rem; margin: 0.8em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 0.5em 0 0.3em; }

a {
    color: var(--brick);
}

a:hover {
    color: var(--brick-dark);
}

img {
    max-width: 100%;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--muted);
}

/* ------------------------------------------------------------
   En-tête
   ------------------------------------------------------------ */

.site-header {
    background: var(--paper);
    border-bottom: 3px solid var(--brick);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--brick);
    letter-spacing: 0.5px;
}

.brand-tagline {
    font-size: 0.8rem;
    color: var(--muted);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.main-nav a {
    text-decoration: none;
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.95rem;
}

.main-nav a:hover {
    background: var(--cream);
    color: var(--brick-dark);
}

/* ------------------------------------------------------------
   Page d'accueil
   ------------------------------------------------------------ */

.hero {
    background: var(--brick);
    color: var(--paper);
    padding: 48px 0 42px;
    margin-bottom: 28px;
}

.hero h1 {
    color: var(--paper);
    font-size: 2.2rem;
    margin: 0 0 0.4em;
}

.hero-text {
    max-width: 640px;
    font-size: 1.05rem;
    margin: 0 0 1.2em;
}

.hero-actions {
    margin: 0;
}

.hero-empty {
    padding: 22px 0;
}

.filters {
    margin-bottom: 24px;
}

#search {
    width: 100%;
    max-width: 420px;
    padding: 11px 16px;
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    margin-bottom: 12px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    font-family: var(--sans);
    font-size: 0.85rem;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
}

.chip:hover {
    border-color: var(--brick);
    color: var(--brick-dark);
}

.chip.active {
    background: var(--brick);
    border-color: var(--brick);
    color: var(--paper);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.merchant-card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.merchant-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(44, 38, 33, 0.14);
    color: var(--ink);
}

.card-logo {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.card-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    color: var(--brick);
    font-family: var(--serif);
    font-size: 3rem;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 18px;
}

.card-title {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
}

.card-excerpt {
    font-size: 0.9rem;
    color: var(--muted);
}

.card-address {
    font-size: 0.85rem;
    color: var(--muted);
}

.badge {
    align-self: flex-start;
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--cream);
    color: var(--brick-dark);
    border: 1px solid var(--line);
}

.badge-featured {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--paper);
}

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

/* ------------------------------------------------------------
   Cartes Leaflet
   ------------------------------------------------------------ */

.map-page h1 {
    margin-bottom: 0.2em;
}

.map-full {
    height: 70vh;
    min-height: 420px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 16px 0 40px;
}

.map-mini {
    height: 320px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 10px 0 30px;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--paper);
    box-shadow: 0 0 0 1px var(--line);
}

/* ------------------------------------------------------------
   Fiche vitrine
   ------------------------------------------------------------ */

.fiche {
    padding-bottom: 30px;
}

.fiche-header {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    gap: 24px;
    align-items: start;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 24px;
}

.fiche-logo {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius);
}

.fiche-heading h1 {
    margin: 0 0 0.3em;
}

.info-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    color: var(--muted);
}

.info-list li {
    margin-bottom: 4px;
}

.fiche-hours {
    background: var(--cream);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 220px;
}

.fiche-hours h2 {
    margin: 0 0 0.4em;
    font-size: 1.05rem;
}

.fiche-hours p {
    margin: 0;
    font-size: 0.9rem;
}

.fiche-description {
    max-width: 760px;
    font-size: 1.02rem;
    margin: 24px 4px;
}

.section-title {
    border-bottom: 2px solid var(--line);
    padding-bottom: 6px;
    margin-top: 1.6em;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin: 18px 0 10px;
}

.product-card {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-featured {
    outline: 2px solid var(--gold);
}

.product-photo {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.product-body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-body h3 {
    margin: 0;
}

.product-body p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.product-price {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brick-dark);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin: 18px 0 10px;
}

.gallery-item {
    margin: 0;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.gallery-item figcaption {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 8px 12px;
}

.gallery-manage .gallery-item form {
    padding: 0 12px 12px;
}

/* ------------------------------------------------------------
   Formulaires
   ------------------------------------------------------------ */

label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 1rem;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--brick);
    outline-offset: 0;
    border-color: var(--brick);
}

textarea {
    resize: vertical;
}

input[type="color"] {
    width: 52px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    cursor: pointer;
}

input[type="file"] {
    font-size: 0.9rem;
}

.field {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 18px;
}

.form-grid .field-small {
    max-width: 220px;
}

.field-help {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 400;
    margin: 2px 0 8px;
}

.check {
    font-weight: 400;
    margin-bottom: 8px;
}

.check input {
    margin-right: 6px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.form-inline label {
    margin: 0;
}

.form-inline input[type="text"],
.form-inline input[type="email"] {
    width: auto;
    flex: 1;
    min-width: 200px;
}

.input-number {
    max-width: 90px;
}

.thumb {
    display: block;
    max-width: 160px;
    max-height: 160px;
    border-radius: 6px;
    margin: 6px 0;
}

.thumb-small {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* ------------------------------------------------------------
   Boutons
   ------------------------------------------------------------ */

.btn {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.92rem;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
}

.btn:hover {
    border-color: var(--brick);
    color: var(--brick-dark);
}

.btn-primary {
    background: var(--brick);
    border-color: var(--brick);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--brick-dark);
    border-color: var(--brick-dark);
    color: var(--paper);
}

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

.btn-danger:hover {
    background: var(--danger);
    color: var(--paper);
}

.btn-danger[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--brick);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
}

/* ------------------------------------------------------------
   Panneaux, alertes, tableaux
   ------------------------------------------------------------ */

.panel {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin: 20px 0;
}

.panel h2:first-child {
    margin-top: 0;
}

.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin: 16px 0;
    background: var(--paper);
    border-left: 4px solid var(--sage);
}

.alert-success {
    border-left-color: var(--sage);
}

.alert-error {
    border-left-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    border-left-color: var(--gold);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 16px 0 30px;
}

.table th,
.table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 0.95rem;
}

.table th {
    background: var(--cream);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
}

.table tr:last-child td {
    border-bottom: none;
}

.row-sub td:first-child {
    padding-left: 38px;
}

.actions {
    white-space: nowrap;
}

.actions form {
    display: inline-block;
    margin: 2px 0;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0;
}

/* ------------------------------------------------------------
   Tableaux de bord (espace + admin)
   ------------------------------------------------------------ */

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
    margin: 20px 0;
}

.dash-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    text-decoration: none;
    color: var(--ink);
}

.dash-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.dash-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.dash-number {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--brick);
}

.dash-card .btn {
    align-self: flex-start;
    margin-top: 8px;
}

.todo-list {
    margin: 0;
    padding-left: 20px;
}

.todo-list li {
    margin-bottom: 6px;
}

/* ------------------------------------------------------------
   Connexion / installation
   ------------------------------------------------------------ */

.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 50px 20px 70px;
}

.auth-box {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 34px;
    width: 100%;
    max-width: 440px;
}

.auth-box h1 {
    margin-top: 0;
}

.auth-box label {
    margin-top: 14px;
}

.auth-help {
    font-size: 0.88rem;
    color: var(--muted);
    margin-top: 18px;
}

/* ------------------------------------------------------------
   Pages de contenu
   ------------------------------------------------------------ */

.page-legal {
    max-width: 760px;
    padding-bottom: 40px;
}

/* ------------------------------------------------------------
   Pied de page
   ------------------------------------------------------------ */

.site-footer {
    background: var(--ink);
    color: var(--cream);
    margin-top: 40px;
}

.footer-inner {
    padding: 24px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
}

.footer-inner p {
    margin: 0;
}

.site-footer a {
    color: var(--cream);
}

/* ------------------------------------------------------------
   Écrans étroits
   ------------------------------------------------------------ */

@media (max-width: 720px) {
    .hero h1 {
        font-size: 1.7rem;
    }

    .fiche-header {
        grid-template-columns: 1fr;
    }

    .fiche-logo {
        width: 140px;
        height: 140px;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .table th,
    .table td {
        padding: 8px 8px;
        font-size: 0.88rem;
    }

    .actions {
        white-space: normal;
    }
}
