/* ==============================================
   HARVEST VALLEY - Farming Simulator
   Created by JH Games
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  font-family: 'Quicksand', 'Inter', sans-serif;
  cursor: default;
  user-select: none;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ===== LOGIN SCREEN ===== */
#login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #2d5016 0%, #4a7c23 30%, #6ba33e 60%, #8bc34a 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'Quicksand', sans-serif;
}

#login-screen .login-box {
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  min-width: 320px;
}

#login-screen .game-title {
  font-size: 36px; font-weight: 700; color: #2d5016;
  text-shadow: 2px 2px 0 #c5e1a5;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

#login-screen .game-subtitle {
  font-size: 13px; color: #689f38; margin-bottom: 24px;
  font-weight: 500;
}

#login-screen .jh-badge {
  font-size: 11px; color: #999; margin-bottom: 18px;
  letter-spacing: 1px;
}

#login-screen input {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px; font-weight: 500;
  padding: 12px 18px;
  background: #f1f8e9;
  color: #33691e;
  border: 2px solid #c5e1a5;
  border-radius: 10px;
  outline: none;
  width: 240px;
  margin-bottom: 10px;
  text-align: center;
  transition: border-color 0.2s;
}

#login-screen input:focus {
  border-color: #689f38;
}

#login-screen input::placeholder {
  color: #aed581;
}

#login-screen .btn-row {
  display: flex; gap: 10px; justify-content: center; margin: 14px 0 8px;
}

#login-screen .btn-login, #login-screen .btn-signup {
  font-family: 'Quicksand', sans-serif;
  font-size: 13px; font-weight: 600;
  padding: 10px 24px;
  background: #4caf50; color: #fff;
  border: none; border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#login-screen .btn-login:hover, #login-screen .btn-signup:hover {
  background: #388e3c; transform: translateY(-1px);
}

#login-screen .btn-signup {
  background: #8bc34a;
}

#login-screen .btn-signup:hover {
  background: #689f38;
}

#login-screen .btn-guest {
  font-family: 'Quicksand', sans-serif;
  font-size: 11px; font-weight: 500;
  padding: 8px 20px;
  background: none; color: #999;
  border: 1px dashed #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

#login-screen .btn-guest:hover {
  color: #666; border-color: #999;
}

#login-msg {
  font-size: 12px; color: #e53935;
  min-height: 20px; margin-top: 8px;
}

.login-footer {
  font-size: 9px; color: rgba(255,255,255,0.5);
  margin-top: 16px;
}

.login-jh {
  font-size: 10px; color: #ffd700; margin-top: 12px;
  font-weight: 600;
}

/* ===== HUD OVERLAY ===== */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Quicksand', sans-serif;
}

#hud > * {
  pointer-events: auto;
}

/* Top Left - Date/Time/Weather */
#hud-top-left {
  position: absolute; top: 12px; left: 12px;
  background: rgba(30,30,30,0.85);
  border-radius: 12px;
  padding: 10px 16px;
  color: #fff;
  font-size: 13px;
  min-width: 180px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
}

#hud-top-left .date-line {
  font-weight: 700; font-size: 15px; color: #aed581;
  margin-bottom: 4px;
}

#hud-top-left .time-line {
  font-size: 12px; color: #ccc;
  display: flex; align-items: center; gap: 8px;
}

#hud-top-left .weather-icon {
  font-size: 16px;
}

/* Top Right - Gold/Energy */
#hud-top-right {
  position: absolute; top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end;
}

.hud-gold {
  background: rgba(30,30,30,0.85);
  border-radius: 10px;
  padding: 8px 16px;
  color: #ffd700;
  font-size: 16px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,215,0,0.2);
}

.hud-energy {
  background: rgba(30,30,30,0.85);
  border-radius: 10px;
  padding: 8px 14px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 8px;
}

.energy-bar-bg {
  width: 100px; height: 10px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
}

.energy-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9800, #ffeb3b);
  border-radius: 5px;
  transition: width 0.3s;
}

.energy-label {
  color: #ffeb3b; font-size: 12px; font-weight: 600;
}

/* Bottom - Toolbar */
#hud-toolbar {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  background: rgba(30,30,30,0.9);
  border-radius: 14px;
  padding: 8px 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
}

.tool-slot {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.08);
  border: 2px solid transparent;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 22px;
  position: relative;
  transition: all 0.15s;
  cursor: pointer;
}

.tool-slot.active {
  border-color: #ffd700;
  background: rgba(255,215,0,0.15);
  box-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.tool-slot .tool-key {
  position: absolute; top: 2px; right: 4px;
  font-size: 9px; color: #888;
  font-weight: 600;
}

.tool-slot .tool-name {
  font-size: 8px; color: #aaa;
  margin-top: 2px;
}

/* Interaction Prompt */
#interaction-prompt {
  position: absolute; bottom: 86px; left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.9);
  border-radius: 10px;
  padding: 8px 18px;
  color: #aed581;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(174,213,129,0.3);
  display: none;
  white-space: nowrap;
}

