/* ═══════════════════════════════════════════════════════════════════════════
   v130 — PIN DETAILS PANEL
   ──────────────────────────────────────────────────────────────────────────
   Painel ancorado que abre simultaneamente ao foco do mapa quando o
   usuário acessa um permalink de pin (`?p=lat,lng` ou `?pin=slug`).

   Comportamento dual:
     • Desktop (≥ 900px): slide-in lateral à direita, ~460px de largura,
       o mapa permanece visível à esquerda (o JS desloca o centro do mapa
       pra compensar a área coberta pelo painel).
     • Mobile (< 900px):  bottom-sheet com altura ~88vh, deslizando de baixo.
       O mapa fica visível na faixa superior remanescente.

   Token-fonte: --srp-pc-* (painel-custom.css). Fallbacks hardcoded pra que
   este CSS funcione mesmo se for carregado fora do contexto do painel.

   z-index: 10800 — abaixo do modal de medição (11010) e do toolbar (11005)
   mas acima dos painéis flutuantes do mapa (1000-2000).

   Identidade visual: gradiente vertical verde-petróleo → preto-musgo, borda
   dourada sutil, tipografia Fraunces (display) + Inter (UI).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Backdrop (mobile/tablet apenas; desktop não escurece) ─────────────── */
#srp-pin-details-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 12, 10, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 10790;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
#srp-pin-details-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}
/* Desktop: sem backdrop (mapa permanece interativo do lado esquerdo) */
@media (min-width: 900px) {
    #srp-pin-details-backdrop { display: none; }
}

/* ── Painel principal ─────────────────────────────────────────────────── */
#srp-pin-details-panel {
    position: fixed;
    z-index: 10800;
    background: linear-gradient(180deg, #0B1612 0%, #060C0A 100%);
    color: #F2EDE0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    border: 1px solid rgba(212, 173, 90, 0.30);
    box-shadow:
        0 24px 64px -16px rgba(0, 0, 0, 0.65),
        0 1px 0 rgba(255, 255, 255, 0.04) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition:
        transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    /* Garante que o focus ring nunca seja cortado pelo overflow:hidden interno */
    isolation: isolate;
}

/* ── Posicionamento e animação de entrada ─────────────────────────────── */

/* Mobile (default): bottom-sheet */
#srp-pin-details-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100vw;
    max-width: 100vw;
    height: 88vh;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    border-bottom-width: 0;
    transform: translateY(100%);
    opacity: 0;
}
#srp-pin-details-panel.is-open {
    transform: translateY(0);
    opacity: 1;
}

/* Desktop: slide-in lateral direita */
@media (min-width: 900px) {
    #srp-pin-details-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: clamp(420px, 36vw, 520px);
        max-width: 520px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border-right-width: 0;
        border-top-width: 0;
        border-bottom-width: 0;
        transform: translateX(100%);
    }
    #srp-pin-details-panel.is-open {
        transform: translateX(0);
    }
}

/* Telas muito largas: pin no canto, deixa respiração mínima do mapa */
@media (min-width: 1600px) {
    #srp-pin-details-panel {
        width: 560px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   HEADER STICKY com botão Fechar
   ───────────────────────────────────────────────────────────────────── */
.srp-pdp-head {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px 12px;
    background: linear-gradient(180deg, rgba(15, 38, 32, 0.92) 0%, rgba(11, 22, 18, 0.86) 100%);
    border-bottom: 1px solid rgba(212, 173, 90, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-shrink: 0;
}
.srp-pdp-head-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.srp-pdp-head-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(212, 173, 90, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #D4AD5A;
    flex-shrink: 0;
}
.srp-pdp-head-icon svg {
    width: 16px;
    height: 16px;
}
.srp-pdp-head-eyebrow {
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #D4AD5A;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 3px;
}
.srp-pdp-head-sub {
    font-size: 12px;
    color: #9CAFA2;
    font-style: italic;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.srp-pdp-head-txt { min-width: 0; }

/* ── Botão FECHAR (X) — alto contraste, hitbox 44×44 (touch standard) ── */
.srp-pdp-close {
    width: 44px;
    height: 44px;
    border: 2px solid #D4AD5A;
    background: #D4AD5A;
    color: #0B1612;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition:
        background 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease,
        transform 0.1s ease,
        box-shadow 0.16s ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
    padding: 0;
}
.srp-pdp-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
}
.srp-pdp-close:hover {
    background: #E8C26E;
    border-color: #E8C26E;
    color: #0B1612;
    box-shadow:
        0 0 0 4px rgba(232, 194, 110, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.18) inset;
}
.srp-pdp-close:active {
    transform: scale(0.94);
}
.srp-pdp-close:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px #060C0A,
        0 0 0 6px #E8C26E;
}

/* ─────────────────────────────────────────────────────────────────────────
   CORPO SCROLLÁVEL — articulação tipo blog post
   ───────────────────────────────────────────────────────────────────── */
.srp-pdp-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    /* iOS momentum scroll */
    -webkit-overflow-scrolling: touch;
    /* Padding bottom respeita safe-area do iPhone */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Scrollbar fina dourada (consistente com identidade do painel) */
.srp-pdp-body::-webkit-scrollbar {
    width: 8px;
}
.srp-pdp-body::-webkit-scrollbar-track {
    background: rgba(212, 173, 90, 0.04);
}
.srp-pdp-body::-webkit-scrollbar-thumb {
    background: rgba(212, 173, 90, 0.32);
    border-radius: 4px;
}
.srp-pdp-body::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 173, 90, 0.55);
}

