:root {
    --ink: #1a2b2b;
    --muted: #6b7d7d;
    --bg: #f6f5f1;
    --card: #ffffff;
    --primary: #0f766e;       /* teal profond */
    --primary-dark: #0b5a54;
    --accent: #f59e0b;        /* ambre */
    --line: #e6e4dd;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(20, 40, 40, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto; padding: .7rem 1.2rem;
    display: flex; align-items: center; gap: 1.5rem;
}
.brand {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 800; font-size: 1.25rem; color: var(--primary);
    text-decoration: none; letter-spacing: -.02em;
}
.brand i { font-size: 1.4rem; }
.topnav { display: flex; gap: 1.2rem; margin-right: auto; }
.topnav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; }
.topnav a:hover { color: var(--primary); }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.user-chip {
    display: flex; align-items: center; gap: .35rem;
    font-size: .85rem; color: var(--muted); max-width: 160px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.app-main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; flex: 1; }
.app-footer {
    border-top: 1px solid var(--line); background: var(--card);
    text-align: center; padding: 1.2rem; color: var(--muted); font-size: .85rem;
    display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap;
}
.app-footer .footer-link { color: var(--muted); text-decoration: underline; }
.app-footer .footer-link:hover { color: var(--primary); }

/* ---------- Page légale ---------- */
.legal-page { max-width: 760px; margin: 0 auto; }
.legal-page h2 { font-weight: 600; }
.legal-page p { color: #444; }

/* ---------- Hero + recherche ---------- */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; margin: 0 0 .4rem; }
.hero p { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.5rem; }
.search-bar {
    display: flex; align-items: center; gap: .5rem;
    max-width: 620px; margin: 0 auto; background: var(--card);
    border: 1px solid var(--line); border-radius: 999px;
    padding: .4rem .4rem .4rem 1.1rem; box-shadow: var(--shadow);
}
.search-bar i { color: var(--muted); }
.search-bar input { flex: 1; border: none; outline: none; font-size: 1rem; background: transparent; }
.search-bar .btn { border-radius: 999px; padding: .5rem 1.4rem; }

