/* css/teroka-3d.css - Reka Bentuk Ceria, Responsif & Lengkap untuk Teroka Bentuk 3D (Matematik & Sains) */

:root {
  --primary-color: #0F766E;
  --primary-hover: #0D9488;
  --accent-color: #F59E0B;
  --bg-gradient: radial-gradient(circle at top, #F8FAFC 0%, #E2E8F0 100%);
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: #CBD5E1;
  --text-main: #0F172A;
  --text-sub: #475569;
  --radius-xl: 20px;
  --radius-pill: 9999px;
  --shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 3D Canvas Viewport */
#canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

#canvas-viewport:active {
  cursor: grabbing;
}

/* Top App Header */
.app-header {
  position: relative;
  z-index: 10;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--panel-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0F766E, #14B8A6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.25);
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.2;
}

.brand-title p {
  font-size: 0.75rem;
  color: #64748B;
  font-weight: 700;
}

/* Main Category Switcher (Matematik & Sains) */
.category-switcher-bar {
  display: flex;
  background: #E2E8F0;
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 4px;
  flex-wrap: wrap;
}

.cat-btn {
  border: none;
  background: transparent;
  color: #334155;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.cat-btn.active {
  background: var(--primary-color);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

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

.header-btn {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  color: #334155;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.15s;
}

.header-btn:hover {
  transform: scale(1.08);
}

/* Sub-Bar: Model Pickers (e.g. Cube, Cuboid, Pyramid, Cylinder, Cone, Prism) */
.sub-model-bar {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 6px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  max-width: 95vw;
  overflow-x: auto;
}

.model-pick-btn {
  border: 1px solid transparent;
  background: #F1F5F9;
  color: #334155;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s;
}

.model-pick-btn:hover {
  background: #E2E8F0;
}

.model-pick-btn.active {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Floating Status & Info Card */
.floating-overlay-card {
  position: absolute;
  top: 125px;
  left: 20px;
  z-index: 10;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 2px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  max-width: 360px;
  box-shadow: var(--shadow-float);
  pointer-events: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.status-badge {
  font-size: 0.82rem;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.surface { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.status-badge.edge { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.status-badge.vertex { background: #FCE7F3; color: #BE185D; border: 1px solid #FBCFE8; }
.status-badge.net { background: #F0FDFA; color: #0F766E; border: 1px solid #99F6E4; }
.status-badge.fraction { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.status-badge.teeth { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.status-badge.solar { background: #312E81; color: #E0E7FF; border: 1px solid #6366F1; }

.count-display {
  font-size: 1.8rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1;
}

.instruction-text {
  font-size: 0.92rem;
  color: var(--text-sub);
  line-height: 1.45;
  margin-bottom: 12px;
}

.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px dashed #94A3B8;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #475569;
  font-weight: 700;
}

/* Floating 3D Navigation Controls (Right Side) */
.camera-controls-dock {
  position: absolute;
  top: 125px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cam-btn {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
  transition: all 0.2s;
}

.cam-btn:hover {
  background: #FFFFFF;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: scale(1.08);
}

.cam-btn.active {
  background: #0F766E;
  color: #FFFFFF;
  border-color: #0F766E;
}

/* Bottom Control Shelf */
.bottom-dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 2px solid var(--panel-border);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
  max-width: 95vw;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary-action {
  background: linear-gradient(135deg, #0F766E, #14B8A6);
  color: #FFFFFF;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
  transition: all 0.2s ease;
}

.btn-primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.45);
}

.btn-secondary-action {
  background: #FFFFFF;
  color: #334155;
  border: 1.5px solid #CBD5E1;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary-action:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

/* Item Picker Palette (Alternative tactile buttons for small phones) */
.item-picker-bar {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1.5px solid #CBD5E1;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-width: 90vw;
  overflow-x: auto;
}

.picker-item-btn {
  border: none;
  background: #F1F5F9;
  color: #334155;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.picker-item-btn.selected {
  background: #10B981;
  color: #FFFFFF;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.modal-content-card {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  border: 2px solid #E2E8F0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1.5px solid #F1F5F9;
  padding-bottom: 12px;
}

.quiz-option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #1E293B;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-option-btn:hover {
  background: #F0FDFA;
  border-color: #14B8A6;
}

.quiz-option-btn.correct {
  background: #DCFCE7;
  border-color: #22C55E;
  color: #15803D;
}

.quiz-option-btn.wrong {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #B91C1C;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-header {
    padding: 8px 12px;
  }
  .brand-title h1 {
    font-size: 1.05rem;
  }
  .category-switcher-bar {
    width: 100%;
    justify-content: center;
  }
  .sub-model-bar {
    top: 105px;
  }
  .floating-overlay-card {
    top: 155px;
    left: 12px;
    right: 12px;
    max-width: none;
    padding: 12px 14px;
  }
  .camera-controls-dock {
    top: auto;
    bottom: 85px;
    right: 12px;
  }
  .bottom-dock {
    bottom: 12px;
    padding: 8px 14px;
    width: 95vw;
  }
  .btn-primary-action {
    padding: 10px 18px;
    font-size: 0.88rem;
  }
}
