@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;500;700;800;900&family=Mali:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Prompt:wght@400;500;600;700&display=swap');

:root {
  --font-thai: 'Mali', 'Prompt', cursive, sans-serif;
  --font-cute: 'M PLUS Rounded 1c', 'Mali', sans-serif;
  
  /* Japanese Countryside Pastel Palette */
  --farm-bg: #fcf8f2;
  --farm-card: #ffffff;
  --farm-border: #f0e4d4;
  --farm-border-dark: #e6d3be;
  
  --cocoa-dark: #3a2a20;
  --cocoa-medium: #5c4333;
  --cocoa-light: #8e7362;
  
  --strawberry-pink: #ff6b8b;
  --strawberry-soft: #ffe4ea;
  --strawberry-deep: #e63956;
  --strawberry-milk: #fff0f3;
  
  --matcha-green: #58a773;
  --matcha-soft: #e3f4e9;
  --matcha-deep: #387e52;
  
  --sun-yellow: #f8b84e;
  --sun-soft: #fef4df;
  
  --sky-blue: #56a8cf;
  --sky-soft: #e6f4fb;
  
  --wood-light: #eddcc8;
  --wood-medium: #cfb395;
  --wood-dark: #916e4e;
}

body {
  font-family: var(--font-thai);
  background-color: var(--farm-bg);
  background-image: 
    radial-gradient(#eedbc6 1.3px, transparent 1.3px), 
    radial-gradient(#f7e7da 1.3px, var(--farm-bg) 1.3px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  color: var(--cocoa-dark);
}

/* Custom Japanese Kawaii Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f7ede2;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: #debfa0;
  border-radius: 999px;
  border: 2px solid #f7ede2;
}
::-webkit-scrollbar-thumb:hover {
  background: #c59f7c;
}

/* Kawaii Farm Card Style */
.farm-card {
  background: var(--farm-card);
  border: 2.5px solid var(--farm-border);
  border-radius: 28px;
  box-shadow: 0 10px 24px -6px rgba(133, 94, 60, 0.08), 0 3px 6px -1px rgba(133, 94, 60, 0.04);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.farm-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px -8px rgba(225, 90, 120, 0.15), 0 6px 12px -2px rgba(133, 94, 60, 0.06);
  border-color: #f7cfd8;
}

/* Washi Tape Ribbon Effect */
.washi-tape {
  position: absolute;
  top: -12px;
  left: 24px;
  padding: 3px 16px;
  background: rgba(255, 175, 190, 0.85);
  color: #94253d;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  transform: rotate(-1.5deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  backdrop-filter: blur(2px);
  border-left: 2px dashed rgba(255, 255, 255, 0.7);
  border-right: 2px dashed rgba(255, 255, 255, 0.7);
  z-index: 10;
}

.washi-tape-green {
  background: rgba(162, 222, 182, 0.9);
  color: #1e5a35;
  transform: rotate(1deg);
}

.washi-tape-yellow {
  background: rgba(255, 224, 148, 0.9);
  color: #8c6008;
  transform: rotate(-1deg);
}

.washi-tape-blue {
  background: rgba(175, 223, 245, 0.9);
  color: #185a7d;
  transform: rotate(1.5deg);
}

/* Wooden Signpost Header */
.wooden-board {
  background: linear-gradient(180deg, #f7ece0 0%, #eddac4 100%);
  border: 3px solid #ceb396;
  border-radius: 24px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.7), 0 8px 16px rgba(115, 80, 50, 0.08);
  position: relative;
}

/* Cute Cloud Float Animation */
@keyframes cuteFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(1.5deg); }
}

.cute-float {
  animation: cuteFloat 4s ease-in-out infinite;
}

@keyframes gentleBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.gentle-bounce {
  animation: gentleBounce 2.5s ease-in-out infinite;
}

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

.gentle-spin {
  animation: gentleSpin 6s linear infinite;
}

/* Animated Water Wave in Tank Card */
.tank-visual-container {
  position: relative;
  width: 100%;
  height: 64px;
  background: #f1f7fa;
  border-radius: 16px;
  border: 2px dashed #b5daec;
  overflow: hidden;
}

.tank-water-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(180deg, #64c2ec 0%, #3a9fd0 100%);
  border-radius: 0 0 14px 14px;
  transition: height 0.8s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* Cute Candy Pill Toggle Switch */
.cute-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 32px;
}

