/* ============================================ */
/* MOOD ORB CONTAINER */
/* ============================================ */

.mood-orb_container {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  border-radius: 20px;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: scale(0.95);
  position: relative;
  overflow: hidden;
}

.mood-orb_container--animate-in {
  animation: orbContainerFadeIn 0.8s ease forwards;
}

@keyframes orbContainerFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================ */
/* ORB SPHERE */
/* ============================================ */

.mood-orb_sphere-wrapper {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  cursor: pointer;
}

.mood-orb_sphere {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--orb-color, #D3D3D3);
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.08),
    inset -15px -15px 40px rgba(0, 0, 0, 0.18),
    inset 15px 15px 40px rgba(255, 255, 255, 0.25),
    0 0 40px var(--orb-color, rgba(211, 211, 211, 0.2));
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(var(--size-scale, 1.0));
  position: relative;
  overflow: hidden;
}

.mood-orb_sphere::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.3) 20%,
    transparent 50%
  );
  animation: highlightRotate 10s linear infinite;
  pointer-events: none;
}

.mood-orb_sphere::after {
  content: '';
  position: absolute;
  bottom: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 120%,
    rgba(0, 0, 0, 0.4) 0%,
    transparent 40%
  );
  opacity: 0.6;
  pointer-events: none;
}

@keyframes highlightRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ============================================ */
/* HEARTBEAT / PULSE WAVE (inside orb) */
/* ============================================ */

.mood-orb_pulse-container {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  transform: translateY(-50%);
  height: 40px;
  overflow: visible;
  pointer-events: none;
  z-index: 5;
}

.mood-orb_pulse-wave {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

/* Base line - dim, always visible */
.mood-orb_pulse-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Bright signal head - short segment that travels along the path */
.mood-orb_pulse-head {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9))
          drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

/* Tail - slightly longer, dimmer segment behind the head */
.mood-orb_pulse-tail {
  fill: none;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

.mood-orb_sphere:hover {
  transform: scale(calc(var(--size-scale, 1.0) * 1.03));
  box-shadow:
    0 0 25px rgba(0, 0, 0, 0.1),
    inset -15px -15px 40px rgba(0, 0, 0, 0.18),
    inset 15px 15px 40px rgba(255, 255, 255, 0.3),
    0 0 50px var(--orb-color, rgba(211, 211, 211, 0.25));
}

/* ============================================ */
/* MOOD LABELS */
/* ============================================ */

.mood-orb_header {
  text-align: center;
  margin-bottom: 20px;
  width: 100%;
}

.mood-orb_mood-label {
  font-size: 2rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 8px;
  transition: all 0.4s ease;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.mood-orb_axis-labels {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  color: #64748b;
  height: 1.2rem;
  overflow: hidden;
}

.mood-orb_axis-labels small {
  font-size: 0.65rem;
}

.mood-orb_help-text {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: #94a3b8;
  font-style: italic;
  transition: opacity 0.3s ease;
}

/* ============================================ */
/* GRID OVERLAY (inline, transparent) */
/* ============================================ */

.mood-orb_grid-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Same size as sphere-wrapper: 250x250, with grid matching orb: 200x200 */
  width: 250px;
  height: 250px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mood-orb_grid-overlay.mood-orb_grid--visible {
  opacity: 1;
  pointer-events: auto;
}

.mood-orb_grid {
  position: absolute;
  /* Center 200x200 grid in 250x250 overlay = 25px on each side */
  top: 25px;
  left: 25px;
  width: 200px;
  height: 200px;
  cursor: crosshair;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0;
  border: none;
}

.mood-orb_grid-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.mood-orb_grid-line {
  position: absolute;
  background: rgba(0, 0, 0, 0.3);
}

/* Vertical axis (energy) - stays within grid bounds */
.mood-orb_grid-line--vertical {
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

/* Arrow at top of vertical axis */
.mood-orb_grid-line--vertical::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid rgba(0, 0, 0, 0.3);
}

/* Horizontal axis (pleasantness) - stays within grid bounds */
.mood-orb_grid-line--horizontal {
  height: 1px;
  width: 100%;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

/* Arrow at right of horizontal axis */
.mood-orb_grid-line--horizontal::before {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid rgba(0, 0, 0, 0.3);
}

.mood-orb_grid-axis-label {
  position: absolute;
  font-size: 0.55rem;
  color: rgba(0, 0, 0, 0.55);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  white-space: nowrap;
}

.mood-orb_grid-axis-label--top {
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.mood-orb_grid-axis-label--bottom {
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.mood-orb_grid-axis-label--left {
  left: -18px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
}

.mood-orb_grid-axis-label--right {
  right: -18px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
}

.mood-orb_touch-indicator {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  transition: left 0.05s ease, top 0.05s ease;
}

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

@media (max-width: 576px) {
  .mood-orb_container {
    min-height: 350px;
    padding: 30px 15px;
  }

  .mood-orb_sphere-wrapper {
    width: 200px;
    height: 200px;
  }

  .mood-orb_sphere {
    width: 160px;
    height: 160px;
  }

  .mood-orb_grid-overlay {
    /* sphere-wrapper is 200x200 on mobile */
    width: 200px;
    height: 200px;
  }

  .mood-orb_grid {
    /* Center 160x160 grid in 200x200 overlay = 20px on each side */
    top: 20px;
    left: 20px;
    width: 160px;
    height: 160px;
  }

  .mood-orb_mood-label {
    font-size: 1.5rem;
  }

  .mood-orb_axis-labels {
    font-size: 0.85rem;
  }
}

/* ============================================ */
/* ACCESSIBILITY */
/* ============================================ */

@media (prefers-reduced-motion: reduce) {
  .mood-orb_container,
  .mood-orb_sphere,
  .mood-orb_sphere::before,
  .mood-orb_mood-label,
  .mood-orb_grid-overlay,
  .mood-orb_touch-indicator,
  .mood-orb_pulse-line,
  .mood-orb_pulse-head,
  .mood-orb_pulse-tail {
    animation: none !important;
    transition: none !important;
  }

  .mood-orb_container--animate-in {
    opacity: 1;
    transform: scale(1);
  }

  .mood-orb_pulse-head,
  .mood-orb_pulse-tail {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }

  .mood-orb_pulse-head {
    stroke: rgba(255, 255, 255, 0.7);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .mood-orb_sphere {
    border: 3px solid #000;
  }

  .mood-orb_grid {
    border: 2px solid #000;
  }

  .mood-orb_touch-indicator {
    border-color: #000;
    border-width: 4px;
  }
}

/* ============================================ */
/* TOUCH DEVICE OPTIMIZATION */
/* ============================================ */

@media (hover: none) and (pointer: coarse) {
  .mood-orb_sphere {
    width: 180px;
    height: 180px;
  }

  .mood-orb_sphere:hover {
    transform: scale(var(--size-scale, 1.0));
  }

  .mood-orb_touch-indicator {
    width: 24px;
    height: 24px;
    border-width: 4px;
  }
}

/* ============================================ */
/* LOADING STATE */
/* ============================================ */

.mood-orb_container.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.mood-orb_container.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 5px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--orb-color, rgba(102, 126, 234, 0.8));
  border-radius: 50%;
  animation: orbSpin 0.8s linear infinite;
}

@keyframes orbSpin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
