/* A-Z Animals Visual Viewer - Minority Report Kid-Friendly Style */

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

:root {
  --primary: #ff6b35;
  --primary-dark: #e55a2b;
  --primary-glow: rgba(255, 107, 53, 0.4);
  --bg-dark: rgba(0, 0, 0, 0.75);
  --bg-card: rgba(10, 20, 40, 0.75);
  --bg-panel: rgba(10, 20, 40, 0.85);
  --text-primary: #ffffff;
  --text-secondary: #a0c4ff;
  --accent: #4ecdc4;
  --accent-glow: rgba(78, 205, 196, 0.5);
  --recording: #ff4444;
  --border-glow: rgba(78, 205, 196, 0.3);
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: #000;
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  height: 45px;
  width: auto;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.version {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 10px var(--accent-glow);
  letter-spacing: 1px;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--recording);
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 0 15px var(--recording);
}

.recording-indicator.hidden {
  display: none;
}

.rec-dot {
  width: 16px;
  height: 16px;
  background: var(--recording);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
  box-shadow: 0 0 20px var(--recording);
}

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

/* Main content */
#main {
  position: relative;
  width: 100vw;
  height: 100vh;
}

/* Webcam */
#webcam {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

/* Hand tracking canvas */
#hand-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  transform: scaleX(-1);
}

/* ==========================================
   ANIMAL CARD - LEFT SIDE, FIXED LAYOUT
   ========================================== */
.animal-card {
  position: absolute;
  top: 90px;
  left: 40px;
  bottom: 80px;
  width: 480px;
  max-width: 40vw;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Fixed image container - square to match generated images */
.card-image-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid var(--border-glow);
  box-shadow:
    0 0 40px rgba(78, 205, 196, 0.2),
    0 10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(25px);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Info panel below image */
.card-info {
  flex: 1;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(25px);
  border: 2px solid var(--border-glow);
  box-shadow:
    0 0 40px rgba(78, 205, 196, 0.2),
    0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-name {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(255,255,255,0.3);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.card-scientific {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 16px;
  opacity: 0.9;
  flex-shrink: 0;
}

/* Tab content in card */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}

.tab-pane {
  display: none;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
}

.tab-pane.active {
  display: block;
}

.tab-pane ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tab-pane li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(78, 205, 196, 0.2);
  position: relative;
  padding-left: 24px;
}

.tab-pane li::before {
  content: "★";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.tab-pane li:last-child {
  border-bottom: none;
}

/* ==========================================
   NAV PANEL - RIGHT SIDE, HUGE BUTTONS
   ========================================== */
.nav-panel {
  position: absolute;
  top: 50%;
  right: 30px;
  transform: translateY(-50%);
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 30;
}

/* Animal prev/next navigation */
.nav-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border-radius: 24px;
  padding: 20px;
  border: 2px solid var(--border-glow);
  backdrop-filter: blur(20px);
  box-shadow: 0 0 30px rgba(78, 205, 196, 0.15);
}

.nav-btn-huge {
  width: 100%;
  height: 80px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3) 0%, rgba(78, 205, 196, 0.1) 100%);
  border: 3px solid var(--accent);
  border-radius: 20px;
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow:
    0 0 20px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.nav-btn-huge:hover {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.5) 0%, rgba(78, 205, 196, 0.2) 100%);
  transform: scale(1.03);
  box-shadow:
    0 0 40px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.nav-btn-huge:active {
  transform: scale(0.98);
}

.nav-btn-huge .btn-icon {
  font-size: 1.8rem;
}

.animal-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent-glow);
  padding: 10px 0;
}

.counter-divider {
  opacity: 0.5;
}

/* Vertical tab buttons */
.tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-panel);
  border-radius: 24px;
  padding: 20px;
  border: 2px solid var(--border-glow);
  backdrop-filter: blur(20px);
  box-shadow: 0 0 30px rgba(78, 205, 196, 0.15);
}

.tab-btn {
  width: 100%;
  height: 70px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  transition: all 0.2s ease;
}

.tab-btn .tab-icon {
  font-size: 1.6rem;
}

.tab-btn .tab-number {
  width: 36px;
  height: 36px;
  background: rgba(255, 107, 53, 0.3);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

.tab-btn.active .tab-number {
  background: white;
  border-color: white;
  color: var(--primary);
}

.tab-btn:hover {
  background: rgba(78, 205, 196, 0.15);
  border-color: var(--accent);
  color: white;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 25px var(--primary-glow);
}

.tab-btn.active .tab-icon {
  transform: scale(1.1);
}

/* Record button */
.record-btn {
  width: 100%;
  height: 70px;
  background: rgba(255, 68, 68, 0.2);
  border: 3px solid var(--recording);
  border-radius: 20px;
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
}

.record-btn:hover {
  background: rgba(255, 68, 68, 0.4);
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(255, 68, 68, 0.5);
}

.record-btn .btn-icon {
  font-size: 1.5rem;
}

.record-btn.recording {
  background: var(--recording);
  animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 68, 68, 0.5); }
  50% { box-shadow: 0 0 50px rgba(255, 68, 68, 0.8); }
}

/* Navigation dots at bottom */
.nav-hints {
  position: absolute;
  bottom: 25px;
  left: 40px;
  display: flex;
  align-items: center;
  z-index: 30;
}

.nav-dots {
  display: flex;
  gap: 10px;
}

.nav-dot {
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 0 5px rgba(255,255,255,0.2);
}

.nav-dot.active {
  background: var(--primary);
  width: 40px;
  border-radius: 6px;
  box-shadow: 0 0 15px var(--primary-glow);
}

/* Gesture feedback */
.gesture-feedback {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent) 0%, #38b2ac 100%);
  color: white;
  padding: 16px 36px;
  border-radius: 40px;
  font-weight: 700;
  font-size: 1.2rem;
  z-index: 50;
  animation: feedbackIn 0.3s ease;
  box-shadow: 0 0 30px var(--accent-glow);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gesture-feedback.hidden {
  display: none;
}

@keyframes feedbackIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Loading screen */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a1428 0%, #1a2a4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.loading.hidden {
  display: none;
}

.loading-content {
  text-align: center;
}

.loading-content h1 {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 20px;
  text-shadow: 0 0 30px var(--accent-glow);
}

.loading-content p {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(78, 205, 196, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

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

/* Instructions overlay */
.instructions {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 20, 40, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  backdrop-filter: blur(10px);
}

.instructions.hidden {
  display: none;
}

.instructions-content {
  background: var(--bg-panel);
  padding: 50px;
  border-radius: 30px;
  max-width: 550px;
  text-align: center;
  border: 2px solid var(--border-glow);
  box-shadow: 0 0 60px rgba(78, 205, 196, 0.2);
}

.instructions-content h2 {
  font-size: 2rem;
  margin-bottom: 30px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.instructions-content ul {
  list-style: none;
  text-align: left;
  margin-bottom: 35px;
}

.instructions-content li {
  padding: 14px 0;
  border-bottom: 1px solid rgba(78, 205, 196, 0.2);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
}

.instructions-content li:last-child {
  border-bottom: none;
}

.instructions-content li strong {
  color: var(--accent);
}

.start-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 20px 50px;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 30px var(--primary-glow);
}

.start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px var(--primary-glow);
}

.keyboard-hint {
  margin-top: 25px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 10px var(--accent-glow);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}