.cute-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cute-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ebdcd0;
  border: 2.5px solid #d5beab;
  transition: .35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 34px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.cute-slider:before {
  position: absolute;
  content: "OFF";
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: #9c826e;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 2.5px;
  background-color: #ffffff;
  border: 1.5px solid #d5beab;
  transition: .35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

input:checked + .cute-slider {
  background-color: #72cf97;
  border-color: #4ea873;
}

input:checked + .cute-slider.pump-slider {
  background-color: #63bee6;
  border-color: #3b97bf;
}

input:checked + .cute-slider.fan-slider {
  background-color: #8ed081;
  border-color: #61a654;
}

input:checked + .cute-slider:before {
  content: "ON";
  color: #387e52;
  transform: translateX(27px);
  border-color: #4ea873;
}

input:checked + .cute-slider.pump-slider:before {
  color: #1e7096;
  border-color: #3b97bf;
}

input:disabled + .cute-slider {
  background-color: #f0e9e4;
  border-color: #e2d7d0;
  cursor: not-allowed;
  opacity: 0.65;
}

/* Pulsing cute radar */
.pulse-cute-green {
  box-shadow: 0 0 0 0 rgba(88, 167, 115, 0.7);
  animation: pulseGreenCute 2s infinite;
}

@keyframes pulseGreenCute {
  0% { box-shadow: 0 0 0 0 rgba(88, 167, 115, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(88, 167, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(88, 167, 115, 0); }
}

.pulse-cute-red {
  box-shadow: 0 0 0 0 rgba(230, 57, 86, 0.7);
  animation: pulseRedCute 1.5s infinite;
}

@keyframes pulseRedCute {
  0% { box-shadow: 0 0 0 0 rgba(230, 57, 86, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(230, 57, 86, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 57, 86, 0); }
}

/* Toast Notifications */
.kawaii-toast {
  background: #ffffff;
  border: 2.5px solid #f2d2dc;
  border-radius: 20px;
  box-shadow: 0 12px 28px -6px rgba(180, 80, 100, 0.18), 0 4px 8px rgba(0,0,0,0.05);
  font-family: var(--font-thai);
}

/* Input boxes in form */
.cute-input {
  background-color: #faf5ee;
  border: 2px solid #ecdac6;
  border-radius: 16px;
  color: var(--cocoa-dark);
  font-family: var(--font-cute);
  font-weight: 700;
  transition: all 0.2s ease;
}

.cute-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: #ff8fa3;
  box-shadow: 0 0 0 4px rgba(255, 143, 163, 0.2);
}

/* Cute Progress Bar */
.cute-progress-bar {
  background-color: #f1e4d3;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

/* Slow Glowing Text for Elec-TBAC Credit */
@keyframes slowGlowPulse {
  0%, 100% {
    text-shadow: 0 0 4px rgba(126, 34, 206, 0.4), 0 0 10px rgba(192, 132, 252, 0.3);
    filter: drop-shadow(0 0 2px rgba(168, 85, 247, 0.3));
    color: #6b21a8;
  }
  50% {
    text-shadow: 0 0 12px rgba(147, 51, 234, 0.85), 0 0 22px rgba(216, 180, 254, 0.75);
    filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.6));
    color: #7e22ce;
  }
}

.glow-slow {
  animation: slowGlowPulse 3.5s ease-in-out infinite;
}

/* Lightweight Zero-Lag Micro-Interactions for Emoticons & Icons */
.cute-pop {
  display: inline-block;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
  will-change: transform;
}

.cute-pop:hover {
  transform: scale(1.22) rotate(6deg);
}

/* Subtle continuous floating for main feature icons */
.cute-wiggle {
  display: inline-block;
  animation: cuteWiggle 3.2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes cuteWiggle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(-3deg); }
  75% { transform: translateY(1.5px) rotate(3deg); }
}

/* Tabs styling in Formula Settings Card */
.formula-tab {
  transition: all 0.25s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.formula-tab.active {
  background: #ffffff;
  color: #3a2a20;
  box-shadow: 0 4px 12px rgba(115, 80, 50, 0.12);
  border-color: #ecdac6;
}

.formula-tab:not(.active) {
  color: #8e7362;
  background: transparent;
}

.formula-tab:not(.active):hover {
  color: #e11d48;
}

/* ===== Farm Diary pop-up panel ===== */
#diaryModal.open {
  display: flex;
}
#diaryModal.open .diary-panel {
  animation: diaryPopIn 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes diaryPopIn {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#diaryUnreadBadge:not(.hidden) {
  animation: badgeBounce 0.4s cubic-bezier(0.34, 1.6, 0.64, 1);
}
@keyframes badgeBounce {
  from { transform: scale(0.4); }
  to   { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #diaryModal.open .diary-panel,
  #diaryUnreadBadge:not(.hidden) { animation: none; }
}

/* ===== Admin PIN Modal & View-Only Lock ===== */
#pinModal.open {
  display: flex;
}
#pinModal.open .pin-panel {
  animation: diaryPopIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.view-only-disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}
