/* Panorama360 — visualizador de fotos 360° (Samuel Lima Corretor) */
.p360 { --p360-navy: #1A365D; --p360-navy2: #0F2A40; --p360-ouro: #D4AF37; position: relative; overflow: hidden; background: #071626; color: #fff; border-radius: 16px; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; font-family: inherit; }
.p360-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline: none; transition: opacity .16s ease; }
.p360-canvas:active { cursor: grabbing; }
.p360-editavel .p360-canvas { cursor: crosshair; }
.p360-trocando .p360-canvas { opacity: 0; }

/* Barra de modos (no estilo do DJI Fly: ícone em cima, nome embaixo, ativo em dourado) */
.p360-barra { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 2px; padding: 8px 10px 6px; background: rgba(10, 14, 20, .58); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 14px; z-index: 4; max-width: calc(100% - 20px); }
.p360-modo { appearance: none; border: 0; background: transparent; color: #fff; font: 500 .82rem/1.1 inherit; padding: 2px 12px; border-radius: 10px; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; min-width: 66px; transition: color .2s ease; }
.p360-modo-ico { width: 28px; height: 28px; display: block; }
.p360-modo-ico svg { width: 100%; height: 100%; display: block; }
.p360-modo:hover { color: #FFE9A8; }
.p360-modo[aria-pressed="true"] { color: #F2C230; }
.p360-modo:focus-visible, .p360-btn:focus-visible, .p360-pino:focus-visible { outline: 2px solid var(--p360-ouro); outline-offset: 2px; }
@media (max-width: 380px) { .p360-modo { min-width: 0; padding: 2px 8px; font-size: .74rem; } .p360-modo-ico { width: 24px; height: 24px; } }

.p360-btn { position: absolute; z-index: 4; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(10, 14, 20, .5); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 9px; }
.p360-btn svg { width: 100%; height: 100%; }
.p360-btn:hover { background: rgba(26, 54, 93, .9); }
.p360-tela { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.p360-fechar { top: max(12px, env(safe-area-inset-top)); left: 12px; }

/* Dica e carregamento */
.p360-dica { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3; background: rgba(7, 22, 38, .72); padding: 7px 14px; border-radius: 999px; font-size: .8rem; white-space: nowrap; pointer-events: none; transition: opacity .5s ease; max-width: calc(100% - 110px); overflow: hidden; text-overflow: ellipsis; }
.p360-dica i { color: var(--p360-ouro); }
.p360-some { opacity: 0 !important; pointer-events: none !important; }
.p360-carregando { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #000; transition: opacity .4s ease; text-align: center; padding: 20px; }
.p360-carregando > * { position: relative; }
.p360-carregando-txt { font-size: .9rem; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.p360-spin { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--p360-ouro); animation: p360gira 0.9s linear infinite; }
@keyframes p360gira { to { transform: rotate(360deg); } }

/* Pinos (marcações) */
.p360-pinos { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.p360-pino { --cor: #D4AF37; position: absolute; left: 0; top: 0; pointer-events: auto; appearance: none; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; transform-origin: 0 0; will-change: transform; }
.p360-pino-ponto { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--cor); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(212,175,55,.7), 0 2px 8px rgba(0,0,0,.45); animation: p360pulso 2s infinite; }
@keyframes p360pulso { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.65), 0 2px 8px rgba(0,0,0,.45); } 70% { box-shadow: 0 0 0 14px rgba(255,255,255,0), 0 2px 8px rgba(0,0,0,.45); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0), 0 2px 8px rgba(0,0,0,.45); } }
.p360-pino-tag { position: absolute; left: 0; bottom: 14px; transform: translateX(-50%); background: #fff; color: #0F2A40; font-weight: 700; font-size: .82rem; line-height: 1.2; padding: 6px 10px; border-radius: 10px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.35); border-bottom: 3px solid var(--cor); max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.p360-pino-tag b { color: #8a6d12; font-weight: 800; margin-left: 4px; }
.p360-pino:hover .p360-pino-tag { background: #FFF8E1; }
.p360-editavel .p360-pino { cursor: move; touch-action: none; }

/* Cartão do pino */
.p360-popup { position: absolute; z-index: 5; left: 50%; bottom: 66px; transform: translateX(-50%); width: min(340px, calc(100% - 24px)); background: #fff; color: #1A2433; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.p360-popup-fechar { position: absolute; top: 6px; right: 8px; z-index: 1; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(15, 42, 64, .75); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.p360-popup-foto { display: block; width: 100%; height: 140px; object-fit: cover; }
.p360-popup-corpo { padding: 12px 14px 14px; }
.p360-popup-tit { font-weight: 800; font-size: 1rem; color: #0F2A40; padding-right: 30px; }
.p360-popup-preco { font-weight: 800; color: #8a6d12; margin-top: 2px; }
.p360-popup-txt { font-size: .86rem; color: #4a5568; margin-top: 6px; line-height: 1.45; }
.p360-popup-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; background: #1A365D; color: #fff !important; text-decoration: none; font-weight: 700; font-size: .86rem; padding: 9px 14px; border-radius: 10px; }
.p360-popup-btn:hover { background: #0F2A40; }

/* Tela cheia (inclusive iPhone, que não tem fullscreen de elemento) */
.p360:fullscreen { border-radius: 0; width: 100vw; height: 100vh; }
.p360.p360-fixo { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100dvh !important; height: 100vh; z-index: 100000; border-radius: 0; }
html.p360-travado, html.p360-travado body { overflow: hidden; }
.p360-sem-webgl .p360-barra, .p360-sem-webgl .p360-dica { display: none; }
@media (prefers-reduced-motion: reduce) { .p360-pino-ponto { animation: none; } .p360-canvas { transition: none; } }

/* Cartão "Ver em 360°" (página do imóvel e da cidade) */
.p360-cartao { position: relative; display: block; width: 100%; border: 0; padding: 0; border-radius: 16px; overflow: hidden; background: #071626; cursor: pointer; aspect-ratio: 16 / 9; }
.p360-cartao img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.p360-cartao:hover img { transform: scale(1.04); }
.p360-cartao-sombra { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,22,38,0) 35%, rgba(7,22,38,.85) 100%); }
.p360-cartao-selo { position: absolute; top: 12px; left: 12px; background: #D4AF37; color: #0F2A40; font-weight: 800; font-size: .8rem; padding: 6px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.p360-cartao-acao { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px; color: #fff; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p360-cartao-acao strong { display: block; font-size: 1.05rem; line-height: 1.25; }
.p360-cartao-acao small { color: #C7D2E2; }
.p360-cartao-play { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.95); color: #0F2A40; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.p360-palco { width: 100%; height: min(70vh, 560px); min-height: 360px; }
@media (max-width: 576px) { .p360-palco { height: 72vh; min-height: 420px; } }

/* Prévia em tela inteira (cartão do imóvel/cidade e página /360) */
.p360-overlay { position: fixed; inset: 0; z-index: 100001; background: #000; }
.p360-overlay .p360 { position: absolute; inset: 0; border-radius: 0; }
.p360-overlay-topo { position: absolute; left: 64px; right: 64px; top: max(16px, env(safe-area-inset-top)); z-index: 5; color: #fff; text-align: center; pointer-events: none; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.p360-overlay-topo strong { display: block; font-size: .95rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p360-overlay-topo small { font-size: .72rem; opacity: .85; }
.p360-overlay-acoes { position: absolute; right: 12px; top: calc(max(12px, env(safe-area-inset-top)) + 50px); z-index: 5; display: flex; flex-direction: column; gap: 10px; }
.p360-overlay-acoes a, .p360-overlay-acoes button { position: static; }
.p360-overlay-acoes .p360-zap { background: #25D366; }

/* Na prévia em tela cheia, a dica fica abaixo do título (não encavala) */
.p360-overlay .p360-dica { top: calc(max(16px, env(safe-area-inset-top)) + 58px); }
/* Com o cartão do imóvel aberto, a barra de modos some (não fica atrás do cartão) */
.p360:has(.p360-popup:not([hidden])) .p360-barra { opacity: 0; pointer-events: none; }
/* Selo Vende-se / Aluga-se / Vendido */
.p360-selo { display: inline-block; background: #D4AF37; color: #0F2A40; font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; line-height: 1.3; }
.p360-selo-off { background: #C62828; color: #fff; }
.p360-popup .p360-selo { margin: 0 0 6px; font-size: .72rem; }