/* ===== OVERLAY PANELS ===== */
.game-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.game-overlay.active {
  display: flex;
}

.overlay-panel {
  background: #f5f0e1;
  border-radius: 16px;
  padding: 24px;
  min-width: 400px;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border: 3px solid #8d6e2e;
  color: #3e2723;
}

.overlay-panel h2 {
  font-size: 22px;
  color: #33691e;
  margin-bottom: 16px;
  text-align: center;
  border-bottom: 2px solid #c5e1a5;
  padding-bottom: 8px;
}

.overlay-panel .close-btn {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 20px; cursor: pointer;
  color: #999;
  background: none; border: none;
  font-family: inherit;
}

.overlay-panel .close-btn:hover {
  color: #333;
}

/* Inventory grid */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.inv-slot {
  width: 64px; height: 64px;
  background: #e8dcc8;
  border: 2px solid #c4b898;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 24px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}

.inv-slot:hover {
  background: #ddd0b8;
}

.inv-slot .inv-count {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 10px; font-weight: 700; color: #5d4037;
}

.inv-slot .inv-name {
  font-size: 7px; color: #8d6e63;
  margin-top: 1px;
}

/* Shop items */
.shop-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #ede7d9;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}

.shop-item:hover {
  background: #e0d6c2;
}

.shop-item .item-icon {
  font-size: 28px;
  width: 40px; text-align: center;
}

.shop-item .item-info {
  flex: 1;
}

.shop-item .item-name {
  font-weight: 700; font-size: 14px; color: #3e2723;
}

.shop-item .item-desc {
  font-size: 11px; color: #795548;
}

.shop-item .item-price {
  font-weight: 700; color: #f57f17;
  font-size: 14px;
}

/* Quest log */
.quest-item {
  padding: 10px;
  background: #ede7d9;
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid #8bc34a;
}

.quest-item.completed {
  border-left-color: #9e9e9e;
  opacity: 0.6;
}

.quest-item .quest-title {
  font-weight: 700; font-size: 14px; color: #33691e;
}

.quest-item .quest-desc {
  font-size: 12px; color: #5d4037; margin-top: 4px;
}

.quest-item .quest-reward {
  font-size: 11px; color: #f57f17; margin-top: 4px; font-weight: 600;
}

/* NPC Dialog */
#npc-dialog {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245,240,225,0.97);
  border: 3px solid #8d6e2e;
  border-radius: 14px;
  padding: 20px 28px;
  max-width: 500px;
  min-width: 360px;
  z-index: 40;
  display: none;
  color: #3e2723;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

#npc-dialog .npc-name {
  font-weight: 700; font-size: 16px; color: #33691e;
  margin-bottom: 8px;
}

#npc-dialog .npc-text {
  font-size: 14px; line-height: 1.5;
  margin-bottom: 12px;
}

#npc-dialog .npc-options {
  display: flex; flex-wrap: wrap; gap: 8px;
}

#npc-dialog .npc-option {
  padding: 6px 16px;
  background: #4caf50; color: #fff;
  border: none; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600;
  transition: background 0.15s;
}

#npc-dialog .npc-option:hover {
  background: #388e3c;
}

/* Notification Toasts */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.9);
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  backdrop-filter: blur(6px);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.1);
}

.toast.gold { color: #ffd700; border-color: rgba(255,215,0,0.3); }
.toast.green { color: #aed581; border-color: rgba(174,213,129,0.3); }
.toast.red { color: #ef5350; border-color: rgba(239,83,80,0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Admin Panel */
#admin-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30,30,30,0.95);
  border: 2px solid #ffd700;
  border-radius: 16px;
  padding: 24px;
  z-index: 200;
  display: none;
  min-width: 360px;
  backdrop-filter: blur(10px);
}

#admin-panel h3 {
  color: #ffd700;
  text-align: center;
  margin-bottom: 16px;
  font-size: 18px;
}

#admin-panel .admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#admin-panel button {
  font-family: 'Quicksand', sans-serif;
  font-size: 12px; font-weight: 600;
  padding: 10px 12px;
  background: #333; color: #ffd700;
  border: 1px solid #555;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

#admin-panel button:hover {
  background: #444;
}

/* Fishing mini-game */
#fishing-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

#fishing-overlay.active {
  display: flex;
}

.fishing-game {
  background: #1a3a4a;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: #fff;
  border: 3px solid #4fc3f7;
  min-width: 280px;
}

