/* ---------- Pharmacy: Slop Dispensary Styles ---------- */

/* Patient display */
.pharmacy-patient {
  font-family: var(--font-family-body, "Comic Neue", "Comic Sans MS", cursive);
  font-size: 1.1em;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--paper, #eef2ff);
  border-radius: 8px;
  text-align: center;
  border-left: 4px solid var(--accent, #5865f2);
}

.pharmacy-patient b {
  color: var(--ink, #16152a);
  font-weight: 600;
}

/* Tutorial overlay */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  padding: 20px;
  animation: tutorial-fade-in 0.3s ease-out;
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  background: var(--card, #d6daf0);
  color: var(--ink, #16152a);
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: tutorial-slide-up 0.3s ease-out;
}

.tutorial-card h2 {
  margin: 0 0 8px;
  font-size: 1.3em;
  text-align: center;
}

.tutorial-card .tutorial-intro {
  text-align: center;
  color: var(--slime-dark, #5d4a74);
  font-style: italic;
  margin-bottom: 16px;
}

.tutorial-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.tutorial-steps li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tutorial-steps li:last-child {
  border-bottom: none;
}

.tutorial-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #5865f2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.tutorial-step-text {
  flex: 1;
}

.tutorial-step-text b {
  display: block;
  margin-bottom: 2px;
}

.tutorial-step-text span {
  font-size: 0.9em;
  opacity: 0.8;
}

.tutorial-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.tutorial-actions button {
  min-height: 44px;
  min-width: 120px;
}

@keyframes tutorial-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tutorial-slide-up {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pharmacy result feedback with enhanced animations */
.pharmacy-result {
  margin-top: 12px;
  padding: 16px 20px;
  border-radius: 10px;
  text-align: center;
  animation: result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 600;
}

.pharmacy-result.success {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border: 3px solid #28a745;
  box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
}

.pharmacy-result.failure {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  color: #721c24;
  border: 3px solid #dc3545;
  animation: result-shake 0.5s ease-out;
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3);
}

.pharmacy-result.in-progress {
  background: linear-gradient(135deg, var(--paper, #eef2ff), var(--card, #d6daf0));
  color: var(--ink, #16152a);
  border: 2px solid var(--slime, #b7a4ce);
  box-shadow: 0 4px 16px rgba(183, 164, 206, 0.2);
}

@keyframes result-pop {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(10px);
    filter: blur(4px);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) translateY(-2px);
    filter: blur(0);
  }
  70% {
    transform: scale(0.98) translateY(0);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

@keyframes result-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-1deg); }
  30% { transform: translateX(8px) rotate(1deg); }
  45% { transform: translateX(-6px) rotate(-1deg); }
  60% { transform: translateX(6px) rotate(1deg); }
  75% { transform: translateX(-3px); }
  85% { transform: translateX(3px); }
}

/* Pharmacy ingredient progress with enhanced styling */
.pharmacy-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px;
  background: var(--paper, #eef2ff);
  border-radius: 8px;
  border: 1px solid var(--slime, #b7a4ce);
}

.pharmacy-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--card, #d6daf0);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.pharmacy-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--slime, #b7a4ce), var(--accent, #5865f2));
  border-radius: 5px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.pharmacy-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.pharmacy-progress-label {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--slime-dark, #5d4a74);
  min-width: 70px;
  text-align: right;
}

/* Pharmacy hint system with better animation */
.pharmacy-hint {
  margin: 12px 0;
  padding: 14px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--mustard, #e2c7d5), #f0d8e0);
  border-left: 5px solid var(--accent, #5865f2);
  font-size: 0.95em;
  animation: hint-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.2);
}

.pharmacy-hint b {
  display: block;
  margin-bottom: 6px;
  font-size: 1em;
}

@keyframes hint-slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Pharmacy celebration particles */
.pharmacy-celebration {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
}

.pharmacy-celebration .particle {
  position: absolute;
  font-size: 28px;
  animation: celebration-fall 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

@keyframes celebration-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-30px) rotate(180deg) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(250px) rotate(540deg) scale(0.3);
  }
}

/* Pharmacy step indicators */
#pharmacy-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

#pharmacy-steps li {
  padding: 10px 12px;
  margin: 6px 0;
  background: var(--paper, #eef2ff);
  border-radius: 8px;
  border-left: 4px solid var(--slime, #b7a4ce);
  transition: all 0.2s ease;
}

#pharmacy-steps li.done {
  opacity: 0.7;
  text-decoration: line-through;
  background: #e8f5e9;
  border-left-color: #28a745;
}

/* Kitchen/Pantry button states with better feedback */
.pantry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 14px;
  margin: 4px;
  border-radius: 8px;
  border: 2px solid var(--slime, #b7a4ce);
  background: var(--paper, #eef2ff);
  color: var(--ink, #16152a);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pantry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--accent, #5865f2);
}

.pantry-btn:active {
  transform: translateY(1px) scale(0.98);
}

.pantry-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.4);
}

.pantry-btn.next {
  background: linear-gradient(135deg, #e8f4fd, #d0e8fc);
  border-color: var(--accent, #5865f2);
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.4);
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

.pantry-btn.added {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  border-color: #28a745;
  opacity: 0.85;
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 12px rgba(88, 101, 242, 0.4); }
  to { box-shadow: 0 0 20px rgba(88, 101, 242, 0.7); }
}

/* Pharmacy status with enhanced visual states */
.kitchen-status {
  font-size: 1em;
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: 10px;
  text-align: center;
  transition: all 0.3s ease;
  font-weight: 500;
}

.kitchen-status.waiting {
  background: linear-gradient(135deg, var(--paper, #eef2ff), var(--card, #d6daf0));
  border: 2px solid var(--slime, #b7a4ce);
  color: var(--ink, #16152a);
}

.kitchen-status.ready {
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border: 3px solid #ffc107;
  color: #856404;
  box-shadow: 0 4px 20px rgba(255, 193, 7, 0.3);
  animation: status-ready-pulse 2s ease-in-out infinite;
}

@keyframes status-ready-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 193, 7, 0.3); }
  50% { box-shadow: 0 6px 28px rgba(255, 193, 7, 0.5); }
}

/* Dial styling */
#pharmacy-dial {
  width: 100%;
  max-width: 240px;
  height: 28px;
  -webkit-appearance: none;
  background: transparent;
  margin: 0 8px;
}

#pharmacy-dial::-webkit-slider-runnable-track {
  height: 10px;
  background: var(--paper, #eef2ff);
  border-radius: 5px;
  border: 2px solid var(--slime, #b7a4ce);
}

#pharmacy-dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #5865f2), var(--slime, #b7a4ce));
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#pharmacy-dial::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.7);
}

/* Compound button states */
#pharmacy-compound.big {
  font-size: 1.15em;
  padding: 14px 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#pharmacy-compound.big:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(40, 167, 69, 0.5);
}

#pharmacy-compound.big:active {
  transform: translateY(0) scale(0.98);
}

#pharmacy-compound.big:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.4);
}

#pharmacy-compound.big.compounding {
  animation: compound-pulse 0.6s ease-out;
}

