/**
 * CHUNGUS FUNGUS HOLDINGS - GRIEVANCE COMPOSTER (MESSY EDITION)
 * ====================================================
 * Visual styles for biological feedback conversion with maximum goop.
 */

/* ========================================
   COMPOSTER CONTAINER
   ======================================== */
.composter-container {
  background: linear-gradient(180deg, #0a0a0a 0%, #0d1008 100%);
  border: 1px solid #1d1d1d;
  border-top: 4px solid var(--dept-primary, #334466);
  padding: 32px;
  margin-top: 40px;
  position: relative;
  overflow: hidden;
}

.composter-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--dept-primary, #334466), #4d5d31, transparent);
  opacity: 0.5;
  animation: slimeDrip 4s ease-in-out infinite;
}

@keyframes slimeDrip {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ========================================
   HEADER
   ======================================== */
.composter-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1a1a1a;
  position: relative;
}

.composter-header::after {
  content: '▓';
  position: absolute;
  right: 0;
  bottom: -8px;
  font-size: 0.6rem;
  color: #2d3d1f;
  animation: sporePulse 2s ease-in-out infinite;
}

@keyframes sporePulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.composter-icon {
  font-size: 1.8rem;
  opacity: 0.8;
  filter: drop-shadow(0 2px 4px rgba(77, 93, 49, 0.3));
}

.composter-title {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}

.composter-status {
  font-size: 0.65rem;
  color: var(--accent, #00FF41);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ========================================
   INPUT SECTION - THE GOOP CONTAINER
   ======================================== */
.composter-input-wrapper {
  margin-bottom: 24px;
  position: relative;
}

.composter-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #666;
  margin-bottom: 12px;
}

.composter-hint {
  display: block;
  font-size: 0.65rem;
  color: #444;
  text-transform: none;
  letter-spacing: 0.5px;
  margin-top: 4px;
  font-style: italic;
}

.input-container {
  position: relative;
  background: linear-gradient(180deg, #080808 0%, #0a0c06 50%, #0d1008 100%);
  border: 1px solid #2a2a2a;
  overflow: visible;
  min-height: 180px;
}

.input-container::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to top, rgba(62, 47, 27, 0.15), transparent);
  pointer-events: none;
  z-index: 1;
}

/* The goop pile at the bottom */
.input-container::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 10%;
  right: 10%;
  height: 15px;
  background: radial-gradient(ellipse at center, rgba(77, 93, 49, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(3px);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.input-container.has-content::after {
  opacity: 1;
}

/* Slime drips on the sides */
.slime-drip-left,
.slime-drip-right {
  position: absolute;
  top: 20px;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #4d5d31, #3e2f1b);
  opacity: 0.6;
  border-radius: 0 0 50% 50%;
  transition: height 0.8s ease;
}

.slime-drip-left {
  left: -2px;
}

.slime-drip-right {
  right: -2px;
}

.input-container.decomposing .slime-drip-left,
.input-container.decomposing .slime-drip-right {
  height: 60px;
}

/* ========================================
   CHARACTER-BY-CHARACTER GOOP TEXT
   ======================================== */
.composter-text-display {
  width: 100%;
  min-height: 140px;
  padding: 20px;
  font-family: 'Comic Neue', cursive;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #888;
  position: relative;
  z-index: 2;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Individual character styling */
.composter-char {
  display: inline-block;
  transition: all 0.4s ease;
  position: relative;
}

/* Rotting states */
.composter-char.rot-1 {
  color: #7a8a5a;
  transform: translateY(1px) rotate(0.5deg);
}

.composter-char.rot-2 {
  color: #6a7a4a;
  transform: translateY(2px) rotate(-1deg) scale(0.98);
  text-shadow: 0 1px 2px rgba(77, 93, 49, 0.2);
}

.composter-char.rot-3 {
  color: #5d6d3d;
  transform: translateY(4px) rotate(2deg) scale(0.96);
  text-shadow: 0 2px 4px rgba(77, 93, 49, 0.3);
  filter: blur(0.3px);
}

.composter-char.rot-4 {
  color: #4d5d31;
  transform: translateY(6px) rotate(-3deg) scale(0.93);
  text-shadow: 0 3px 6px rgba(62, 47, 27, 0.4);
  filter: blur(0.5px);
}

.composter-char.rot-5 {
  color: #3e2f1b;
  transform: translateY(10px) rotate(5deg) scale(0.88);
  text-shadow: 0 4px 8px rgba(62, 47, 27, 0.5);
  filter: blur(1px);
}

.composter-char.rot-6 {
  color: #2a1f12;
  transform: translateY(15px) rotate(-8deg) scale(0.8);
  text-shadow: 0 5px 10px rgba(42, 31, 18, 0.6);
  filter: blur(2px);
  opacity: 0.8;
}

/* Individual character animations for falling apart */
@keyframes charDecay1 {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(3px) rotate(2deg); }
}

@keyframes charDecay2 {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(5px) rotate(-3deg) scale(0.95); }
}

@keyframes charDecay3 {
  0% { transform: translateY(0) rotate(0); filter: blur(0); }
  100% { transform: translateY(8px) rotate(5deg) scale(0.9); filter: blur(1px); }
}

@keyframes charSink {
  0% { 
    transform: translateY(var(--base-y, 0)) rotate(var(--base-rot, 0deg));
    opacity: 1;
  }
  100% { 
    transform: translateY(calc(var(--base-y, 0) + 40px)) rotate(calc(var(--base-rot, 0deg) + 15deg)) scale(0.6);
    opacity: 0;
  }
}

.composter-char.sinking {
  animation: charSink 1.5s ease-in forwards;
}

/* The goop pile accumulation */
.goop-pile {
  position: absolute;
  bottom: 5px;
  left: 5%;
  right: 5%;
  min-height: 30px;
  background: linear-gradient(180deg, 
    rgba(77, 93, 49, 0.1) 0%, 
    rgba(62, 47, 27, 0.3) 50%, 
    rgba(42, 31, 18, 0.5) 100%);
  border-radius: 50% 50% 10px 10px;
  filter: blur(2px);
  z-index: 1;
  opacity: 0;
  transform: scaleY(0.3);
  transition: all 0.5s ease;
  pointer-events: none;
}

.goop-pile.visible {
  opacity: 1;
  transform: scaleY(1);
}

.goop-pile::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 20%;
  right: 20%;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(77, 93, 49, 0.2), transparent);
  border-radius: 50%;
}