/* ── HERO da propriedade (imagem destaque + título + categoria) ──────── */
.srp-pdp-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background:
        linear-gradient(180deg, rgba(11, 22, 18, 0) 0%, rgba(11, 22, 18, 0.85) 100%),
        linear-gradient(135deg, #142822 0%, #0F2620 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    flex-shrink: 0;
}
.srp-pdp-hero[data-empty="1"] {
    aspect-ratio: 4 / 1.4;
    background:
        linear-gradient(135deg, rgba(212, 173, 90, 0.08) 0%, rgba(212, 173, 90, 0) 100%),
        linear-gradient(135deg, #142822 0%, #0F2620 100%);
}
.srp-pdp-hero-overlay {
    position: absolute;
    inset: 0;
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
}
.srp-pdp-hero-eyebrow {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #E8C26E;
    font-weight: 700;
    line-height: 1;
    padding: 5px 10px;
    background: rgba(11, 22, 18, 0.75);
    border-radius: 3px;
    align-self: flex-start;
    border-left: 2px solid var(--pdp-cor, #D4AD5A);
}
.srp-pdp-hero-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(22px, 4.4vw, 28px);
    font-weight: 600;
    color: #F8F3E6;
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}
.srp-pdp-hero-owner {
    font-size: 13px;
    color: #C4D2C8;
    margin: 4px 0 0;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
}
.srp-pdp-hero-owner strong {
    font-weight: 600;
    color: #F2EDE0;
}

/* Quando não tem imagem: hero menor, fundo gradiente sólido */
.srp-pdp-hero[data-empty="1"] .srp-pdp-hero-overlay {
    background: transparent;
}

/* ── Conteúdo principal abaixo do hero ────────────────────────────────── */
.srp-pdp-content {
    padding: 22px 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

@media (min-width: 900px) {
    .srp-pdp-content {
        padding: 24px 24px 32px;
        gap: 24px;
    }
}

/* ── Galeria de imagens (carrossel horizontal) ────────────────────────── */
.srp-pdp-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
    margin-bottom: 4px;
}
.srp-pdp-gallery-item {
    margin: 0;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #142822;
    cursor: zoom-in;
    border: 1px solid rgba(212, 173, 90, 0.12);
    transition: border-color 0.16s ease, transform 0.12s ease;
}
.srp-pdp-gallery-item:hover {
    border-color: rgba(212, 173, 90, 0.45);
    transform: translateY(-1px);
}
.srp-pdp-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.srp-pdp-gallery-item:hover img {
    transform: scale(1.04);
}

/* ── Bloco "Sobre" — descrição longa em prosa ─────────────────────────── */
.srp-pdp-section {
    border-left: 2px solid rgba(212, 173, 90, 0.28);
    padding: 0 0 0 14px;
}
.srp-pdp-section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #D4AD5A;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1;
}
.srp-pdp-section-text {
    font-size: 14.5px;
    line-height: 1.6;
    color: #E0D9CB;
    margin: 0;
}
.srp-pdp-section-text p { margin: 0 0 0.85em; }
.srp-pdp-section-text p:last-child { margin-bottom: 0; }
.srp-pdp-section-empty {
    font-size: 13px;
    color: #7E8E84;
    font-style: italic;
}