/* ---------- Chips catégories ---------- */
.category-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.8rem 0 1.5rem; }
.chip {
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    border-radius: 999px; padding: .45rem .95rem; font-size: .9rem; cursor: pointer;
    display: inline-flex; align-items: center; gap: .4rem; transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Grille d'annonces ---------- */
.listing-grid {
    display: grid; gap: 1.2rem;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.listing-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; text-decoration: none; color: inherit;
    transition: transform .15s, box-shadow .15s; display: block;
}
.listing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.listing-thumb { position: relative; aspect-ratio: 4/3; background: #eceae3; }
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-thumb-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: #b7b3a6; font-size: 2.5rem;
}
.listing-thumb-placeholder.big { aspect-ratio: 16/9; font-size: 4rem; border-radius: var(--radius); }
.listing-badge {
    position: absolute; top: .6rem; left: .6rem; background: rgba(255,255,255,.92);
    color: var(--ink); font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px;
}
.listing-badge.inline { position: static; display: inline-block; margin-bottom: .5rem; }
.listing-body { padding: .8rem .9rem 1rem; }
.listing-price { font-weight: 800; font-size: 1.05rem; }
.listing-price span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.listing-title { font-weight: 600; margin: .15rem 0 .3rem; line-height: 1.3; }
.listing-meta { color: var(--muted); font-size: .85rem; }

/* ---------- Détail ---------- */
.detail-layout { display: grid; grid-template-columns: 1fr 360px; gap: 2rem; align-items: start; }
.back-link { color: var(--muted); text-decoration: none; font-size: .9rem; display: inline-block; margin-bottom: 1rem; }
.detail-image img { width: 100%; border-radius: var(--radius); }
.detail-title { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; margin: .3rem 0 .5rem; }
.detail-meta { display: flex; gap: 1.2rem; color: var(--muted); margin-bottom: 1rem; flex-wrap: wrap; }
.detail-desc { line-height: 1.7; white-space: pre-wrap; }
.detail-sidebar { position: sticky; top: 90px; }
.booking-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.booking-price { font-size: 1.4rem; font-weight: 800; margin-bottom: .8rem; }
.booking-price span { font-size: .85rem; font-weight: 400; color: var(--muted); }
.selection-summary { margin: .9rem 0; padding-top: .8rem; border-top: 1px solid var(--line); }
.summary-row { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .3rem; }
.summary-row.total { border-top: 1px dashed var(--line); padding-top: .4rem; margin-top: .4rem; }

/* ---------- Calendrier ---------- */
.calendar { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.calendar-title { font-weight: 600; text-transform: capitalize; }
.cal-nav { border: none; background: #f0efe9; border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.cal-nav:hover { background: #e3e1d8; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calendar-dow { margin-bottom: 3px; }
.cal-dow { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; padding: 2px; }
.cal-cell {
    aspect-ratio: 1; border: none; border-radius: 7px; font-size: .82rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer; background: transparent;
}
.cal-empty { visibility: hidden; }
.cal-available:hover { background: #d7efec; }
.cal-disabled { color: #c5c2b8; text-decoration: line-through; cursor: not-allowed; background: #f4f3ee; }
.cal-blocked { background: #fde2e2; color: #b91c1c; text-decoration: line-through; }
.cal-blocked:hover { background: #fbcfcf; }
.cal-selected { background: var(--primary); color: #fff; }
.calendar-legend { display: flex; gap: .9rem; flex-wrap: wrap; margin-top: .7rem; font-size: .72rem; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.dot-available { background: #d7efec; }
.dot-booked { background: #e6e4dd; }
.dot-blocked { background: #fde2e2; }
.dot-selected { background: var(--primary); }

/* ---------- Demandes / statuts ---------- */
.request-list { display: flex; flex-direction: column; gap: .8rem; }
.request-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.request-info { display: flex; flex-direction: column; gap: .15rem; }
.request-message { font-style: italic; color: var(--muted); margin: .3rem 0 0; }
.request-actions { display: flex; gap: .5rem; align-items: center; }
.badge-status { font-size: .78rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; }
.status-confirmed { background: #d1fae5; color: #065f46; }
.status-rejected, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-pending { background: #fef3c7; color: #92400e; }

/* ---------- États vides + formulaires + auth ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .6rem; }
.form-page { max-width: 640px; margin: 0 auto; }
.auth-wrapper { display: flex; justify-content: center; padding: 2rem 0; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }

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

@media (max-width: 860px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-sidebar { position: static; }
    .topnav { display: none; }
}

/* ---------- Language switcher ---------- */
.lang-switcher { display: flex; align-items: center; gap: .35rem; font-size: .8rem; }
.lang-switcher a { color: var(--muted); text-decoration: none; padding: .1rem .3rem; border-radius: 4px; }
.lang-switcher a:hover { color: var(--primary); }
.lang-switcher .lang-active { color: var(--primary); font-weight: 700; }

/* ---------- Chat ---------- */
.chat-section { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.chat { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-messages { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; max-height: 360px; overflow-y: auto; background: #fafafa; }
.chat-bubble { max-width: 75%; padding: .5rem .75rem; border-radius: 12px; }
.chat-mine { align-self: flex-end; background: var(--primary); color: #fff; }
.chat-theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-time { font-size: .68rem; opacity: .7; margin-top: .2rem; text-align: right; }
.chat-input { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); background: #fff; }
.chat-input textarea { resize: none; }

.messages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
.conversation-list { display: flex; flex-direction: column; gap: .25rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; max-height: 70vh; overflow-y: auto; }
.conversation-item { text-align: left; background: none; border: none; padding: .6rem; border-radius: 8px; cursor: pointer; }
.conversation-item:hover { background: #f1f1f1; }
.conversation-active { background: #e9eefc; }
.conversation-top { display: flex; justify-content: space-between; align-items: center; }
.conversation-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-header { margin-bottom: .75rem; }

@media (max-width: 860px) {
    .messages-layout { grid-template-columns: 1fr; }
}
.chat-badge { margin-left: .25rem; font-size: .68rem; vertical-align: middle; }

/* ---------- Home toolbar + map view ---------- */
.home-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.view-toggle { display: flex; gap: .4rem; flex-shrink: 0; }
.home-map { height: 70vh; min-height: 400px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.home-map .leaflet-popup-content a { color: var(--primary); font-weight: 600; }

@media (max-width: 860px) {
    .home-toolbar { flex-direction: column; align-items: stretch; }
}

/* ---------- Blazor error UI ---------- */
#blazor-error-ui { color-scheme: light only; background: #ffefef; border-top: 2px solid #e11d48; bottom: 0; box-shadow: 0 -1px 6px rgba(0,0,0,.12); display: none; left: 0; padding: .8rem 1.2rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .75rem; }
#blazor-error-ui .reload { margin-left: .5rem; }

/* ---------- Aperçu d'emplacement (détail annonce) ---------- */
.area-preview { margin-top: 1.5rem; }
.area-map { height: 240px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
.chat-phone { margin-left: .6rem; font-size: .85rem; white-space: nowrap; }
.chat-phone a { color: var(--primary); text-decoration: none; }

/* ---------- Admin ---------- */
.nav-admin { color: var(--primary) !important; font-weight: 600; }
.admin-table { font-size: .9rem; }
.admin-table th { font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--line); }
.admin-table td, .admin-table th { padding: .55rem .6rem; }

/* ---------- Info-bulle ---------- */
.info-tip { position: relative; display: inline-flex; cursor: help; color: var(--muted); margin-left: .25rem; outline: none; }
.info-tip > i { font-size: .95rem; }
.info-tip-content {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 60;
    width: 300px; max-width: 80vw; background: #fff; color: var(--ink);
    border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    padding: .75rem .85rem; font-size: .82rem; font-weight: 400; line-height: 1.45;
    visibility: hidden; opacity: 0; transition: opacity .12s; pointer-events: none;
}
.info-tip-content strong { display: block; margin-bottom: .15rem; }
.info-tip-content p { margin: 0 0 .6rem; color: #555; }
.info-tip:hover .info-tip-content,
.info-tip:focus .info-tip-content,
.info-tip:focus-within .info-tip-content { visibility: visible; opacity: 1; }
.badge-unlisted { background: #fef3c7 !important; color: #92400e !important; }

/* ---------- Upload d'images ---------- */
.image-uploader { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .3rem; }
.image-item, .image-add { width: 96px; height: 96px; border-radius: 10px; position: relative; overflow: hidden; }
.image-item { border: 1px solid var(--line); }
.image-item img { width: 100%; height: 100%; object-fit: cover; }
.image-item-file { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; background: #f4f3ee; color: var(--muted); font-size: .65rem; text-align: center; padding: 4px; }
.image-item-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 88px; }
.image-remove { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.image-add { border: 2px dashed var(--line); background: #fafafa; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; color: var(--muted); font-size: .7rem; cursor: pointer; text-align: center; }
.image-add:hover { border-color: var(--primary); color: var(--primary); }
.image-add input[type=file] { display: none; }

/* ---------- Galerie détail ---------- */
.detail-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.detail-thumb { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: none; }
.detail-thumb.active { border-color: var(--primary); }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Favoris ---------- */
.listing-card-wrap { position: relative; }
.fav-btn {
    position: absolute; top: .6rem; right: .6rem; z-index: 2;
    width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.92); color: #6b7d7d; box-shadow: 0 1px 4px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.fav-btn:hover { color: #e11d48; }
.fav-btn.fav-on { color: #e11d48; }
.chip-fav.chip-active { background: #e11d48; border-color: #e11d48; }
.fav-link { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; }
.fav-link:hover, .fav-link.fav-on { color: #e11d48; }

/* ---------- Menu kebab sur carte (mes annonces) ---------- */
.card-menu { position: absolute; top: .6rem; right: .6rem; z-index: 3; }
.card-menu-btn {
    width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.card-menu-btn:hover { background: #fff; color: var(--primary); }
.card-menu-list {
    position: absolute; top: 40px; right: 0; min-width: 210px; background: #fff;
    border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    padding: .35rem; display: flex; flex-direction: column; z-index: 4;
}
.card-menu-list a, .card-menu-list button {
    display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 7px;
    background: none; border: none; text-align: left; cursor: pointer; color: var(--ink);
    font-size: .9rem; text-decoration: none; width: 100%;
}
.card-menu-list a:hover, .card-menu-list button:hover { background: #f1f1f1; }
.card-menu-list button.danger { color: #b91c1c; }
.card-menu-list button.danger:hover { background: #fde2e2; }
.listing-card-wrapper { position: relative; }
