/* ========================================
   Tracker Screen — Emotion Tapping
   ======================================== */

#screen-tracker {
  padding-bottom: 80px;
  background: #000;
}

/* Top bar */
.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dash-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-logo img {
  height: 28px;
}

.dash-logo span {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.dash-topbar-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 1rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

/* Top bar menu dropdown */
.topbar-menu-wrap {
  position: relative;
}

.topbar-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #1a1a1a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 140px;
  display: none;
  z-index: 60;
}

.topbar-dropdown.open {
  display: block;
}

.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* Score display */
.score-bar {
  text-align: center;
  padding: 16px 16px 12px;
}

.score-number {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  line-height: 1;
  transition: color 0.3s ease;
}

.score-number.positive { color: var(--tier-green); }
.score-number.negative { color: var(--tier-red); }
.score-number.neutral { color: var(--text-muted); }

.score-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.score-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Instruction */
.dash-instruction {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  padding: 0 20px 12px;
  line-height: 1.5;
}

/* ---- Tier sections ---- */
.tier-section {
  padding: 0 12px 8px;
}

/* Vibration wave area — large, prominent */
.tier-wave {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  padding: 8px 0;
}

.tier-wave img {
  width: 65%;
  max-width: 280px;
}

.tier-wave-label {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  line-height: 1.3;
}

/* Tier title */
.tier-title {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.tier-red .tier-title { color: var(--tier-red); }
.tier-green .tier-title { color: var(--tier-green); }
.tier-blue .tier-title { color: var(--tier-blue); }
.tier-purple .tier-title { color: var(--tier-purple); }
.tier-white .tier-title { color: var(--tier-white); }

/* ---- Emotion grid — icons in a row ---- */
.emotion-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 10px;
  justify-content: center;
}

/* Vertical button: icon → name → cal stacked */
.emotion-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.emotion-btn:hover {
  transform: translateY(-2px);
}

.emotion-btn:hover .icon-wrap img {
  filter: brightness(1.2);
}

.emotion-btn:hover .emotion-name {
  color: var(--text-primary);
}

/* Tap / active state */
.emotion-btn:active,
.emotion-btn.tapped {
  transform: scale(0.92);
}

/* Icon */
.icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.icon-wrap img {
  width: 115%;
  height: 115%;
  object-fit: contain;
  transition: filter 0.2s ease;
}

/* Emotion name below icon */
.emotion-name {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.15;
  text-align: center;
  transition: color 0.2s ease;
}

/* Calorie value below name */
.emotion-cal {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.tier-red .emotion-cal { color: var(--tier-red); }
.tier-green .emotion-cal { color: var(--tier-green); }
.tier-blue .emotion-cal { color: var(--tier-blue); }
.tier-purple .emotion-cal { color: var(--tier-purple); }
.tier-white .emotion-cal { color: var(--tier-white); }

/* ---- Side-by-side layout: icons + description/input ---- */
.tier-content-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.tier-content-row .emotion-grid {
  flex-shrink: 0;
  margin-bottom: 0;
}

.tier-content-row .intention-input {
  flex: 1;
  margin: 0;
  padding-top: 10px;
}

.tier-description {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
  padding: 4px 0 8px;
}

.tier-content-row .tier-description {
  flex: 1;
  padding: 6px 0 0;
  font-size: 0.85rem;
}

/* Section link — "Purple & White Vibes" button */
.section-link-btn {
  display: block;
  text-align: center;
  padding: 10px;
  margin: 4px 16px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
}

.section-link-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

/* Intention input */
.intention-input {
  margin: 8px 0;
}

.intention-input input {
  border-color: rgba(224, 224, 224, 0.2);
}

/* ---- Log section ---- */
.log-section {
  padding: 16px;
}

.log-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.log-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.log-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 60px;
}

.log-emotion {
  flex: 1;
  font-size: 0.85rem;
}

.log-cal {
  font-family: 'Montserrat', Helvetica, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.log-cal.red { color: var(--tier-red); }
.log-cal.green { color: var(--tier-green); }
.log-cal.blue { color: var(--tier-blue); }
.log-cal.purple { color: var(--tier-purple); }
.log-cal.white { color: var(--tier-white); }

.log-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Detail modal — centered, above nav and keyboard */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-sheet {
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  background: #1a1a1a;
  border-radius: var(--radius-lg);
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-sheet {
  transform: scale(1);
}

.modal-sheet h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-sheet textarea {
  min-height: 80px;
  resize: none;
  margin-bottom: 16px;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
  padding: 14px;
  font-size: 0.95rem;
}

/* Icon pop animation on tap */
@keyframes chipTap {
  0% { transform: scale(1); }
  40% { transform: scale(0.88); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.emotion-btn.tapped {
  animation: chipTap 0.35s ease;
}

/* Responsive */
@media (max-width: 360px) {
  .icon-wrap {
    width: 52px;
    height: 52px;
  }
  .emotion-name {
    font-size: 0.68rem;
  }
  .emotion-cal {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-sheet,
  .emotion-btn.tapped {
    animation: none;
    transition: none;
  }
  .modal-overlay.active {
    opacity: 1;
  }
  .modal-overlay.active .modal-sheet {
    transform: translateY(0);
  }
}