/* ── Bloco "Informações" — dl de pares chave/valor ────────────────────── */
.srp-pdp-info {
    background: #142822;
    border-radius: 10px;
    border: 1px solid rgba(212, 173, 90, 0.12);
    padding: 14px 16px;
}
.srp-pdp-info-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #D4AD5A;
    font-weight: 700;
    margin: 0 0 10px;
    line-height: 1;
}
.srp-pdp-dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px 16px;
    margin: 0;
}
@media (min-width: 460px) {
    .srp-pdp-dl {
        grid-template-columns: max-content 1fr;
        align-items: baseline;
    }
}
.srp-pdp-dl dt {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9CAFA2;
    font-weight: 600;
    margin: 0;
}
.srp-pdp-dl dd {
    font-size: 14px;
    color: #F2EDE0;
    margin: 0 0 6px;
    line-height: 1.45;
    word-break: break-word;
}
@media (min-width: 460px) {
    .srp-pdp-dl dd { margin-bottom: 0; }
}
.srp-pdp-dl a {
    color: #E8C26E;
    text-decoration: none;
    border-bottom: 1px dotted rgba(232, 194, 110, 0.45);
    transition: color 0.16s ease, border-color 0.16s ease;
}
.srp-pdp-dl a:hover {
    color: #FFD08A;
    border-bottom-color: rgba(255, 208, 138, 0.85);
}

/* ── Bloco de ações (WhatsApp / Site / Maps / Compartilhar) ───────────── */
.srp-pdp-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
@media (min-width: 520px) {
    .srp-pdp-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}
.srp-pdp-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid rgba(212, 173, 90, 0.30);
    border-radius: 8px;
    color: #C4D2C8;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.1s ease;
    min-height: 44px;
}
.srp-pdp-action-btn:hover {
    background: rgba(212, 173, 90, 0.10);
    border-color: rgba(212, 173, 90, 0.55);
    color: #F2EDE0;
}
.srp-pdp-action-btn:active {
    transform: scale(0.98);
}
.srp-pdp-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.srp-pdp-action-btn--wpp {
    background: #25D366;
    border-color: #25D366;
    color: #0B1612;
    font-weight: 600;
}
.srp-pdp-action-btn--wpp:hover {
    background: #2AE074;
    border-color: #2AE074;
    color: #0B1612;
}
.srp-pdp-action-btn--share {
    background: rgba(212, 173, 90, 0.10);
    border-color: rgba(212, 173, 90, 0.45);
    color: #E8C26E;
}
.srp-pdp-action-btn--share:hover {
    background: rgba(212, 173, 90, 0.20);
    border-color: rgba(212, 173, 90, 0.70);
    color: #FFD08A;
}

/* Feedback efêmero do botão Compartilhar */
.srp-pdp-action-btn.is-feedback-ok {
    background: rgba(67, 233, 123, 0.18) !important;
    border-color: rgba(67, 233, 123, 0.60) !important;
    color: #43E97B !important;
}

/* ── Rodapé com URL canônica (estilo "manifesto") ──────────────────────── */
.srp-pdp-foot {
    padding: 14px 0 0;
    margin-top: 8px;
    border-top: 1px dashed rgba(212, 173, 90, 0.18);
}
.srp-pdp-foot-lbl {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7E8E84;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}
.srp-pdp-foot-url {
    display: block;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-size: 11px;
    color: #C4D2C8;
    background: rgba(212, 173, 90, 0.04);
    border: 1px solid rgba(212, 173, 90, 0.10);
    border-radius: 6px;
    padding: 8px 10px;
    word-break: break-all;
    line-height: 1.4;
}

/* ─────────────────────────────────────────────────────────────────────────
   ESTADO VAZIO (pin não encontrado)
   ───────────────────────────────────────────────────────────────────── */
.srp-pdp-empty {
    padding: 40px 24px;
    text-align: center;
    color: #9CAFA2;
}
.srp-pdp-empty h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 18px;
    color: #E8C26E;
    margin: 0 0 8px;
}
.srp-pdp-empty p {
    font-size: 13.5px;
    line-height: 1.5;
    margin: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   Atalhos de acessibilidade: respeita preferência de reduzir movimento
   ───────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #srp-pin-details-panel,
    #srp-pin-details-backdrop,
    .srp-pdp-gallery-item,
    .srp-pdp-gallery-item img,
    .srp-pdp-action-btn,
    .srp-pdp-close {
        transition-duration: 0.01ms !important;
    }
}
