/**
 * Mapa de assentos — CSS achatado do CodePen (SCSS aninhado .aircraft).
 * Resets de box-sizing/img por causa das regras globais do site.
 * Tiers / .selected / heatmap mantêm o estudo interativo.
 */

/* IMPORTANT: globais do site que quebram o pen:
   `* { box-sizing: border-box }`, `img { filter; width: 100% }` — neutralizar na árvore .aircraft */
.aircraft,
.aircraft *,
.aircraft *::before,
.aircraft *::after {
    box-sizing: content-box;
}

.aircraft img {
    width: auto;
    height: auto;
    max-width: none;
    filter: none;
    display: block;
}

.aircraft-body .top-left-exists img,
.aircraft-body .top-right-exists img,
.aircraft-body .bottom-left-exists img,
.aircraft-body .bottom-right-exists img,
.aircraft .exists img {
    width: 30px;
}

.aircraft-head-body .windows img {
    width: 110px;
}

.aircraft-head-body .front-lavatory img,
.aircraft-tail-body .back-lavatory img {
    width: 28px;
}

.aircraft-wrap {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 160px 0;
    margin: 0 -1rem 2rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
    -webkit-mask-image: linear-gradient(to right,
        transparent 0%,
        black 4%,
        black 96%,
        transparent 100%);
    mask-image: linear-gradient(to right,
        transparent 0%,
        black 4%,
        black 96%,
        transparent 100%);
}

.aircraft-wrap::-webkit-scrollbar { height: 10px; }
.aircraft-wrap::-webkit-scrollbar-track { background: transparent; }

.aircraft-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 5px;
    transition: background-color 0.15s ease;
}

.aircraft-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.32);
}

.aircraft-wrap:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 4px;
}

/* ----- Reference .aircraft { … } (achatado) + padding horizontal para scroll ----- */
.aircraft {
    position: relative;
    margin: 80px auto;
    background: #fff;
    transform: scale(0.8);
    transform-origin: center center;
    width: max-content;
    box-sizing: content-box;
    padding-left: 100px;
    padding-right: 600px;
    /* Altura do nariz/cauda = tubo: definida em JS (syncFuselageEllipses). Fallback até layout. */
    --aircraft-ellipse-height: 280px;
}

/* flex-start: altura = assentos + corredor 16px; space-between desalinhava nariz/cauda. */
.aircraft-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    position: relative;
    min-width: min-content;
    min-height: min-content;
    margin: auto;
    border: 2px solid #c5c5c7;
    border-right: none;
    border-left: none;
    padding: 8px;
    background: #fff;
    left: 250px;
}

.aircraft-body .top-left-exists {
    position: absolute;
    left: -42px;
    top: -35px;
}

.aircraft-body .top-right-exists {
    position: absolute;
    right: -42px;
    top: -35px;
}

.aircraft-body .bottom-right-exists {
    position: absolute;
    transform: rotate(180deg);
    right: -42px;
    bottom: -35px;
}

.aircraft-body .bottom-left-exists {
    position: absolute;
    transform: rotate(180deg);
    left: -42px;
    bottom: -35px;
}

