/* ===== file: /assets/css/main.css ===== */
:root {
    /* 🎨 Thème clair attirant (bleu/turquoise) */
    --bg: #f4f7ff;
    --surface: rgba(255, 255, 255, .78);
    --surface2: rgba(255, 255, 255, .92);

    --text: #0f172a;
    --muted: #475569;

    --border: rgba(15, 23, 42, .12);

    --primary: #2563eb;
    --primary2: #06b6d4;

    --shadow: 0 18px 44px rgba(2, 6, 23, .12);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

    /* ✅ Background clair, propre, pro */
    background:
        radial-gradient(1100px 650px at 10% 10%, rgba(37, 99, 235, .14), transparent 60%),
        radial-gradient(1100px 650px at 90% 20%, rgba(6, 182, 212, .12), transparent 60%),
        radial-gradient(900px 520px at 50% 110%, rgba(99, 102, 241, .10), transparent 60%),
        var(--bg);

    color: var(--text);
}

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

.container {
    width: min(1100px, 92%);
    margin: 0 auto;
}

.page {
    padding: 28px 0 60px;
}

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

/* =========================
   NAVBAR
   ========================= */

.topbar {
    background: #B67332;
    /* ✅ nouvelle couleur */
    color: #f9fafb;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.topbar .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
}

.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: #f9fafb;
}

.topbar .brand-text {
    white-space: nowrap;
}

/* ✅ logo image */
.topbar .brand .logo-img {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: #fff;
}

/* liens de navigation */
.topbar .links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar .links a {
    color: #f9fafb;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 14px;
    opacity: 0.9;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.topbar .links a:hover {
    background: rgba(15, 23, 42, 0.16);
    opacity: 1;
    transform: translateY(-1px);
}

.topbar .links a.active {
    background: rgba(15, 23, 42, 0.24);
    font-weight: 700;
}

/* actions à droite (Contact + user menu) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    transition: .2s ease;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    border: none;
    color: #ffffff;
    font-weight: 800;
}

/* bouton bordure simple (login) */
.btn.btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.9);
    color: #f9fafb;
    font-weight: 600;
}

.btn.btn-outline:hover {
    background: rgba(15, 23, 42, 0.18);
}

.btn.ghost {
    background: transparent;
}

.btn.full {
    width: 100%;
    margin-top: 10px;
}

/* Petit bouton compact */
.btn.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Aperçu cover dans admin-properties */
.cover-preview {
    margin-top: 8px;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.cover-preview img {
    width: 180px;
    height: 130px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
}

.btn-cover-delete {
    margin-top: 2px;
}

/* Aperçu galerie (صور إضافية) dans admin-properties */
.gallery-admin-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-admin-item {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.gallery-admin-item img {
    width: 130px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
}

/* bouton supprimer sous chaque image de galerie */
.btn-gallery-delete {
    border-color: rgba(248, 113, 113, 0.9);
    color: #b91c1c;
}

.btn-gallery-delete:hover {
    background: rgba(248, 113, 113, 0.12);
}


/* Aperçu de la cover dans la page admin-properties */
.cover-preview {
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cover-preview img {
    width: 160px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
}

/* petit bouton compact pour "حذف الصورة" */
.btn.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}


/* =========================
   USER MENU (avatar + dropdown)
   ========================= */

.user-menu {
    position: relative;
}

.user-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: #f9fafb;
    cursor: pointer;
    font-size: 13px;
    backdrop-filter: blur(6px);
}

.user-menu__trigger:hover {
    background: rgba(15, 23, 42, 0.18);
}

.user-menu__avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #0ea5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f9fafb;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.45);
}

.user-menu__avatar--lg {
    width: 40px;
    height: 40px;
}

/* image dans l’avatar (admin / femme / homme) */
.user-menu__avatar-img {
    width: 75%;
    height: 75%;
    object-fit: contain;
    border-radius: 999px;
    display: block;
}

/* variantes de couleur suivant le type */
.user-menu__avatar--admin,
.user-menu__avatar--female,
.user-menu__avatar--male {
    background: #ffffff;
    color: #0f172a;
}

.user-menu__info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.user-menu__name {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-menu__role {
    font-size: 11px;
    opacity: 0.9;
}

/* ========= Badge Admin ========= */

.user-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(15, 23, 42, 0.25);
}

.user-badge--admin {
    background: rgba(2, 132, 199, 0.35);
}

/* (ancien style pour SVG, laissé au cas où) */
.user-menu__avatar-ic {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-menu__avatar-ic svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: #0f172a;
}

/* dropdown */
.user-menu__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 220px;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 10px 0;
    z-index: 1000;
    display: none;
}

.user-menu__dropdown.open {
    display: block;
}

.user-menu__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 8px;
    border-bottom: 1px solid rgba(226, 232, 240, 1);
    margin-bottom: 6px;
}

