/* css/style.css - Metaverse Virtual Art Gallery Core Styles */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&display=swap');

:root {
  --font-body: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Cinzel', 'Prompt', serif;

  /* Colors */
  --bg-dark: #0c0e12;
  --bg-surface: rgba(18, 22, 30, 0.82);
  --bg-surface-light: rgba(28, 34, 46, 0.9);
  --bg-glass: rgba(14, 18, 26, 0.72);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-gold: rgba(212, 175, 55, 0.35);

  --gold-primary: #d4af37;
  --gold-light: #f5d77f;
  --gold-dark: #aa8214;
  --gold-glow: rgba(212, 175, 55, 0.25);

  --teacher-accent: #f59e0b;
  --teacher-glow: rgba(245, 158, 11, 0.3);
  --student-accent: #10b981;
  --student-glow: rgba(16, 185, 129, 0.3);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --shadow-lux: 0 12px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border-glass);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text-main);
  user-select: none;
}

/* 3D Canvas */
#webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  outline: none;
}

/* HUD Overlay Layer */
#hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 24px;
}

.interactive-ui {
  pointer-events: auto;
}

/* Glassmorphic Panel Base */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lux);
  border-radius: var(--radius-md);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

/* Top Navigation Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass-gold);
  border-radius: var(--radius-full);
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 16px;
  box-shadow: 0 0 16px var(--gold-glow);
}

.brand-title {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  color: var(--gold-primary);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.room-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.room-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-primary);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.top-right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  font-size: 13px;
}

.user-badge.teacher {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 14px var(--teacher-glow);
}

.user-badge.student {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 14px var(--student-glow);
}

.badge-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.badge-tag.teacher {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-tag.student {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-light);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  transform: translateY(-2px);
}

/* Minimap Radar */
.minimap-container {
  position: absolute;
  top: 76px;
  right: 24px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(10, 13, 18, 0.88);
  border: 2px solid var(--border-glass-gold);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.15);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.minimap-container:hover {
  transform: scale(1.04);
  border-color: var(--gold-light);
}

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

.minimap-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--gold-light);
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
}

/* Center Reticle & Crosshair (First-Person Look) */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
}

#crosshair.hovering {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gold-primary);
  background: rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 12px var(--gold-primary);
}

/* Interactive Prompt (Near Artwork) */
#interact-prompt {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 24px;
  background: rgba(14, 18, 25, 0.92);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px var(--gold-glow);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 15;
}

#interact-prompt.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  color: #0c0e12;
  font-weight: 700;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Bottom Control Deck */
.bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.controls-hint {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 18px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  font-size: 12px;
  color: var(--text-muted);
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-key {
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

/* Action Button Cluster */
.action-deck {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.action-btn.gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  color: #0c0e12;
  font-weight: 600;
  border: none;
  box-shadow: 0 4px 16px var(--gold-glow);
}

.action-btn.gold:hover {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.4);
}

.action-btn.teacher-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.action-btn.teacher-btn:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: #fbbf24;
}

.action-btn.student-btn {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.action-btn.student-btn:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: #34d399;
}

/* Chat & Announcement Box */
.chat-drawer {
  position: absolute;
  bottom: 86px;
  left: 24px;
  width: 320px;
  height: 280px;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lux);
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

.chat-drawer.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.chat-msg.teacher-msg {
  background: rgba(245, 158, 11, 0.12);
  border-left: 3px solid #f59e0b;
}

.chat-msg-sender {
  font-weight: 600;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-msg-sender.teacher {
  color: #fbbf24;
}

.chat-msg-sender.student {
  color: #34d399;
}

.chat-input-bar {
  display: flex;
  padding: 8px;
  gap: 6px;
  border-top: 1px solid var(--border-glass);
  background: rgba(10, 12, 16, 0.9);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
}

.chat-input:focus {
  border-color: var(--gold-primary);
}

.chat-send-btn {
  background: var(--gold-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #0c0e12;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
}

/* Quick Reaction Bar */
.quick-reactions {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-glass);
  justify-content: space-around;
}

.quick-react-btn {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.quick-react-btn:hover {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.1);
}

/* Toast Alerts & Announcements */
#toast-container {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 12px 24px;
  border-radius: var(--radius-full);
  background: rgba(18, 22, 30, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass-gold);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slide-toast 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes slide-toast {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.announcement {
  border-color: #f59e0b;
  background: rgba(35, 24, 10, 0.95);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.4);
}

/* Mobile Virtual Joystick Container */
#mobile-controls {
  position: fixed;  /* fixed = always covers full viewport regardless of scroll */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  z-index: 20;
}

#mobile-controls.touch-active {
  display: block;
}

.joystick-touch-area {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 55%;
  pointer-events: auto;
  touch-action: none;
}

/* Camera rotation zone - right half */
.camera-touch-area {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  /* Positioned absolutely within #mobile-controls (full screen overlay) */
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(30, 35, 50, 0.80) 60%,
    rgba(212, 175, 55, 0.22) 100%
  );
  border: 2px solid rgba(212, 175, 55, 0.40);
  box-shadow:
    0 0 24px rgba(212, 175, 55, 0.2),
    inset 0 0 18px rgba(0, 0, 0, 0.5);
  /* center will be set by JS via left/top */
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 21;
}

.joystick-base.active {
  opacity: 1;
}

/* Crosshair lines inside the base */
.joystick-base::before,
.joystick-base::after {
  content: '';
  position: absolute;
  background: rgba(212, 175, 55, 0.2);
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.joystick-base::before {
  width: 2px;
  height: 80%;
}
.joystick-base::after {
  width: 80%;
  height: 2px;
}

/* The Rolling Ball Knob */
.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  /* 3D sphere effect: radial gradient mimics light source top-left */
  background: radial-gradient(circle at 35% 32%,
    #fffbe8 0%,
    #f5c842 28%,
    #d4af37 55%,
    #8b6914 85%,
    #4a3500 100%
  );
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(212, 175, 55, 0.45),
    inset 0 -4px 8px rgba(0, 0, 0, 0.4),
    inset 4px -4px 10px rgba(255, 255, 220, 0.25);
  border: 1.5px solid rgba(255, 200, 50, 0.5);
  pointer-events: none;
}

.mobile-action-buttons {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: auto;
}

.mobile-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(14, 18, 25, 0.85);
  border: 2px solid var(--border-glass-gold);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active, .mobile-btn.active {
  background: var(--gold-primary);
  color: #0c0e12;
  transform: scale(0.95);
  box-shadow: 0 0 20px var(--gold-glow);
}

/* Media Queries for Mobile & Tablet (iPad) */
/* Use touch media feature to detect touch screens regardless of width */
@media (hover: none) and (pointer: coarse) {
  .controls-hint { display: none; }
  .minimap-container { width: 100px; height: 100px; top: 70px; right: 14px; }
  .minimap-label { font-size: 9px; }
  .brand-title { font-size: 12px; }
  .brand-sub { display: none; }
  .action-deck { flex-wrap: wrap; justify-content: center; }
  .action-btn span { display: none; }
  .action-btn { padding: 10px; }
  #interact-prompt { bottom: 180px; }
  #mobile-controls { display: block !important; }
  .bottom-bar { justify-content: center; }
}

/* Fallback for small screens without pointer detection */
@media (max-width: 1024px) {
  #mobile-controls { display: block !important; }
  .controls-hint { display: none; }
  .action-btn span { display: none; }
  .action-btn { padding: 10px; }
}