.fishing-bar {
  width: 240px; height: 30px;
  background: #0d2b3a;
  border-radius: 15px;
  margin: 16px auto;
  position: relative;
  overflow: hidden;
  border: 2px solid #4fc3f7;
}

.fishing-zone {
  position: absolute;
  height: 100%;
  background: rgba(76,175,80,0.4);
  border-radius: 15px;
}

.fishing-cursor {
  position: absolute;
  width: 4px; height: 100%;
  background: #ffeb3b;
  border-radius: 2px;
  transition: none;
}

/* Map overlay */
#map-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 55;
  display: none;
  align-items: center;
  justify-content: center;
}

#map-overlay.active {
  display: flex;
}

#map-overlay canvas {
  border-radius: 12px;
  border: 3px solid #8d6e2e;
}

/* Crafting panel */
.craft-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #ede7d9;
  border-radius: 10px;
  margin-bottom: 8px;
  gap: 12px;
}

.craft-item .craft-mats {
  font-size: 11px; color: #795548;
}

.craft-item button {
  padding: 6px 14px;
  background: #8bc34a; color: #fff;
  border: none; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600;
}

.craft-item button:hover {
  background: #689f38;
}

.craft-item button:disabled {
  background: #999; cursor: not-allowed;
}

/* Scrollbar styling */
.overlay-panel::-webkit-scrollbar {
  width: 8px;
}
.overlay-panel::-webkit-scrollbar-thumb {
  background: #c4b898;
  border-radius: 4px;
}
.overlay-panel::-webkit-scrollbar-track {
  background: transparent;
}

/* Tab buttons for shop */
.tab-row {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}

.tab-btn {
  padding: 6px 14px;
  background: #e0d6c2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #5d4037;
  transition: all 0.15s;
}

.tab-btn.active {
  background: #4caf50;
  color: #fff;
}

.tab-btn:hover {
  background: #c5e1a5;
}

/* Building placement */
.building-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 30;
  font-size: 48px;
  opacity: 0.6;
}

/* ===== TUTORIAL ===== */
#tutorial-overlay {
  position: fixed; inset: 0;
  z-index: 300;
  pointer-events: none;
}

#tutorial-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.35);
  pointer-events: auto;
}

#tutorial-box {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245,240,225,0.97);
  border: 3px solid #4caf50;
  border-radius: 16px;
  padding: 20px 28px;
  max-width: 520px;
  min-width: 340px;
  color: #3e2723;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(76,175,80,0.3);
  pointer-events: auto;
  text-align: center;
  animation: tutorialPop 0.3s ease;
}

@keyframes tutorialPop {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

#tutorial-step-num {
  font-size: 11px;
  color: #689f38;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

#tutorial-text {
  font-size: 15px;
  line-height: 1.6;
  color: #3e2723;
  font-weight: 500;
  margin-bottom: 14px;
}

#tutorial-btn {
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 32px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

#tutorial-btn:hover {
  background: #388e3c;
  transform: translateY(-1px);
}

#tutorial-skip {
  margin-top: 10px;
}

#tutorial-skip button {
  font-family: 'Quicksand', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 14px;
  background: none;
  color: #999;
  border: 1px dashed #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s;
}

#tutorial-skip button:hover {
  color: #666;
  border-color: #999;
}

/* Tutorial highlight glow */
.tutorial-highlight {
  animation: tutorialGlow 1.2s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(76,175,80,0.6), 0 0 30px rgba(76,175,80,0.3) !important;
  border-color: #4caf50 !important;
  z-index: 301;
  position: relative;
}

@keyframes tutorialGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(76,175,80,0.6), 0 0 30px rgba(76,175,80,0.3); }
  50% { box-shadow: 0 0 25px rgba(76,175,80,0.9), 0 0 50px rgba(76,175,80,0.5); }
}

/* ===== PAUSE OVERLAY ===== */
#pause-overlay {
  position: fixed; inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

#pause-overlay.active {
  display: flex;
}

#pause-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

#pause-box {
  position: relative;
  background: rgba(245,240,225,0.97);
  border: 3px solid #8d6e2e;
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1;
}

#pause-title {
  font-family: 'Quicksand', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: #33691e;
  margin-bottom: 24px;
  letter-spacing: 4px;
}

#pause-box button {
  font-family: 'Quicksand', sans-serif;
  display: block;
  width: 200px;
  margin: 10px auto;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

#pause-resume {
  background: #4caf50;
  color: #fff;
}

#pause-resume:hover {
  background: #388e3c;
  transform: translateY(-1px);
}

#pause-quit {
  background: #e0d6c2;
  color: #5d4037;
}

#pause-quit:hover {
  background: #c5b89e;
  transform: translateY(-1px);
}

/* Created by footer */
#footer-credit {
  position: fixed;
  bottom: 4px; right: 8px;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  z-index: 5;
  pointer-events: none;
}