.user-menu__body {
    display: flex;
    flex-direction: column;
    padding: 0 4px;
}

.user-menu__item {
    padding: 8px 10px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    text-align: start;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #0f172a;
}

.user-menu__item:hover {
    background: rgba(59, 130, 246, 0.07);
}

.user-menu__item--danger {
    color: #b91c1c;
}

@media (max-width: 640px) {
    .topbar .nav {
        flex-wrap: wrap;
    }

    .nav-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* =========================
   HERO & reste de la page
   ========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

/* Hero */
.hero {
    padding: 26px 0 34px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 18px;
    align-items: start;
}

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

.hero h1 {
    font-size: 40px;
    line-height: 1.1;
    margin: 10px 0;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.hero-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

/* Stats */
.stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.stat {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    min-width: 120px;
    box-shadow: var(--shadow);
}

.stat b {
    font-size: 20px;
    display: block;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.h2 {
    margin: 0;
}

/* Details */
.details {
    margin-top: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.details .heroimg {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.details .meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(37, 99, 235, .08);
    color: var(--muted);
}

/* Pills & notices */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(6, 182, 212, .14);
    color: var(--text);
    font-weight: 800;
    width: fit-content;
}

.notice {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    box-shadow: var(--shadow);
}

/* Sections */
.section {
    padding: 26px 0;
}

.section-head {
    margin-bottom: 12px;
}

.section-title {
    margin: 0 0 6px;
    font-size: 26px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

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

.feature {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    box-shadow: var(--shadow);
}

.feature-ic {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(37, 99, 235, .10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* Steps */
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

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

.step {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    box-shadow: var(--shadow);
}

.step-n {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, .16);
    border: 1px solid var(--border);
    font-weight: 900;
}

/* ========= Galerie de photos pour un bien ========= */

.prop-gallery {
    margin-top: 18px;
}

.prop-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.prop-gallery-grid .gallery-item {
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.prop-gallery-grid img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    transition: transform .25s ease;
}

.prop-gallery-grid img:hover {
    transform: scale(1.03);
}

/* ===== Carte détails propriété ===== */
.details-card {
    margin-top: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.details-top {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .details-top {
        grid-template-columns: 1fr;
    }
}

.details-top-img img.heroimg {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.details-top-info .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.details-desc {
    margin-top: 10px;
    line-height: 1.7;
}

.details-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.details-extra {
    margin-top: 20px;
}

.details-extra-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 0 2px;
}

.thumb-btn {
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    flex: 0 0 auto;
}

.thumb-btn img {
    display: block;
    width: 130px;
    height: 90px;
    object-fit: cover;
    border-radius: inherit;
}

/* ===== Lightbox / Galerie plein écran (style Avito) ===== */
.gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
}

.gallery-overlay.open {
    display: flex;
}

.gallery-overlay__content {
    position: relative;
    width: min(1000px, 96%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #020617;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.75);
}

.gallery-main-img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: #000;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.7);
    color: #f9fafb;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-arrow--prev {
    left: 12px;
}

.gallery-arrow--next {
    right: 12px;
}

.gallery-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.85);
    color: #f9fafb;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.gallery-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: #020617;
    color: #e5e7eb;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    flex-wrap: wrap;
}

.gallery-counter {
    font-size: 13px;
    opacity: 0.8;
    white-space: nowrap;
}

.gallery-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
}

.gallery-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}

.gallery-thumb img {
    display: block;
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: inherit;
}

.gallery-thumb.is-active {
    border-color: #38bdf8;
}

@media (max-width: 640px) {
    .gallery-main-img {
        max-height: 60vh;
    }

    .gallery-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-thumbs {
        width: 100%;
        justify-content: center;
    }
}

/* =========================
   Badge "nouveau" sur lien طلبات التواصل
   ========================= */

#navContactRequests {
    position: relative;
}

/* Point caché par défaut */
#navContactRequests::after {
    content: "";
    position: absolute;
    top: 6px;
    inset-inline-start: 8px;
    /* RTL-friendly */
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #f97316;
    /* orange */
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.35);
    transform: scale(0);
    opacity: 0;
    transition:
        transform 0.18s ease-out,
        opacity 0.18s ease-out;
}

/* Quand il y a une nouvelle demande */
#navContactRequests.has-new::after {
    transform: scale(1);
    opacity: 1;
}

/* =========================
   Toast notifications (admin)
   ========================= */

.admin-toast-container {
    position: fixed;
    inset-inline-start: 16px;
    /* côté gauche en RTL */
    bottom: 16px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-toast {
    min-width: 260px;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 16px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
    border-inline-start: 4px solid #16a34a;
    font-size: 14px;
}

.admin-toast__title {
    font-weight: 800;
    margin-bottom: 4px;
}

.admin-toast__body {
    font-size: 13px;
    opacity: 0.9;
}

.admin-toast__meta {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
}