﻿@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500;700&family=Syncopate:wght@400;700&display=swap');

/* CSS variables for the cinematic theme */
:root {
  --bg-color: #A1BAD3;
  --panel-bg: rgba(235, 248, 248, 0.7);
  --text-color: #1e4b57;
  --accent-color: #3aa7b3;
  --accent-hover-color: #59c1cb;
  --active-border-color: rgba(70, 170, 180, 0.6);
  --shadow-color: rgba(10, 40, 45, 0.25);
  --glass-bg: rgba(246, 252, 252, 0.76);
  --glass-border: rgba(120, 190, 200, 0.25);
  --glass-highlight: rgba(255, 255, 255, 0.85);
  --glass-shadow: rgba(16, 40, 45, 0.18);
}

/* Basic reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* Container for the 3D scene */
#container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

#loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg-color);
  color: #0b5b6c;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  z-index: 20;
  opacity: 1;
  transition: opacity 0.35s ease;
}

#loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-percent {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.loading-bar {
  width: 140px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #0b5b6c;
  overflow: hidden;
  background: transparent;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: #0b5b6c;
  border-radius: inherit;
  transition: width 0.2s ease;
}

/* Model selection panel */
.model-selection {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  padding: 15px 25px;
  background: var(--glass-bg);
  border-radius: 22px;
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow:
    0 18px 40px var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  z-index: 10;
  border: 1px solid var(--glass-border);
}

/* Round buttons */
.model-btn {
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  background: linear-gradient(160deg, rgba(12, 24, 40, 0.95), rgba(28, 60, 90, 0.8));
  color: #d9f2ff;
  border: 1px solid rgba(140, 220, 255, 0.4);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  box-shadow:
    0 10px 22px rgba(2, 8, 20, 0.65),
    inset 0 2px 10px rgba(140, 220, 255, 0.18);
  outline: none;
  backdrop-filter: blur(8px);
}

.model-btn:hover {
  background: linear-gradient(160deg, rgba(24, 50, 78, 0.98), rgba(60, 120, 165, 0.8));
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 12px 26px rgba(2, 10, 28, 0.65);
}

.model-btn.active {
  background: linear-gradient(160deg, rgba(30, 80, 120, 0.95), rgba(90, 190, 240, 0.75));
  transform: scale(1.1);
  box-shadow: 0 14px 30px rgba(8, 18, 35, 0.7);
  border: 2px solid var(--active-border-color);
}

/* Overlay for transitions */
#transition-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(220, 240, 240, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-in-out;
  z-index: 6;
}

.label-popup {
  position: fixed;
  z-index: 12;
  width: min(86vw, 430px);
  max-height: 62vh;
  padding: 18px 20px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #2c3b45;
  box-shadow: 0 18px 35px rgba(2, 12, 24, 0.4);
  border: 1px solid rgba(160, 190, 210, 0.4);
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.label-popup.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.label-popup-header {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.label-popup.is-dragging .label-popup-header {
  cursor: grabbing;
}

.label-popup.is-pinned {
  border-color: rgba(58, 167, 179, 0.85);
}

.label-popup.is-pinned .label-popup-header {
  cursor: default;
}

.label-popup-title {
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2f4b5f;
}

.label-popup-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #0b5b6c;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.label-popup-toggle {
  border: 1px solid rgba(160, 190, 210, 0.6);
  background: rgba(255, 255, 255, 0.95);
  color: #0b5b6c;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.label-popup-pin {
  border: 1px solid rgba(160, 190, 210, 0.6);
  background: rgba(255, 255, 255, 0.95);
  color: #0b5b6c;
  border-radius: 999px;
  min-height: 24px;
  padding: 0 10px;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.label-popup-pin.is-active {
  background: #0b5b6c;
  color: #ffffff;
  border-color: #0b5b6c;
}

.label-popup-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(62vh - 90px);
  overflow: auto;
  padding-right: 6px;
}

.label-popup-image {
  width: 100%;
  max-height: 300px;
  border-radius: 12px;
  display: block;
  object-fit: contain;
  background: rgba(237, 243, 246, 0.85);
}

.label-popup-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #47545f;
  white-space: pre-line;
}

.label-popup.is-collapsed .label-popup-content {
  display: none;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 24, 0.65);
  cursor: pointer;
}

.tutorial-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 700px);
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  background: rgba(245, 251, 255, 0.98);
  border: 1px solid rgba(130, 170, 195, 0.75);
  box-shadow: 0 24px 48px rgba(2, 10, 20, 0.55);
  padding: 30px 36px 26px;
  color: #173241;
  pointer-events: auto;
}

.welcome-section {
  margin-bottom: 4px;
}

.welcome-section h2 {
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
  color: #0b5b6c;
}

.welcome-subtitle {
  font-size: 0.88rem;
  font-weight: 700;
  color: #173241;
  margin-bottom: 14px;
}

.welcome-step {
  font-size: 0.88rem;
  line-height: 1.52;
  color: #2b4553;
  margin-bottom: 9px;
}

