/* ═══════════════════════════════════════════════════
   STARDEW PROFIT CALCULATOR  v7
   Asset paths relative to assets/css/style.css
   → assets/css/assets/
═══════════════════════════════════════════════════ */

/* ── Global Stardew cursor ───────────────────────
   Apply the pixel-art cursor to the whole panel so
   it never reverts to the browser default.        */
.sdv-calculator,
.sdv-calculator * {
  cursor: url("assets/cursor.webp") 0 0, auto;
}
/* Interactive elements keep the same cursor — no switch */
.sdv-calculator button,
.sdv-calculator [onclick],
.sdv-calculator .sdv-toggle,
.sdv-calculator .sdv-chip,
.sdv-calculator .sdv-dd-display,
.sdv-calculator .sdv-dd-item,
.sdv-calculator .sdv-season-btn,
.sdv-calculator .sdv-accord-head,
.sdv-calculator .sdv-recalc-btn,
.sdv-calculator select {
  cursor: url("assets/cursor.webp") 0 0, pointer;
}

/* ── Layout ──────────────────────────────────────── */
.sdv-calculator {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  font-family: 'Stardew Valley', serif;
  color: var(--text_color, #331f28);
  align-items: flex-start;
}

.sdv-panel {
  width: 320px;
  min-width: 280px;
  flex-shrink: 0;
  padding-bottom: 16px;
}

.sdv-chart-area {
  flex: 1;
  min-width: 0;
  padding-left: 14px;
  overflow-x: auto;
}

.sdv-graph-title {
  font-family: 'Stardew Valley', serif;
  font-size: 42px;
  margin: 0 0 10px 60px;
  color: var(--text_color, #331f28);
  text-shadow: var(--text_shadow, #ce9c5f) -2px 1px;
}

.sdv-calculator .graph   { overflow-x: auto; }
.sdv-calculator svg      { overflow: visible; display: block; }
.sdv-calculator .axis text {
  font-family: 'Stardew Valley', serif;
  font-size: 22px;
  text-shadow: none;
}
.sdv-calculator .axis path,
.sdv-calculator .axis line { stroke: #2b1a0b; shape-rendering: crispEdges; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════
   SEASON TABS
═══════════════════════════════════════════════════ */
.sdv-season-tabs {
  display: flex;
  align-items: flex-end;
  padding-left: 6px;
  margin-bottom: -40px;
  position: relative;
  z-index: 50;
}

.sdv-season-btn {
  width: 58px;
  height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-family: 'Stardew Valley', serif;
  font-size: 12px;
  color: var(--text_color, #331f28);
  background: var(--container_color, #ffc878);
  border-image-source: url("assets/tab_border.png");
  border-style: solid;
  border-width: 20px;
  border-image-slice: 24 22;
  border-image-repeat: round;
  border-radius: 20px;
  image-rendering: pixelated;
  text-align: center;
  user-select: none;
  /* Dim inactive tabs */
  filter: brightness(0.88) saturate(0.7);
  transition: filter 80ms;
}
.sdv-season-btn:hover {
  filter: brightness(0.95) saturate(0.9);
}

/* ── Active tab: full color + slightly taller ── */
.sdv-season-btn.sdv-season-active {
  height: 76px;
  filter: none;               /* full color */
  position: relative;
  z-index: 2;
}

.sdv-sico {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════
   ACCORDION
═══════════════════════════════════════════════════ */
.sdv-accordion-list {
  background: var(--gradient-bg,
    linear-gradient(180deg,
      var(--container_color,  #ffc878) 0%,
      var(--container_color2, #f8ba70) 50%,
      var(--container_color3, #eba867) 100%));
  border-image: url("assets/border.png") 24 22 round;
  border-width: 16px;
  border-style: solid;
  border-radius: 0 0 14px 14px;
  padding: 4px 3px 10px;
  position: relative;
  z-index: 60;
}

.sdv-accord { margin: 2px 1px; border-radius: 8px; }

/* ── Header ── */
.sdv-accord-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-family: 'Stardew Valley', serif;
  font-size: 18px;
  color: var(--text_color, #331f28);
  background: rgba(120,60,20,0.10);
  border: none;
  border-radius: 8px;
  text-align: left;
  text-shadow: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background 80ms;
}
.sdv-accord-head:hover { background: rgba(120,60,20,0.20); }

/* ── Open/active state: left accent bar + richer bg ── */
.sdv-accord.sdv-open > .sdv-accord-head {
  background: rgba(120,60,20,0.28);
  border-radius: 8px 8px 0 0;
  border-left: 4px solid rgba(180,100,30,0.7);
  padding-left: 8px;              /* compensate for the border */
  box-shadow: inset 0 -2px 0 rgba(255,255,255,0.12);
}

.sdv-aico { font-size: 16px; flex-shrink: 0; }
.sdv-albl { flex: 1; }
.sdv-aarw {
  font-size: 11px;
  color: #8c4f21;
  flex-shrink: 0;
  transition: transform 200ms ease;
  pointer-events: none;
}
.sdv-accord.sdv-open .sdv-aarw { transform: rotate(180deg); }

/* ── Body ── */
.sdv-accord-body {
  display: none;
  padding: 8px 12px 12px;
  background: rgba(255,255,255,0.10);
  border-radius: 0 0 8px 8px;
  border-top: 2px solid rgba(140,79,33,0.18);
  /* match the left accent from the open header */
  border-left: 4px solid rgba(180,100,30,0.7);
}
.sdv-accord.sdv-open .sdv-accord-body { display: block; }

/* ═══════════════════════════════════════════════════
   FLOATING TOOLTIP  (body-level)
═══════════════════════════════════════════════════ */
.sdv-float-tip {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 999999;
  font-family: 'Stardew Valley', serif;
  font-size: 19px;
  line-height: 1.45;
  padding: 10px 16px;
  max-width: 260px;
  text-align: center;
  color: var(--text_color, #331f28);
  text-shadow: var(--text_shadow, #ce9c5f) -1px 1px;
  background: var(--container_color, #ffc878);
  border-image: url("assets/tooltip_border.png") 24 22 round;
  border-width: 16px;
  border-style: solid;
  border-radius: 20px;
  image-rendering: pixelated;
  box-shadow: 0 5px 0 rgba(120,72,28,0.85), 0 8px 16px rgba(0,0,0,0.35);
  transition: opacity 100ms linear;
}
.sdv-float-tip.sdv-float-tip--on {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════════
   FIELD ROWS
═══════════════════════════════════════════════════ */
.sdv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(140,79,33,0.12);
}
.sdv-row:last-child { border-bottom: none; }

/* Seed Sources: label left, chips right — single row, no wrapping */
.sdv-row-seeds {
  flex-wrap: nowrap;
  align-items: center;
}
.sdv-row-seeds .sdv-lbl {
  flex: 0 0 auto;
  width: auto;
  margin-right: 8px;
}
.sdv-row-seeds .sdv-chips {
  flex: 1;
  justify-content: flex-end;
}

/* ── Label: LARGER font so it's readable ── */
.sdv-lbl {
  font-family: 'Stardew Valley', serif;
  font-size: 17px;           /* was 14px → now 17px */
  color: var(--text_color, #331f28);
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  text-shadow: none;
}

/* ═══════════════════════════════════════════════════
   CUSTOM DROPDOWN
═══════════════════════════════════════════════════ */
.sdv-dd {
  position: relative;
  flex-shrink: 0;
  width: 152px;
}

.sdv-dd-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 6px 8px;
  font-family: 'Stardew Valley', serif;
  font-size: 15px;           /* was 13px */
  color: var(--text_color, #331f28);
  background: var(--container_color, #ffc878);
  border: 3px solid #b86f32;
  border-radius: 8px;
  text-shadow: none;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 3px 0 rgba(120,72,28,0.45);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sdv-dd-display:hover { filter: brightness(1.06); }

.sdv-dd-arrow {
  font-size: 10px;
  color: #8c4f21;
  flex-shrink: 0;
  transition: transform 150ms;
  pointer-events: none;
}
.sdv-dd--open .sdv-dd-arrow { transform: rotate(180deg); }

.sdv-dd-list {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 9000;
  max-height: 220px;
  overflow-y: auto;
  background: var(--container_color, #ffc878);
  border: 3px solid #8c4f21;
  border-radius: 8px;
  box-shadow: 0 6px 0 rgba(120,72,28,0.65), 0 8px 20px rgba(0,0,0,0.30);
  padding: 3px;
}
.sdv-dd--open .sdv-dd-list { display: block; }

.sdv-dd-list::-webkit-scrollbar { width: 6px; }
.sdv-dd-list::-webkit-scrollbar-track { background: #f3c07a; }
.sdv-dd-list::-webkit-scrollbar-thumb { background: #b86f32; border-radius: 3px; }

.sdv-dd-item {
  padding: 7px 10px;
  font-family: 'Stardew Valley', serif;
  font-size: 15px;           /* was 13px */
  color: var(--text_color, #331f28);
  border-radius: 5px;
  text-shadow: none;
  transition: background 60ms;
  user-select: none;
  white-space: nowrap;
}
.sdv-dd-item:hover        { background: rgba(140,79,33,0.22); }
.sdv-dd-item.sdv-dd-item--sel {
  background: rgba(140,79,33,0.30);
  box-shadow: inset 2px 0 0 #8c4f21;
}

.sdv-dd--disabled .sdv-dd-display {
  opacity: 0.45;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   STEPPER  − [n] +
═══════════════════════════════════════════════════ */
.sdv-stepper {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.sdv-stepper button {
  width: 30px;
  box-sizing: border-box;
  font-family: 'Stardew Valley', serif;
  font-size: 20px;
  color: var(--text_color, #331f28);
  background: var(--container_color2, #f8ba70);
  border: 3px solid #b86f32;
  padding: 4px 0;
  box-shadow: 0 3px 0 rgba(120,72,28,0.45);
  text-shadow: none;
  flex-shrink: 0;
  transition: filter 80ms;
  user-select: none;
  vertical-align: middle;
}
.sdv-stepper button:first-child { border-radius: 8px 0 0 8px; border-right: none; }
.sdv-stepper button:last-child  { border-radius: 0 8px 8px 0; border-left:  none; }
.sdv-stepper button:hover  { filter: brightness(1.12); }
.sdv-stepper button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120,72,28,0.45); }

.sdv-stepper input[type="number"] {
  width: 36px;
  box-sizing: border-box;
  font-family: 'Stardew Valley', serif;
  font-size: 17px;
  background: var(--container_color, #ffc878);
  border: 3px solid #b86f32;
  border-left:  2px solid rgba(140,79,33,0.3);
  border-right: 2px solid rgba(140,79,33,0.3);
  border-radius: 0;
  padding: 4px 2px;
  text-align: center;
  color: var(--text_color, #331f28);
  text-shadow: none;
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.2);
  -moz-appearance: textfield;
  appearance: textfield;
  vertical-align: middle;
}
.sdv-stepper input::-webkit-inner-spin-button,
.sdv-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.sdv-stepper input:focus { outline: none; }

/* ═══════════════════════════════════════════════════
   CUSTOM TOGGLE
═══════════════════════════════════════════════════ */
.sdv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 150ms;
}

.sdv-tog-track {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  background: #a06030;
  border: 3px solid #7a4020;
  border-radius: 11px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  flex-shrink: 0;
  transition: background 150ms, border-color 150ms;
}
.sdv-toggle.sdv-tog-on .sdv-tog-track {
  background: #4a9020;
  border-color: #2a5c10;
}

.sdv-tog-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: #fde8b0;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.2);
  box-shadow: 0 2px 3px rgba(0,0,0,0.28);
  transition: transform 150ms ease, background 150ms;
}
.sdv-toggle.sdv-tog-on .sdv-tog-thumb {
  transform: translateX(20px);
  background: #c8f090;
}

.sdv-tog-txt {
  font-family: 'Stardew Valley', serif;
  font-size: 15px;           /* was 12px */
  color: var(--text_color, #331f28);
  text-shadow: none;
}

/* ═══════════════════════════════════════════════════
   SEED SOURCE CHIPS
═══════════════════════════════════════════════════ */
.sdv-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.sdv-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-family: 'Stardew Valley', serif;
  font-size: 15px;           /* was 13px */
  color: var(--text_color, #331f28);
  background: var(--container_color2, #f8ba70);
  border: 3px solid #b86f32;
  border-radius: 20px;
  text-shadow: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background 80ms, border-color 80ms;
}
.sdv-chip:hover  { filter: brightness(1.08); }
.sdv-chip.sdv-chip-on {
  background: #4a9020;
  border-color: #2a5c10;
  color: #f0ffe0;
}

/* ═══════════════════════════════════════════════════
   SECTION LABEL  (Farming / Foraging)
═══════════════════════════════════════════════════ */
.sdv-sect-lbl {
  font-family: 'Stardew Valley', serif;
  font-size: 13px;
  color: #6b3215;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 5px 2px 2px;
  border-bottom: 2px solid rgba(140,79,33,0.25);
  margin-bottom: 3px;
  text-shadow: none;
}

/* ═══════════════════════════════════════════════════
   FOOD BUFF HINT
═══════════════════════════════════════════════════ */
.sdv-food-hint {
  margin: 4px 0 6px;
  padding: 8px 12px;
  font-family: 'Stardew Valley', serif;
  font-size: 14px;
  line-height: 1.5;
  color: #2b1405;
  text-shadow: none;
  background: rgba(255,255,255,0.30);
  border: 2px solid rgba(140,79,33,0.35);
  border-left: 4px solid #8c4f21;
  border-radius: 6px;
}
.sdv-food-hint strong {
  color: #4a9020;
  display: block;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════
   RECALCULATE BUTTON  — compact, centered
═══════════════════════════════════════════════════ */
.sdv-recalc-row {
  padding: 8px 2px 2px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sdv-recalc-btn {
  display: inline-block;
  width: auto !important;
  min-width: 0 !important;
  max-width: fit-content !important;
  align-self: center;
  flex-shrink: 0;
  font-family: 'Stardew Valley', serif;
  font-size: 18px;
  padding: 8px 32px;
  color: var(--text_color, #331f28);
  background: var(--container_color, #ffc878);
  border: 4px solid #8c4f21;
  border-radius: 10px;
  box-shadow: 0 5px 0 #5e2f12, inset 0 2px 0 rgba(255,255,255,0.35);
  text-shadow: none;
  user-select: none;
  transition: filter 80ms, transform 80ms;
}
.sdv-recalc-btn:hover  { filter: brightness(1.07); }
.sdv-recalc-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #5e2f12; }

/* ═══════════════════════════════════════════════════
   CROP TOOLTIP  (d3)
═══════════════════════════════════════════════════ */
.sdv-tooltip {
  position: absolute;
  padding: 14px 18px;
  max-width: 340px;
  font-family: 'Stardew Valley', serif;
  font-size: 26px;
  line-height: 1.15;
  text-align: center;
  background: var(--container_color, #ffc878);
  color: var(--text_color, #331f28);
  text-shadow: var(--text_shadow, #ce9c5f) -2px 1px;
  border-image-source: url("assets/tooltip_border.png");
  border-style: solid;
  border-width: 18px;
  border-image-slice: 24 22;
  border-image-repeat: round;
  border-radius: 20px;
  image-rendering: pixelated;
  z-index: 9999;
  transition: opacity 80ms linear;
  box-shadow: 0 6px 0 rgba(120,72,28,0.85), 0 10px 18px rgba(0,0,0,0.35);
}
.tooltipTitle      { font-size: 34px; margin-bottom: 7px; }
.tooltipTitleExtra { font-size: 24px; margin-top: 12px; margin-bottom: 4px; }
.tooltipTable      { width: 100%; margin-bottom: 4px; }
.tooltipTable td   { padding: 3px 5px; font-size: 22px; }
.tooltipTdLeft, .tooltipTdLeftSpace { opacity: 0.9; }
.tooltipTdRightPos { color: #2a7a30; font-weight: bold; }
.tooltipTdRightNeg { color: #a03020; font-weight: bold; }
.tooltipTdRight    { font-weight: bold; }
.tooltipTdRight .gold,
.tooltipTdRightPos .gold,
.tooltipTdRightNeg .gold { display: inline-block; margin-left: 4px; vertical-align: middle; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 820px) {
  .sdv-calculator { flex-direction: column; }
  .sdv-panel      { width: 100%; min-width: unset; }
  .sdv-chart-area { padding: 12px 0 0; width: 100%; }
  .sdv-float-tip  { display: none !important; }
}
