/* ================================================================
   Trachsler Immobilier — Style Premium v1.3
   Inspiré SAFTI : icônes, cartes nettes, filtres anthracite
   ================================================================ */

:root {
    --ti-dark    : #1a252f;
    --ti-main    : #2c3e50;
    --ti-gold    : #c9a84c;
    --ti-white   : #ffffff;
    --ti-offwhite: #f7f7f5;
    --ti-border  : #e8e8e4;
    --ti-text    : #2d2d2d;
    --ti-muted   : #777777;
    --ti-radius  : 10px;
    --ti-shadow  : 0 2px 16px rgba(0,0,0,.08);
    --ti-shadow-h: 0 8px 32px rgba(0,0,0,.16);
    --ti-trans   : .28s cubic-bezier(.25,.8,.25,1);
}

/* ── Reset ─────────────────────────────────────────────────────── */
.ti-catalogue *, .ti-fiche *, .ti-catalogue *::before, .ti-catalogue *::after,
.ti-fiche *::before, .ti-fiche *::after { box-sizing: border-box; margin: 0; padding: 0; }
.ti-catalogue, .ti-fiche { font-family: 'Helvetica Neue', Arial, sans-serif; color: var(--ti-text); }

/* ── Filtres ────────────────────────────────────────────────────── */
.ti-catalogue { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.ti-filtres {
    background: var(--ti-main);
    border-radius: var(--ti-radius);
    padding: 28px 32px 24px;
    margin-bottom: 36px;
}
.ti-filtres-inner { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.ti-filtre-group  { flex: 1; min-width: 150px; }
.ti-filtre-label  {
    display: block; font-size: 10px; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(255,255,255,.55); margin-bottom: 7px;
}
.ti-filtre {
    width: 100%; padding: 9px 32px 9px 12px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px; color: #fff; font-size: 13px;
    cursor: pointer; transition: border-color var(--ti-trans);
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,.45)'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.ti-filtre:focus  { outline: none; border-color: var(--ti-gold); background-color: rgba(255,255,255,.15); }
.ti-filtre option { background: var(--ti-main); color: #fff; }
.ti-btn-reset {
    padding: 9px 18px; background: transparent;
    border: 1px solid rgba(255,255,255,.3); border-radius: 6px;
    color: rgba(255,255,255,.65); font-size: 13px;
    cursor: pointer; transition: all var(--ti-trans); white-space: nowrap; align-self: flex-end;
}
.ti-btn-reset:hover { border-color: var(--ti-gold); color: var(--ti-gold); }

/* Résultats header */
.ti-resultats-header { font-size: 13px; color: var(--ti-muted); margin-bottom: 22px; font-style: italic; }

/* ── Grille ────────────────────────────────────────────────────── */
.ti-grille {
    display: grid;
    grid-template-columns: repeat(var(--cols,3), 1fr);
    gap: 24px;
    transition: opacity .22s;
}
@media(max-width:1024px) { .ti-grille { grid-template-columns: repeat(2,1fr); } }
@media(max-width:580px)  { .ti-grille { grid-template-columns: 1fr; } }

/* ── Carte bien ────────────────────────────────────────────────── */
.ti-card {
    background: var(--ti-white);
    border-radius: var(--ti-radius);
    overflow: hidden;
    box-shadow: var(--ti-shadow);
    border: 1px solid var(--ti-border);
    transition: transform var(--ti-trans), box-shadow var(--ti-trans);
}
.ti-card:hover { transform: translateY(-4px); box-shadow: var(--ti-shadow-h); }
.ti-card-link  { display: block; text-decoration: none; color: inherit; }

/* Photo */
.ti-card-photo {
    position: relative; padding-top: 62%;
    overflow: hidden; background: var(--ti-border);
}
.ti-card-photo img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform .5s ease;
    display: block;
}
.ti-card:hover .ti-card-photo img { transform: scale(1.04); }

/* Badges sur photo */
.ti-badge {
    position: absolute; top: 12px; right: 12px;
    color: #fff; font-size: 10px; font-weight: 700;
    letter-spacing: .8px; text-transform: uppercase;
    padding: 4px 10px; border-radius: 20px;
}
.ti-type-tag {
    position: absolute; bottom: 12px; left: 12px;
    background: rgba(26,37,47,.82); backdrop-filter: blur(4px);
    color: #fff; font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 4px; letter-spacing: .4px;
}
.ti-card-dpe {
    position: absolute; bottom: 12px; right: 12px;
    color: #fff; font-size: 10px; font-weight: 800;
    padding: 3px 8px; border-radius: 4px; letter-spacing: .6px;
}

/* Corps */
.ti-card-body { padding: 18px 20px 20px; }
.ti-card-title {
    font-size: 14px; font-weight: 700; color: var(--ti-main);
    margin-bottom: 7px; line-height: 1.35;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ti-card-lieu {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--ti-muted); margin-bottom: 13px;
}
.ti-card-lieu svg { flex-shrink: 0; color: var(--ti-main); }

/* Specs avec icônes — style SAFTI */
.ti-card-specs {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 0; border-top: 1px solid var(--ti-border);
    border-bottom: 1px solid var(--ti-border);
    margin-bottom: 14px;
}
.ti-spec {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--ti-muted);
    background: var(--ti-offwhite);
    padding: 5px 10px; border-radius: 20px;
}
.ti-spec svg { color: var(--ti-main); flex-shrink: 0; }
.ti-spec strong { color: var(--ti-text); font-weight: 700; }

/* Footer carte */
.ti-card-footer { display: flex; justify-content: space-between; align-items: flex-end; }
.ti-card-prix   { font-size: 20px; font-weight: 800; color: var(--ti-main); letter-spacing: -.3px; }
.ti-card-ref    { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #aaa; }
.ti-card-ref svg { color: #ccc; }

/* ── Loading / vide ────────────────────────────────────────────── */
.ti-loading {
    display: flex; justify-content: center;
    padding: 60px; align-items: center;
}
.ti-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--ti-border);
    border-top-color: var(--ti-main);
    border-radius: 50%;
    animation: ti-spin .7s linear infinite;
}
@keyframes ti-spin { to { transform: rotate(360deg); } }
.ti-no-result { text-align: center; padding: 60px 20px; color: var(--ti-muted); }
.ti-no-result p { font-size: 14px; margin-top: 6px; }

/* ── Page fiche individuelle ────────────────────────────────────── */
.ti-fiche {
    max-width: 1100px; margin: 0 auto; padding: 0 16px 60px;
}

/* En-tête fiche */
.ti-fiche-header {
    display: flex; justify-content: space-between;
    align-items: flex-start; flex-wrap: wrap; gap: 16px;
    margin-bottom: 28px; padding-bottom: 24px;
    border-bottom: 2px solid var(--ti-border);
}
.ti-fiche-titre { font-size: 26px; font-weight: 800; color: var(--ti-main); line-height: 1.2; }
.ti-fiche-prix  { font-size: 30px; font-weight: 800; color: var(--ti-main); }

/* Bannière specs — inspirée SAFTI */
.ti-fiche-specs-bar {
    display: flex; flex-wrap: wrap; gap: 0;
    background: var(--ti-white);
    border: 1px solid var(--ti-border);
    border-radius: var(--ti-radius);
    overflow: hidden;
    margin-bottom: 32px;
}
.ti-fiche-spec {
    flex: 1; min-width: 110px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px;
    padding: 20px 16px;
    border-right: 1px solid var(--ti-border);
    text-align: center;
}
.ti-fiche-spec:last-child { border-right: none; }
.ti-fiche-spec-icon { color: var(--ti-main); }
.ti-fiche-spec-icon svg { width: 24px; height: 24px; }
.ti-fiche-spec-val { font-size: 18px; font-weight: 800; color: var(--ti-main); }
.ti-fiche-spec-key {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 1px; color: var(--ti-muted);
}
@media(max-width:600px) {
    .ti-fiche-spec { min-width: 80px; padding: 14px 10px; }
    .ti-fiche-spec-val { font-size: 15px; }
}

/* Galerie fiche */
.ti-fiche-galerie {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 240px 240px;
    gap: 6px; margin-bottom: 36px;
    border-radius: var(--ti-radius); overflow: hidden;
}
.ti-fiche-galerie img {
    width: 100%; height: 100%; object-fit: cover;
    display: block; cursor: pointer; transition: opacity .2s;
}
.ti-fiche-galerie img:hover { opacity: .88; }
.ti-fiche-galerie .ti-main-photo { grid-row: span 2; }
@media(max-width:640px) {
    .ti-fiche-galerie { grid-template-columns: 1fr; grid-template-rows: auto; }
    .ti-fiche-galerie .ti-main-photo { grid-row: span 1; height: 240px; }
    .ti-fiche-galerie .ti-secondary  { height: 160px; }
}

/* DPE fiche */
.ti-dpe-bloc { display: flex; gap: 28px; flex-wrap: wrap; padding: 20px 24px; background: var(--ti-offwhite); border-radius: var(--ti-radius); }
.ti-dpe-item { display: flex; align-items: center; gap: 14px; }
.ti-dpe-lettre {
    width: 52px; height: 52px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.ti-dpe-detail span { font-size: 11px; text-transform: uppercase; color: var(--ti-muted); letter-spacing: .8px; display: block; margin-bottom: 3px; }
.ti-dpe-detail strong { font-size: 17px; color: var(--ti-main); font-weight: 700; }

/* ── Admin DPE ─────────────────────────────────────────────────── */
.ti-bareme-wrap  { display:flex; flex-direction:column; gap:3px; margin:10px 0 6px; }
.ti-bareme-row   { display:flex; align-items:center; gap:10px; cursor:pointer; padding:2px 6px; border-radius:4px; transition:background .15s; }
.ti-bareme-row:hover { background:rgba(0,0,0,.04); }
.ti-bareme-active    { background:rgba(0,0,0,.07); }
.ti-bareme-radio     { display:none; }
.ti-bareme-fleche    { display:inline-block; flex-shrink:0; }
.ti-bareme-label     { font-size:12px; color:#666; min-width:130px; }
.ti-bareme-current   { font-size:11px; font-weight:700; color:var(--bc,#333); }
.ti-dpe-grid         { display:grid; grid-template-columns:1fr 1fr; gap:32px; margin:10px 0; }
.ti-dpe-section-title{ font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.8px; color:#2c3e50; margin-bottom:8px; border-bottom:2px solid #2c3e50; padding-bottom:4px; }
@media(max-width:900px) { .ti-dpe-grid { grid-template-columns:1fr; } }

/* ── Formulaire de contact ──────────────────────────────────────── */
.ti-contact-bloc {
    background: #2c3e50;
    border-radius: 10px;
    padding: 40px;
    margin-top: 8px;
    color: #fff;
}
.ti-contact-header { margin-bottom: 28px; }
.ti-contact-title {
    font-size: 20px; font-weight: 800; color: #fff;
    margin: 0 0 8px;
}
.ti-contact-sub {
    color: rgba(255,255,255,.65); font-size: 14px; margin: 0;
}
.ti-contact-ref {
    color: rgba(255,255,255,.35); font-size: 11px;
    margin: 6px 0 0;
}

/* Ligne de champs */
.ti-form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.ti-form-row-2 > * { flex: 1; min-width: 0; }
.ti-form-group { margin-bottom: 16px; }
.ti-form-row.ti-form-row-2 { margin-bottom: 0; }
.ti-form-row.ti-form-row-2 .ti-form-group { margin-bottom: 16px; }
@media(max-width:580px) { .ti-form-row-2 { flex-direction: column; gap: 0; } }

.ti-form-label {
    display: block; font-size: 11px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    color: rgba(255,255,255,.6); margin-bottom: 7px;
}
.ti-required { color: #e74c3c; }

.ti-form-input {
    width: 100%; padding: 11px 14px;
    background: #fff;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 6px; color: #2c3e50;
    font-size: 14px; font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.ti-form-input::placeholder { color: #aaa; }
.ti-form-input:focus {
    border-color: #fff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,.25);
}
.ti-form-textarea {
    resize: vertical; min-height: 120px; line-height: 1.6;
}

/* Pied du formulaire */
.ti-form-footer {
    display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 14px;
    margin-top: 4px;
}
.ti-form-mention {
    font-size: 11px; color: rgba(255,255,255,.35);
    margin: 0; max-width: 320px;
}
.ti-form-submit {
    background: #fff; color: #2c3e50;
    border: none; padding: 13px 28px;
    border-radius: 6px; font-size: 14px;
    font-weight: 700; cursor: pointer;
    transition: background .2s, transform .15s;
    white-space: nowrap;
}
.ti-form-submit:hover {
    background: #f0f0f0; transform: translateY(-1px);
}

/* Message succès */
.ti-form-success {
    text-align: center; padding: 32px 20px;
}
.ti-form-success-icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: #27ae60; color: #fff;
    font-size: 26px; line-height: 56px;
    margin: 0 auto 16px;
}
.ti-form-success h3 {
    font-size: 20px; font-weight: 800;
    color: #fff; margin: 0 0 8px;
}
.ti-form-success p {
    color: rgba(255,255,255,.7); font-size: 14px; margin: 0;
}

/* Message d'erreur */
.ti-form-error {
    background: rgba(231,76,60,.2);
    border: 1px solid rgba(231,76,60,.5);
    color: #ffb3b3; border-radius: 6px;
    padding: 12px 16px; font-size: 13px;
    margin-bottom: 20px;
}

/* ── Sections par statut ────────────────────────────────────────── */

/* Conteneur global : une section sous l'autre, jamais côte à côte */
#ti-sections {
    display: block !important;
    width: 100%;
}

.ti-section {
    display: block !important;
    width: 100%;
    margin-bottom: 52px;
}
.ti-section:last-child { margin-bottom: 0; }

/* En-tête de section : disposition horizontale interne */
.ti-section-header {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ti-border);
}
.ti-section-dot {
    width: 14px; height: 14px; border-radius: 50%;
    flex-shrink: 0; display: inline-block;
}
.ti-section-title {
    font-size: 22px; font-weight: 800;
    color: var(--ti-main); margin: 0; flex: 1;
}
.ti-section-count {
    font-size: 12px; color: var(--ti-muted);
    background: var(--ti-offwhite);
    border: 1px solid var(--ti-border);
    padding: 3px 10px; border-radius: 20px;
    font-weight: 600;
}

/* La grille à l'intérieur d'une section prend toute la largeur */
.ti-section .ti-grille {
    display: grid !important;
    grid-template-columns: repeat(var(--cols, 3), 1fr) !important;
    gap: 24px;
    width: 100%;
}
@media(max-width:1024px) { .ti-section .ti-grille { grid-template-columns: repeat(2,1fr) !important; } }
@media(max-width:580px)  { .ti-section .ti-grille { grid-template-columns: 1fr !important; } }

/* ── Bouton Compléments ─────────────────────────────────────────── */
.ti-btn-complement {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--ti-main); color: #fff;
    text-decoration: none; padding: 13px 22px;
    border-radius: 8px; font-size: 14px; font-weight: 600;
    transition: background .2s, transform .15s;
    border: 2px solid transparent;
}
.ti-btn-complement:hover {
    background: var(--ti-dark);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* ── Bouton Retour ──────────────────────────────────────────────── */
.ti-btn-retour {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ti-muted); font-size: 13px; font-weight: 600;
    text-decoration: none;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--ti-border);
    border-radius: 20px;
    background: var(--ti-white);
    transition: all .2s;
    cursor: pointer;
}
.ti-btn-retour:hover {
    color: var(--ti-main);
    border-color: var(--ti-main);
    background: var(--ti-offwhite);
    text-decoration: none;
}
.ti-btn-retour svg { transition: transform .2s; }
.ti-btn-retour:hover svg { transform: translateX(-2px); }