.aircraft-body .seats {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.aircraft-body .seats:first-child {
    margin-bottom: 16px;
}

.aircraft-body .seats-triple {
    margin-right: 20px;
}

.aircraft-body .seats-triple::before {
    content: attr(data-line);
    position: relative;
    text-align: center;
    font-family: tahoma, sans-serif;
    left: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

[data-theme="dark"] .aircraft-body .seats-triple::before {
    color: var(--text-tertiary);
}

/* JS só define data-line na fileira inferior; evita pseudo vazio em cima */
.aircraft-body .seats:first-child .seats-triple::before {
    content: none;
}

.aircraft-body .seat {
    display: block;
    cursor: pointer;
    border: solid 1px #88857c;
    width: 39px;
    height: 31px;
    border-radius: 4px;
    padding: 1px;
    margin-top: 5px;
    background: #fff;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    color: inherit;
    font-family: tahoma, sans-serif;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.aircraft-body .seat::before {
    content: "";
    display: block;
    width: 30px;
    height: 24px;
    border: solid 1px #88857c;
    margin: 2px -2px;
    border-left: none;
    border-radius: 0 5px 5px 0;
}

.aircraft-body .seat::after {
    position: relative;
    content: attr(data-letter);
    font-family: tahoma, sans-serif;
    top: -25px;
}

.aircraft-body .seat:not(.empty)::after {
    font-weight: 700;
    font-size: 11px;
    color: rgba(28, 28, 28, 0.88);
}

[data-theme="dark"] .aircraft-body .seat:not(.empty)::after {
    color: rgba(252, 252, 252, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.aircraft-body .seats-triple.first-line .seat::after {
    left: -25px;
}

.aircraft-body .seats-triple.last-line .seat::after {
    right: -52px;
}

.aircraft-body .seat.empty::after {
    content: none;
}

/* Faixas de preço (equiv. ao pen só com .active em #ffe2ae) */
.aircraft-body .seat.tier-budget   { background: var(--seat-budget); }
.aircraft-body .seat.tier-economy  { background: var(--seat-economy); }
.aircraft-body .seat.tier-standard { background: var(--seat-standard); }
.aircraft-body .seat.tier-plus     { background: var(--seat-plus); }
.aircraft-body .seat.tier-premium  { background: var(--seat-premium); }

.aircraft-body .seat.empty {
    background: var(--seat-empty);
    cursor: default;
}

.aircraft-body .seat.empty::before {
    border-style: dashed;
}

.aircraft-body .seat:not(.empty):hover,
.aircraft-body .seat:not(.empty):focus-visible {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    filter: brightness(1.05);
    outline: none;
    z-index: 2;
}

.aircraft-body .seat.selected:not(.empty) {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 0 0 2px #333, 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 3;
}

.estudo-view--heatmap .aircraft-body .seat:not(.empty)::before {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .estudo-view--heatmap .aircraft-body .seat:not(.empty)::before {
    background: rgba(255, 255, 255, 0.1);
}

.aircraft .exists {
    display: flex;
    justify-content: space-evenly;
    align-items: flex-end;
    position: relative;
    left: -280px;
}

.aircraft-top-wing {
    position: absolute;
    width: 250px;
    height: 200px;
    top: -202px;
    left: 50%;
}

.aircraft-top-wing .exists {
    top: 170px;
}

/* -4px: borda da asa sobrepõe a do tubo (mesma linha, sem degrau nem duplicado). */
.aircraft-top-wing::before {
    content: "";
    position: absolute;
    bottom: -4px;
    width: 250px;
    height: 200px;
    border: 2px solid #c5c5c7;
    z-index: 0;
    border-bottom-left-radius: 30px;
    border-right: none;
    border-top: none;
}

.aircraft-top-wing::after {
    content: "";
    position: absolute;
    width: 250px;
    height: 200px;
    border: 2px solid #c5c5c7;
    border-bottom-right-radius: 60px;
    border-top: none;
    border-left: none;
    transform: skew(-35deg);
    left: -500px;
    bottom: -4px;
}

.aircraft-bottom-wing {
    position: absolute;
    width: 250px;
    height: 200px;
    bottom: -202px;
    left: 50%;
}

.aircraft-bottom-wing .exists {
    top: 5px;
    transform: rotate(180deg);
}

.aircraft-bottom-wing::before {
    content: "";
    position: absolute;
    top: -4px;
    width: 250px;
    height: 200px;
    border: 2px solid #c5c5c7;
    z-index: 0;
    border-top-left-radius: 30px;
    border-right: none;
    border-bottom: none;
}

.aircraft-bottom-wing::after {
    content: "";
    position: absolute;
    width: 250px;
    height: 200px;
    border: 2px solid #c5c5c7;
    border-top-right-radius: 60px;
    border-bottom: none;
    border-left: none;
    transform: skew(35deg);
    left: -500px;
    top: -4px;
}

/* Nácelo: só silhueta em traço (vista superior), alinhada ao sweep da asa */
.aircraft-engine {
    position: absolute;
    display: block;
    width: 28px;
    height: 17px;
    border: 1.5px solid #c5c5c7;
    border-radius: 50%;
    box-sizing: border-box;
    background: transparent;
    z-index: 2;
    pointer-events: none;
}

[data-theme="dark"] .aircraft-engine {
    border-color: #8a8d92;
}

.aircraft-top-wing .aircraft-engine {
    bottom: 68px;
    left: -122px;
    transform: skewX(-35deg);
}

.aircraft-bottom-wing .aircraft-engine {
    top: 68px;
    left: -122px;
    transform: skewX(35deg);
}

.aircraft-head {
    position: absolute;
    height: var(--aircraft-ellipse-height);
    width: 330px;
    margin: auto;
    overflow: hidden;
    top: 0;
    left: -326px;
}

.aircraft-head-body {
    position: absolute;
    height: var(--aircraft-ellipse-height);
    width: 548px;
    padding-left: 115px;
    border-radius: 50%;
    right: -343px;
    border: 2px solid #c5c5c7;
    background: transparent;
}

.aircraft-head-body .windows {
    position: absolute;
    top: 70px;
    left: 50px;
}

.aircraft-head-body .front-lavatory {
    position: absolute;
    bottom: 15px;
    left: 220px;
}

.aircraft-tail {
    position: absolute;
    height: var(--aircraft-ellipse-height);
    width: 700px;
    margin: auto;
    overflow: hidden;
    top: 0;
    right: -320px;
    padding-left: 121px;
    z-index: 0;
}

.aircraft-tail-body {
    position: absolute;
    height: var(--aircraft-ellipse-height);
    width: 548px;
    padding-left: 135px;
    border-radius: 50%;
    border: 2px solid #c5c5c7;
    background: transparent;
    /* Metade esquerda fora: só o arco voltado ao tubo; não cobre os assentos. */
    clip-path: inset(0 0 0 50%);
    -webkit-clip-path: inset(0 0 0 50%);
}

.aircraft-tail-body .back-lavatory {
    width: 40px;
    height: 98%;
    display: flex;
    justify-content: space-around;
    flex-direction: column;
    margin-left: calc(50% + 12px);
}

/* Tooltip */
.seat-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.3;
    min-width: 120px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 50;
    white-space: nowrap;
}

.seat-tooltip[hidden] { display: none; }

.seat-tooltip .tt-head {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.15rem;
}

.seat-tooltip .tt-price {
    font-size: 1.05rem;
    font-weight: 600;
}

.seat-tooltip .tt-tier {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.15rem;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .aircraft {
        transform: scale(0.55);
        padding-left: 60px;
        padding-right: 400px;
    }

    .aircraft-wrap {
        padding: 130px 16px;
        max-height: 70vh;
    }
}
