/**
 * nature-vr.css - Hệ thống Giao diện Thực Tế Ảo Sinh Thái Thiên Nhiên SSA101
 * Chuẩn Glassmorphism hiện đại, WCAG 2.1 Contrast, hỗ trợ Split Screen VR
 */

:root {
  --primary-emerald: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.4);
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-pink: #ec4899;
  --bg-glass: rgba(15, 23, 42, 0.75);
  --bg-glass-card: rgba(30, 41, 59, 0.7);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #090d16;
  font-family: var(--font-main);
  color: var(--text-primary);
  touch-action: none;
}

/* 3D CANVAS CONTAINER */
#vr-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#vr-canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* TOP NAVBAR */
.top-navbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 10px 20px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 15px var(--primary-glow);
}

.brand-info h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-info h1 span.badge {
  font-size: 0.7rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  outline: none;
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-pill.active {
  background: var(--primary-emerald);
  color: #000;
  font-weight: 600;
  border-color: #34d399;
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn-pill.btn-vr {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 700;
  border: none;
}

.btn-pill.btn-vr:hover {
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
}

/* LANGBAR BILINGUAL SWITCHER */
.langbar {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 20px;
  padding: 3px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  gap: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  outline: none;
}

.lang-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* BILINGUAL CARD BLOCKS */
.bilingual-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.tag-vi {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.tag-en {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.bilingual-block-vi {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.bilingual-block-en {
  color: #cbd5e1;
}

/* SKY THEME SWITCHER */
.sky-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border-glass);
}

.sky-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sky-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* BOTTOM NAVIGATION CHIPS */
.bottom-chips-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  padding: 8px 14px;
  border-radius: 30px;
  z-index: 10;
  max-width: 90vw;
  overflow-x: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.nav-chip-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 7px 13px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.nav-chip-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #fff;
}

/* INTERNET 3D MODELS DRAWER */
.shelf-drawer {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  width: 92%;
  max-width: 980px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  z-index: 15;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.shelf-drawer.active {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.shelf-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shelf-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.shelf-search-bar input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.shelf-search-bar input:focus {
  border-color: var(--primary-emerald);
  box-shadow: 0 0 10px var(--primary-glow);
}

.shelf-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.shelf-model-card {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.shelf-model-card:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary-emerald);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.2);
}

.shelf-model-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.shelf-model-title {
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-model-cat {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.shelf-model-action {
  font-size: 0.7rem;
  color: #34d399;
  font-weight: 600;
}

/* 3D MODEL INSPECTOR MODAL */
.inspector-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.inspector-modal.active {
  display: flex;
}

.inspector-container {
  width: 95%;
  max-width: 1100px;
  height: 85vh;
  background: #0f172a;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.inspector-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(30, 41, 59, 0.5);
}

.inspector-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inspector-title-area h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.inspector-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: var(--primary-emerald);
  color: #000;
}

.inspector-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.inspector-close-btn:hover {
  background: #ef4444;
}

.inspector-main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 3D Viewport Side */
.inspector-viewport-side {
  flex: 1.2;
  position: relative;
  background: #090d16;
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
}

#inspector-3d-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
}

.inspector-3d-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}

.inspector-tools-left, .inspector-tools-right {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.tool-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.tool-btn.active {
  background: var(--primary-emerald);
  color: #000;
  font-weight: 600;
}

.inspector-footer-stats {
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid var(--border-glass);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.inspector-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.nature-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--primary-emerald);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Content Side */
.inspector-content-side {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #0f172a;
}

.shrine-detail-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.shrine-zone {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.shrine-summary {
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.5;
}

.report-card {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.report-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-emerald);
  margin-bottom: 8px;
}

.report-card-body {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.shrine-footer-cta {
  margin-top: 20px;
  text-align: center;
}

.btn-live-link {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #000;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px var(--primary-glow);
  transition: transform 0.2s;
}

.btn-live-link:hover {
  transform: translateY(-2px);
}

/* FULL REPORT DRAWER */
.report-drawer {
  position: fixed;
  top: 0;
  right: -550px;
  width: 520px;
  max-width: 95vw;
  height: 100%;
  background: #090d16;
  border-left: 1px solid var(--border-glass);
  z-index: 90;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
}

.report-drawer.active {
  right: 0;
}

.report-drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-drawer-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.report-meta-box {
  background: var(--bg-glass-card);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.report-meta-box h2 {
  font-size: 1.2rem;
  color: var(--accent-gold);
}

.report-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 6px 0 12px 0;
}

.report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-badge {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
}

.pillar-box {
  background: var(--bg-glass-card);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.pillar-head {
  font-weight: 700;
  margin-bottom: 4px;
}

.pillar-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.report-section-block {
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
}

.report-section-block h4 {
  font-size: 0.9rem;
  color: #38bdf8;
  margin-bottom: 6px;
}

.report-section-block p {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.5;
}

/* VR STEREO OVERLAY & RETICLE */
#vr-hud-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  display: none;
}

.vr-hud-center-divider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-50%);
}

.vr-hud-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  pointer-events: auto;
}

#vr-reticle {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  pointer-events: none;
  z-index: 60;
  display: none;
}

#vr-reticle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

#vr-reticle circle.bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 3;
}

#vr-reticle circle.progress {
  fill: none;
  stroke: var(--primary-emerald);
  stroke-width: 3;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.1s linear;
}

/* STEREO VR BODY STATE */
body.stereo-vr-active .top-navbar,
body.stereo-vr-active .bottom-chips-bar,
body.stereo-vr-active .shelf-drawer {
  display: none !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 900px) {
  .inspector-main-layout {
    flex-direction: column;
  }
  .inspector-viewport-side {
    height: 45vh;
  }
  .top-navbar {
    padding: 8px 12px;
  }
  .brand-info p {
    display: none;
  }
  .brand-info h1 {
    font-size: 0.9rem;
  }
}