@keyframes compound-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 30px rgba(40, 167, 69, 0.8); }
}

#pharmacy-compound.big:disabled,
#pharmacy-compound.big[hidden] {
  display: none;
}

/* Next patient button */
#pharmacy-next {
  min-height: 44px;
  padding: 10px 20px;
  background: var(--card, #d6daf0);
  color: var(--ink, #16152a);
  border: 2px solid var(--slime, #b7a4ce);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#pharmacy-next:hover {
  background: var(--slime, #b7a4ce);
  color: white;
  transform: translateY(-2px);
}

/* Hint button */
#pharmacy-hint {
  min-height: 44px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #ffc107, #ffca2c);
  color: #333;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

#pharmacy-hint:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.5);
}

/* Pharmacy history log enhancements */
.pharmacy-history-log {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pharmacy-history-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 24px;
  font-size: 0.85em;
  background: var(--paper, #eef2ff);
  border: 1px solid var(--slime, #b7a4ce);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pharmacy-history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hist-ailment {
  font-weight: 600;
}

.hist-dosage {
  background: var(--slime, #b7a4ce);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
}

.hist-date {
  opacity: 0.7;
  font-size: 0.8em;
}

/* Pharmacy lab notes */
.pharmacy-notes-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pharmacy-note {
  padding: 12px 14px;
  background: var(--paper, #eef2ff);
  border-radius: 8px;
  border-left: 4px solid var(--slime, #b7a4ce);
  font-size: 0.85em;
  line-height: 1.6;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pharmacy-note:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.pharmacy-note.weekend {
  border-left-color: var(--accent, #5865f2);
  background: linear-gradient(135deg, #f0e8ff, #e8dfff);
}

.pharmacy-note.special {
  border-left-color: #ff69b4;
  background: linear-gradient(135deg, #fff0f5, #ffe8ef);
}

.pharmacy-note-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--slime-dark, #5d4a74);
}

.pharmacy-note-date {
  font-size: 0.8em;
  opacity: 0.7;
  font-weight: normal;
}

.pharmacy-note-tag {
  font-size: 0.7em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent, #5865f2);
  color: white;
  font-weight: 700;
}

.pharmacy-note-tag.weekend {
  background: var(--accent, #5865f2);
}

.pharmacy-note-tag.special {
  background: #ff69b4;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tutorial-overlay,
  .tutorial-card,
  .hybrid-result,
  .pharmacy-result,
  .pharmacy-result.success,
  .pharmacy-result.failure,
  .pharmacy-hint,
  .pharmacy-celebration .particle,
  .pantry-btn.next,
  .kitchen-status.ready,
  #pharmacy-compound.big.compounding {
    animation: none;
    opacity: 1;
  }
  .pharmacy-progress-fill {
    transition: none;
  }
  .pharmacy-progress-fill::after {
    animation: none;
  }
  .pet-baby-emoji {
    animation: none;
  }
}

/* Responsive */
@media (max-width: 480px) {
  .tutorial-card {
    padding: 16px;
  }

  .tutorial-steps li {
    padding: 6px 0;
  }

  .tutorial-actions {
    flex-direction: column;
  }

  .tutorial-actions button {
    width: 100%;
  }

  .mutation-log-item {
    font-size: 0.7em;
    padding: 3px 8px;
  }

  .pharmacy-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pharmacy-progress-label {
    text-align: left;
    min-width: auto;
  }

  .pantry-btn {
    min-width: 0;
    flex: 1;
    font-size: 0.8em;
    padding: 8px 6px;
  }

  .kitchen-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  #pharmacy-compound.big {
    width: 100%;
  }
}