/* Bubble effects in the goop */
.goop-bubble {
  position: absolute;
  background: rgba(100, 120, 70, 0.3);
  border-radius: 50%;
  animation: bubblePop 2s ease-in-out infinite;
}

@keyframes bubblePop {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

/* ========================================
   REAL TEXTAREA (HIDDEN BUT FUNCTIONAL)
   ======================================== */
.composter-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 10;
  cursor: text;
  resize: none;
  background: transparent;
  border: none;
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.8;
}

/* ========================================
   NECROSIS INDICATOR
   ======================================== */
.necrosis-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid #2d3d1f;
  position: relative;
  overflow: hidden;
}

.necrosis-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4d5d31, transparent);
  opacity: 0.3;
}

.indicator-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  white-space: nowrap;
}

.indicator-bar {
  flex: 1;
  height: 6px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  overflow: hidden;
  position: relative;
}

.indicator-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 5px,
    rgba(0,0,0,0.3) 5px,
    rgba(0,0,0,0.3) 10px
  );
}

.indicator-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    #5d6d3d 0%, 
    #4d5d31 30%, 
    #3e2f1b 60%, 
    #2a1f12 100%);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.indicator-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: slimeShine 2s ease-in-out infinite;
}

@keyframes slimeShine {
  0% { left: -100%; }
  100% { left: 100%; }
}

.indicator-value {
  font-size: 0.7rem;
  color: #666;
  font-family: 'Courier New', monospace;
  min-width: 35px;
  text-align: right;
}

/* ========================================
   COMPOST BUTTON
   ======================================== */
.composter-actions {
  display: flex;
  justify-content: flex-end;
  position: relative;
}

.compost-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: linear-gradient(180deg, #3d4d5a 0%, #2a3a47 100%);
  color: #ccc;
  border: 1px solid #4d5d6a;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.compost-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(77, 93, 49, 0.2), transparent);
  transition: left 0.5s ease;
}

.compost-btn:hover:not(:disabled)::before {
  left: 100%;
}