.welcome-divider {
  border: none;
  border-top: 1px solid rgba(120, 180, 200, 0.4);
  margin: 18px 0;
}

.tutorial-lang-switcher {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(120, 180, 200, 0.35);
}

.tutorial-lang-btn {
  background: rgba(11, 91, 108, 0.08) !important;
  border-color: rgba(11, 91, 108, 0.3) !important;
  color: #0b5b6c !important;
  box-shadow: 0 2px 6px rgba(2, 8, 20, 0.12) !important;
  backdrop-filter: none !important;
}

.tutorial-lang-btn:hover {
  background: rgba(11, 91, 108, 0.15) !important;
  border-color: rgba(11, 91, 108, 0.6) !important;
  color: #083f4d !important;
}

.tutorial-lang-btn.active {
  background: rgba(11, 91, 108, 0.18) !important;
}

.tutorial-lang-btn.lang-pt.active { color: #1a7a2a !important; border-color: rgba(50, 160, 60, 0.7) !important; box-shadow: 0 0 6px rgba(50, 160, 60, 0.25), 0 2px 6px rgba(2, 8, 20, 0.12) !important; }
.tutorial-lang-btn.lang-en.active { color: #1a5bbf !important; border-color: rgba(60, 110, 220, 0.7) !important; box-shadow: 0 0 6px rgba(60, 110, 220, 0.25), 0 2px 6px rgba(2, 8, 20, 0.12) !important; }
.tutorial-lang-btn.lang-es.active { color: #996600 !important; border-color: rgba(200, 140, 10, 0.7) !important; box-shadow: 0 0 6px rgba(200, 140, 10, 0.25), 0 2px 6px rgba(2, 8, 20, 0.12) !important; }

.tutorial-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

#tutorial-close {
  border-radius: 999px;
  padding: 10px 36px;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: 1px solid #0b5b6c;
  background: #0b5b6c;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  text-transform: uppercase;
}

#tutorial-close:hover {
  background: #0e7080;
  transform: translateY(-1px);
}

.zoom-reset {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 11;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(140, 220, 255, 0.5);
  background: rgba(6, 14, 24, 0.75);
  color: #d9f2ff;
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 12px 24px rgba(2, 10, 20, 0.6);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.zoom-reset:hover {
  transform: translateY(-2px);
  background: rgba(14, 30, 48, 0.85);
  box-shadow: 0 16px 30px rgba(2, 10, 20, 0.7);
}

#transition-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.label-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(260px, 36vw);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(245, 252, 252, 0.88);
  border-left: 1px solid rgba(140, 190, 200, 0.35);
  box-shadow: -10px 0 24px rgba(10, 40, 45, 0.18);
  z-index: 12;
  overflow-y: auto;
}

.label-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.label-main,
.label-plus {
  border: 1px solid rgba(120, 180, 200, 0.4);
  background: rgba(255, 255, 255, 0.86);
  color: #1f4b57;
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.label-main {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.7rem;
  text-align: left;
  box-shadow: 0 6px 16px rgba(12, 24, 40, 0.12);
}

.label-plus {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(12, 24, 40, 0.12);
}

.label-item.is-loaded .label-main,
.label-item.is-loaded .label-plus {
  border-color: rgba(58, 167, 179, 0.6);
}

.label-item.is-active .label-main {
  background: rgba(58, 167, 179, 0.18);
  box-shadow: 0 10px 20px rgba(12, 40, 48, 0.2);
  transform: translateY(-1px);
}

.label-main:hover,
.label-plus:hover {
  background: rgba(220, 245, 246, 0.95);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .label-panel {
    width: min(200px, 46vw);
    padding: 14px 12px;
  }
  .label-main {
    font-size: 0.65rem;
  }
}

/* Language switcher flags */
#lang-switcher {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 11;
}

.lang-btn {
  width: 38px;
  height: 28px;
  border-radius: 6px;
  border: 1.5px solid rgba(140, 200, 215, 0.35);
  background: rgba(8, 18, 30, 0.78);
  cursor: pointer;
  font-family: 'Syncopate', 'Space Grotesk', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #b8dce8;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  box-shadow: 0 3px 10px rgba(2, 8, 20, 0.45);
  padding: 0;
  backdrop-filter: blur(8px);
}

.lang-btn:hover {
  transform: scale(1.08);
  color: #e8f6ff;
  border-color: rgba(90, 200, 220, 0.6);
}

.lang-btn.active {
  border-color: rgba(90, 200, 220, 0.9);
  color: #4fd8e8;
  box-shadow: 0 0 8px rgba(70, 200, 220, 0.4), 0 3px 10px rgba(2, 8, 20, 0.45);
}

/* Country accent colors */
.lang-btn.lang-pt.active { color: #5de86a; border-color: rgba(50, 200, 80, 0.8); box-shadow: 0 0 8px rgba(50, 200, 80, 0.35), 0 3px 10px rgba(2, 8, 20, 0.45); }
.lang-btn.lang-en.active { color: #5eaaff; border-color: rgba(60, 140, 255, 0.8); box-shadow: 0 0 8px rgba(60, 140, 255, 0.35), 0 3px 10px rgba(2, 8, 20, 0.45); }
.lang-btn.lang-es.active { color: #ffcc44; border-color: rgba(255, 180, 30, 0.8); box-shadow: 0 0 8px rgba(255, 180, 30, 0.35), 0 3px 10px rgba(2, 8, 20, 0.45); }

/* lang-switcher mobile handled in the main mobile block below */

.corner-logo {
  position: fixed;
  right: 20px;
  bottom: 16px;
  width: min(20vw, 250px);
  height: auto;
  z-index: 11;
  pointer-events: none;
  user-select: none;
  opacity: 0.75;
}

/* =========================================================
   MOBILE LABEL PANELS — hidden on desktop, shown on mobile
   ========================================================= */
#mobile-label-panels {
  display: none;
}

/* =========================================================
   RESPONSIVE — tablet + phone  (≤ 900 px)
   ========================================================= */
@media (max-width: 900px) {

  /* -- Logo: muito menor no mobile -- */
  .corner-logo {
    width: min(22vw, 100px);
    right: 10px;
    bottom: 10px;
  }

  /* -- Top bar row 1: VOLTAR (esquerda) + idiomas (direita) -- */
  .zoom-reset {
    top: 10px;
    left: 10px;
    padding: 7px 13px;
    font-size: 0.6rem;
    letter-spacing: 0.07em;
    z-index: 12;
  }

  #lang-switcher {
    top: 8px;
    right: 8px;
    flex-direction: row;   /* horizontal em vez de coluna */
    gap: 4px;
    z-index: 12;
  }

  .lang-btn {
    width: 30px;
    height: 26px;
    font-size: 0.58rem;
  }

  /* -- Top bar row 2: botões de modelo (abaixo da row 1) -- */
  .model-selection {
    top: 48px;             /* empurrado para baixo da row 1 */
    left: 50%;
    transform: translateX(-50%);
    width: min(98vw, 600px);
    gap: 6px;
    padding: 7px 12px;
    border-radius: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    flex-wrap: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .model-selection::-webkit-scrollbar {
    display: none;
  }

  .model-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* -- Popup: centralizado na parte inferior -- */
  .label-popup {
    width: min(88vw, 380px);
    max-height: 36vh;
    padding: 10px 12px 12px;
    border-radius: 12px;
  }

  .label-popup-header {
    gap: 7px;
    margin-bottom: 7px;
  }

  .label-popup-title {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }

  .label-popup-body {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .label-popup-content {
    max-height: calc(36vh - 70px);
  }

  /* -- Tutorial -- */
  .tutorial-card {
    width: min(96vw, 500px);
    max-height: 88vh;
    padding: 18px 16px 16px;
  }

  .welcome-section h2 {
    font-size: 0.76rem;
  }

  .welcome-section p {
    font-size: 0.78rem;
  }

  #tutorial-close {
    padding: 9px 24px;
    font-size: 0.8rem;
  }

  /* -- Painéis de etiquetas mobile: barra horizontal no fundo -- */
  #mobile-label-panels {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 56px;        /* acima do logo */
    top: auto;           /* sem restrição de topo */
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 9;
    pointer-events: none;
    padding: 3px 6px 4px;
  }

  .mlp-section {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    pointer-events: auto;
  }

  .mlp-section.mlp-right {
    align-items: center;
  }

  .mlp-header {
    display: block;
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    font-size: 0.48rem;
    font-weight: 700;
    color: #8fdceb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 50px;
    max-width: 50px;
    text-align: right;
    flex-shrink: 0;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
    margin-bottom: 0;
    line-height: 1.2;
  }

  .mlp-col {
    display: flex;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex: 1;
    align-items: center;
    padding-bottom: 1px;
  }

  .mlp-col::-webkit-scrollbar {
    display: none;
  }

  .mlp-item {
    display: flex;
    flex-direction: row;   /* + então label, em ambas as seções */
    align-items: center;
    gap: 3px;
    flex-shrink: 0;        /* não encolher na barra horizontal */
    width: auto;
  }

  .mlp-left .mlp-item,
  .mlp-right .mlp-item {
    flex-direction: row;
  }

  .mlp-label {
    flex: none;
    background: rgba(10, 25, 40, 0.75);
    border: 1px solid rgba(125, 181, 198, 0.55);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.54rem;
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    color: #c8eaf4;
    cursor: pointer;
    line-height: 1;
    text-align: left;
    height: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backdrop-filter: blur(6px);
  }

  .mlp-item.is-active .mlp-label {
    background: rgba(20, 70, 95, 0.9);
    border-color: rgba(79, 200, 224, 0.85);
    color: #7ee8fc;
  }

  .mlp-plus {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    border: 1px solid rgba(125, 181, 198, 0.55);
    background: rgba(10, 25, 40, 0.75);
    color: #9dd8eb;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
    backdrop-filter: blur(6px);
  }

  .mlp-plus:active {
    background: rgba(20, 70, 95, 0.9);
    border-color: rgba(79, 200, 224, 0.85);
  }
}
