/* Tama - Modern Tamagotchi Game Styles */

:root {
  /* Color Palette - Dark mode with vibrant accents */
  --bg-dark: #0a0a0f;
  --bg-gradient: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --primary: #6c5ce7;
  --primary-glow: rgba(108, 92, 231, 0.4);
  --secondary: #00cec9;
  --accent: #fd79a8;
  --warning: #fdcb6e;
  --danger: #e17055;
  --success: #00b894;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);

  /* Typography */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.5;
}

/* Utilities */
.hidden {
  display: none !important;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  border-radius: var(--radius-xl);
  text-align: center;
  animation: modalIn 0.3s ease-out;
}

.modal-content.small {
  max-width: 300px;
  padding: 24px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Logo */
.logo {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.tagline {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  background: var(--glass-bg);
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Forms */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.input-group {
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #a55eea);
  color: white;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--primary-glow);
}

.btn-secondary {
  width: 100%;
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  margin-top: 12px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  color: var(--text-primary);
}

.btn-icon:hover {
  opacity: 1;
}

.error {
  color: var(--danger);
  margin-top: 12px;
  font-size: 0.9rem;
}

/* Game Container */
#game-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  position: relative;
  z-index: 100;
}

.app-title {
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.user-menu-btn:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.dropdown-arrow {
  font-size: 0.6rem;
  opacity: 0.6;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 150px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  z-index: 1000;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-item:first-child {
  border-bottom: 1px solid var(--glass-border);
}

/* 3D Canvas */
#pet-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  transition: transform 0.3s ease;
}

#pet-canvas.egg-stage {
  transform: translateY(-65px);
}

/* Status Overlay */
#status-overlay {
  position: absolute;
  top: 80px;
  left: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  z-index: 10;
}

.status-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
}

.status-item+.status-item {
  margin-top: 8px;
}

.status-item .label {
  color: var(--text-secondary);
}

.status-item .value {
  font-weight: 600;
}

.pet-name-row {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.pet-name-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-icon-small {
  background: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 0;
  color: var(--text-primary);
}

.btn-icon-small:hover {
  opacity: 1;
}

/* Health Meters */
#health-meters {
  position: absolute;
  top: 80px;
  right: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  z-index: 10;
  min-width: 160px;
}

.meter {
  margin-bottom: 12px;
}

.meter:last-child {
  margin-bottom: 0;
}

.meter-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hearts {
  display: flex;
  gap: 4px;
}

.heart {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.heart.filled {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
  animation: heartPulse 1s ease-in-out infinite;
}

@keyframes heartPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.progress-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--success));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Status Icons */
#status-icons {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.status-icon {
  font-size: 2rem;
  animation: iconBounce 0.5s ease infinite;
}

@keyframes iconBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* Controls */
#controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-xl);
  z-index: 100;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn .icon {
  font-size: 1.5rem;
}

.control-btn .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Action Modal */
#action-modal .modal-content {
  padding: 20px;
}

#action-title {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

#action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

#action-buttons .btn {
  justify-content: flex-start;
  gap: 12px;
}

/* Egg Controls */
#egg-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 16px 24px;
  border-radius: var(--radius-xl);
  z-index: 100;
  text-align: center;
  min-width: 280px;
}

.egg-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.temp-display,
.progress-display {
  text-align: left;
}

.temp-display .label,
.progress-display .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.temp-bar {
  position: relative;
  height: 20px;
  background: linear-gradient(90deg, #3498db 0%, #2ecc71 35%, #2ecc71 65%, #e74c3c 100%);
  border-radius: 10px;
  margin-bottom: 4px;
}

.temp-zone {
  position: absolute;
  left: 35%;
  width: 30%;
  height: 100%;
  border: 2px solid white;
  border-radius: 4px;
  pointer-events: none;
}

.temp-indicator {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 28px;
  background: white;
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  transition: left 0.3s ease;
}

.hatch-bar {
  height: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.hatch-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 6px;
  transition: width 0.3s ease;
}

.temp-display .value,
.progress-display .value {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.egg-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.egg-btn {
  min-width: 100px;
}

.egg-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* Game Over */
#gameover-modal h2 {
  font-size: 2rem;
  margin-bottom: 16px;
}

#gameover-modal p {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

#rating {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--warning);
  margin: 16px 0 24px;
}

/* Confirm Modal */
#confirm-modal h3 {
  margin-bottom: 12px;
}

#confirm-modal p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.confirm-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Pet Generator Modal */
.generator-modal {
  max-width: 800px;
  width: 90vw;
}

.generator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.generator-header h2 {
  margin: 0;
}

.generator-desc {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.generator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.generator-cell {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.generator-cell canvas {
  width: 100%;
  height: 100%;
}

.generator-cell .stage-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 10px;
}

.generator-actions {
  text-align: center;
}

@media (max-width: 600px) {
  .generator-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .modal-content {
    padding: 24px;
  }

  .logo {
    font-size: 2rem;
  }

  #controls {
    width: calc(100% - 32px);
    justify-content: center;
    flex-wrap: wrap;
  }

  .control-btn {
    min-width: 60px;
    padding: 10px 12px;
  }

  .control-btn .icon {
    font-size: 1.3rem;
  }

  .control-btn .label {
    font-size: 0.65rem;
  }

  #health-meters {
    top: auto;
    bottom: 140px;
    right: 16px;
    left: auto;
    min-width: auto;
    padding: 12px;
  }

  #status-overlay {
    top: auto;
    bottom: 140px;
    left: 16px;
  }

  #status-icons {
    top: 80px;
    right: 16px;
    transform: none;
    flex-direction: row;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}