.compost-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #4d5d3a 0%, #3a4a37 100%);
  border-color: #5d6d4a;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(77, 93, 49, 0.25);
  color: #fff;
}

.compost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.7);
  background: #1a1a1a;
  border-color: #2a2a2a;
}

.compost-btn:disabled .btn-icon {
  animation: none;
}

.btn-icon {
  font-size: 1.2rem;
  animation: rotateIcon 3s linear infinite;
  filter: drop-shadow(0 0 4px rgba(77, 93, 49, 0.5));
}

@keyframes rotateIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========================================
   RESULT MESSAGE (REPLACES INPUT)
   ======================================== */
.composter-result {
  min-height: 280px;
  padding: 32px;
  background: linear-gradient(180deg, 
    rgba(10, 12, 8, 0.95) 0%, 
    rgba(13, 16, 10, 0.98) 50%, 
    rgba(16, 20, 12, 1) 100%);
  border: 1px solid rgba(77, 93, 49, 0.3);
  border-top: 4px solid #4d5d31;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease, transform 0.6s ease;
  position: relative;
  overflow: hidden;
}

.composter-result::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(77, 93, 49, 0.6), transparent);
}

.composter-result::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to top, rgba(77, 93, 49, 0.1), transparent);
  pointer-events: none;
}

.composter-result.result-visible {
  opacity: 1;
  transform: scale(1);
}

.result-icon {
  font-size: 2rem;
  color: #6a9a5a;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(77, 93, 49, 0.5));
  animation: iconFloat 4s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { 
    transform: translateY(0);
  }
  50% { 
    transform: translateY(-4px);
  }
}

.result-text {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  color: #777;
  line-height: 1.9;
}

.result-text strong {
  color: #6a8a5a;
  font-weight: 700;
}

.result-meta {
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(77, 93, 49, 0.2);
  font-size: 0.7rem;
  color: #4d5d4a;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

/* Submit Another Grievance Button */
.new-grievance-btn {
  margin-top: 24px;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(180deg, #2a3a2a 0%, #1a2a1a 100%);
  color: #7a9a6a;
  border: 1px solid #3d5d3d;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.new-grievance-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(77, 93, 49, 0.2), transparent);
  transition: left 0.5s ease;
}

.new-grievance-btn:hover::before {
  left: 100%;
}

.new-grievance-btn:hover {
  background: linear-gradient(180deg, #3a4a3a 0%, #2a3a2a 100%);
  border-color: #4d6d4d;
  color: #8aaa7a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(77, 93, 49, 0.2);
}

.new-grievance-btn:active {
  transform: translateY(0);
}

.new-grievance-btn .btn-icon {
  animation: rotateIcon 4s linear infinite;
}

/* ========================================
   NITROGEN COUNTER - FOOTER WIDGET
   ======================================== */
.nitrogen-counter-widget {
  background: linear-gradient(180deg, #050505 0%, #080a06 100%);
  border-top: 1px solid #1a1a1a;
  padding: 20px 40px;
  margin-top: 0;
  position: relative;
}

.nitrogen-counter-widget::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(77, 93, 49, 0.3), transparent);
}

.nitrogen-terminal {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  flex-wrap: wrap;
}

.terminal-prompt {
  color: #4d5d31;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(77, 93, 49, 0.4);
}

.terminal-label {
  color: #444;
  text-transform: uppercase;
}

.nitrogen-counter {
  color: #6a8a5a;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  background: rgba(77, 93, 49, 0.08);
  padding: 4px 10px;
  border: 1px solid rgba(77, 93, 49, 0.15);
  text-shadow: 0 0 4px rgba(77, 93, 49, 0.3);
}

.terminal-unit {
  color: #3a4a3a;
}

.terminal-cursor {
  color: #4d5d31;
  font-weight: 700;
  animation: blink 1.06s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .composter-container {
    padding: 20px;
  }
  
  .composter-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .composter-title {
    font-size: 0.8rem;
    width: 100%;
  }
  
  .composter-text-display {
    font-size: 0.85rem;
    padding: 15px;
  }
  
  .nitrogen-counter-widget {
    padding: 16px 20px;
  }
  
  .nitrogen-terminal {
    font-size: 0.7rem;
  }
}
