* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  background: #1e2128;
  color: #ffffff;
  padding: 20px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 1600px;
  margin: 0 auto;
}

.header {
  display: grid;
  grid-template-columns: 2fr 3fr 2fr;
  gap: 25px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.info-card {
  background: #2a2f38;
  padding: 15px 20px;
  border-radius: 12px;
}

.label { font-size: 1.2rem; color: #9aa0aa; }
.value { font-size: 1.1rem; font-weight: 600; }

/* Manual mode toggle */
.manual-toggle-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.manual-mode-status {
  font-size: 0.9rem;
  color: #9aa0aa;
}

.manual-mode-status.on {
  color: #3fd07f;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #4b5563;
  transition: 0.3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #16a34a;
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* MIXER CARD – compact row */
.rpm-card {
  background: linear-gradient(145deg, #2a2f38, #242831);
  padding: 18px 20px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;               /* minimal height */
}

.rpm-card h2 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 6px;
}

.mixer-control-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.status-light {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4b5563;
  box-shadow: 0 0 0 3px #374151;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.status-light.on      { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.7); }
.status-light.paused  { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.7); }
.status-light.off,
.status-light.stopped { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.6); }

.mix-timer {
  font-size: 1.25rem;
  font-weight: 600;
  color: #d1d5db;
  white-space: nowrap;
  flex-shrink: 0;
}

.control-buttons {
  display: flex;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
  height: 20;
}

.btn {
  padding: 2px 24px;
  font-size: 0.95rem;
  font-weight: bold;
  border: 2px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.25s ease;
  min-width: 100px;
}

.btn.start  { background: #166534; color: white; }
.btn.pause  { background: #92400e; color: white; }
.btn.stop   { background: #991b1b; color: white; }

.btn.active {
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
  transform: scale(1.04);
}

.btn.start.active  { background: #16a34a; box-shadow: 0 0 16px rgba(34,197,94,0.5); }
.btn.pause.active  { background: #f59e0b; box-shadow: 0 0 16px rgba(245,158,11,0.5); }
.btn.stop.active   { background: #dc2626; box-shadow: 0 0 16px rgba(220,38,38,0.5); }

.btn:hover:not(.active) {
  opacity: 0.92;
  transform: scale(1.03);
}

/* MAIN CARD */
.main { 
	display: grid; 
	grid-template-columns: 1fr; 
}

.card {
  background: #2a2f38;
  padding: 24px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.batch-summary {
  text-align: center;
  padding: 14px;
  background: #242831;
  border-radius: 12px;
}

.batch-total {
  display: flex;
  justify-content: space-around;
  font-size: 1.2rem;
  gap: 16px;
  flex-wrap: wrap;
}

.batch-total strong { 
	font-size: 1.7rem; 
	color: #3fd07f; 
}

.active-ingredient {
  background: #1f232b;
  border: 3px solid #3fd07f;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.active-ingredient h3 {
  color: #3fd07f;
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.active-name {
  font-size: 3rem;
  font-weight: 800;
  margin: 10px 0 16px;
}

.active-remaining-large {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #e0e0e0;
}

.progress-bar.massive {
  height: 44px;
  background: #2a2f38;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3fd07f, #66ffa3);
  transition: width 0.6s ease-out, background 0.8s ease;
  min-width: 6px;
}

.progress-fill.near {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-fill.over {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Ingredient list */
.ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ingredient-item {
  padding: 14px 18px;
  background: #242831;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.ingredient-item:hover { background: #333a44; }

.ingredient-item.active {
  background: #2a3a2f;
  border: 2px solid #3fd07f;
}

.ingredient-item.previous { opacity: 0.75; }

.ingredient-item.selectable-ingredient {
  border: 2px dashed #3fd07f;
}

.progress-bar.small {
  height: 10px;
  background: #1f232b;
  border-radius: 5px;
}

/* Ingredient confirmation banner */
.confirm-banner-area {
  min-height: 80px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.confirm-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  padding: 14px 20px;
  background: #1a3a28;
  border: 2px solid #3fd07f;
  border-radius: 10px;
  animation: pulse-border 1s ease-in-out infinite alternate;
}

@keyframes pulse-border {
  from { border-color: #3fd07f; box-shadow: 0 0 0px rgba(63,208,127,0); }
  to   { border-color: #66ffaa; box-shadow: 0 0 12px rgba(63,208,127,0.45); }
}

.confirm-message {
  font-size: 1.1rem;
  font-weight: 600;
  color: #3fd07f;
}

.confirm-btn {
  min-width: 220px;
  padding: 10px 24px;
  font-size: 1rem;
}

/* Manual weight input - hidden until Manual Weight Entry is enabled */
.manual-input-row {
  display: none;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #374151;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.manual-input-row.visible {
  display: flex;
}

.manual-input-label {
  font-size: 0.95rem;
  color: #9aa0aa;
}

.manual-input-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.manual-weight-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #3a414e;
  background: #1f232b;
  color: #ffffff;
  font-size: 1rem;
  outline: none;
}

.manual-weight-input:focus {
  border-color: #3fd07f;
}

.manual-weight-hint {
  font-size: 0.85rem;
  color: #9aa0aa;
}

.manual-numpad {
  margin-top: 10px;
  display: none; /* shown only when manual mode is enabled */
}

.manual-numpad.visible {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-numpad-row {
  display: flex;
  gap: 8px;
}

.numpad-key {
  flex: 1 1 0;
  padding: 16px 0;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: transparent;
  color: #e5e7eb;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
}

.numpad-key:hover {
  background: rgba(229, 231, 235, 0.1);
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.numpad-key:active {
  background: #e5e7eb;
  color: #111827;
  transform: scale(0.97);
}

.wide-key {
  flex: 2 1 0;
}

/* Cow Amount Adjuster */
.cow-amount-adjuster {
  margin-top: 12px;
  padding: 12px 16px;
  background: #1f232b;
  border-radius: 10px;
}

.cow-amount-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.btn-adjuster {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  background: #3a414e;
  color: #ffffff;
  transition: background 0.2s;
}

.btn-adjuster:hover {
  background: #4b5563;
}

.btn-adjuster:active {
  background: #3fd07f;
  color: #1f232b;
}

.cow-amount-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #3fd07f;
  min-width: 60px;
  text-align: center;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.75);
}

.modal-content {
  background: #2a2f38;
  margin: 8% auto;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
}

.close-modal {
  color: #9aa0aa;
  float: right;
  font-size: 2.8rem;
  cursor: pointer;
}

.close-modal:hover { color: white; }.

.diet-option {
  padding: 16px 20px;
  margin-bottom: 12px;
  background: #242831;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.diet-option:hover { background: #333a44; }

.diet-option.selected {
  border-color: #3fd07f;
  background: #2a3a2f;
}

.panel {
  background: #2a2f38;
  padding: 20px;
  border-radius: 12px;
  flex: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 1100px) {
  .header { grid-template-columns: 1fr; }
  .header-right { flex-direction: column; }
  .mixer-control-row { gap: 16px; }
  .control-buttons { margin-left: 0; justify-content: center; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .btn { padding: 10px 20px; font-size: 0.9rem; min-width: 90px; }
  .mix-timer { font-size: 1.15rem; }
  .status-light { width: 36px; height: 36px; }
}

/* Side-by-side panels in the right column */
.panels-row {
  display: flex;
  gap: 15px;
  height: 100%;
}

.panels-row .panel {
  flex: 1;                     /* equal width */
  background: #2a2f38;
  padding: 20px;
  border-radius: 12px;
}

/* Batch summary – horizontal layout */
.batch-summary {
  padding: 12px;
  background: #242831;
  border-radius: 12px;
}

.batch-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;           /* wrap if too narrow */
}

.batch-item {
  flex: 1;
  min-width: 140px;          /* prevents items from shrinking too much */
  text-align: center;
}

.batch-label {
  font-size: 0.9rem;
  color: #9aa0aa;
  display: block;
  margin-bottom: 4px;
}

.batch-total strong {
  font-size: 1.6rem;
  color: #3fd07f;
  display: block;
}

/* Portrait dashboard screen (720x1920) */
@media (max-width: 800px) and (min-height: 1000px) {
  .header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header-left,
  .header-center,
  .header-right {
    width: 100%;
  }

  .panels-row {
    flex-direction: column;
    gap: 12px;
  }

  .active-ingredient {
    min-height: 420px;
  }

  .active-name {
    font-size: 2.5rem;
  }

  .confirm-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .confirm-banner-area {
    min-height: 100px;
  }
}

/* Only fully stack on very small screens (e.g. phones <500–550px) */
@media (max-width: 500px) {
  .header-right {
    flex-direction: column;
    gap: 16px;
  }

  .header-right .panel {
    flex: 1 1 100%;               /* full width when stacked */
    min-width: auto;
  }
  
  .batch-total {
    flex-direction: column;
    gap: 12px;
  }

  .batch-item {
    min-width: auto;
  }
}

/* ── Overlay panels (Save Batch & Next Batch) ─────────────────────────────── */

.overlay-panel {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.9) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.overlay-card {
  position: relative;
  background: #2a2f38;
  border-radius: 18px;
  padding: 36px 40px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.close-overlay {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 2rem;
  color: #9aa0aa;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-overlay:hover {
  color: #ffffff;
}

.overlay-title {
  font-size: 1.5rem;
  color: #3fd07f;
  margin: 0;
}

.overlay-subtitle {
  font-size: 1rem;
  color: #9aa0aa;
  margin: 0;
}

.overlay-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

/* Batch confirm summary table */
.save-meta {
  font-size: 0.95rem;
  color: #9aa0aa;
  margin: 0 0 8px;
}

.batch-confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.batch-confirm-table th {
  text-align: left;
  color: #9aa0aa;
  font-weight: 600;
  padding: 6px 10px 10px;
  border-bottom: 1px solid #3a414e;
}

.batch-confirm-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #1f232b;
}

.batch-confirm-table tr:last-child td {
  border-bottom: none;
}

/* Operator name input */
.operator-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.operator-label {
  font-size: 0.95rem;
  color: #9aa0aa;
  font-weight: 600;
}

.operator-input {
  background: #1f232b;
  border: 2px solid #3a414e;
  border-radius: 8px;
  color: #ffffff;
  font-size: 1rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.operator-input:focus {
  border-color: #3fd07f;
}

/* Recipe selection grid (next batch screen) */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.recipe-card {
  background: #242831;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d1d5db;
  transition: all 0.2s;
}

.recipe-card:hover {
  background: #333a44;
}

.recipe-card.selected {
  border-color: #3fd07f;
  background: #1a3a28;
  color: #ffffff;
}

.recipe-card strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff;
  font-size: 1rem;
}

@media (max-width: 600px) {
  .overlay-card {
    padding: 24px 20px;
  }

  .recipe-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Operator selection list */
.operator-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.operator-item {
  background: #242831;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 1rem;
  color: #d1d5db;
  transition: all 0.2s;
  min-width: 100px;
  text-align: center;
}

.operator-item:hover {
  background: #333a44;
}

.operator-item.selected {
  border-color: #3fd07f;
  background: #1a3a28;
  color: #ffffff;
}

/* Custom Alert Modal */
.alert-card {
  background: #2a2f38;
  border-radius: 16px;
  padding: 32px 40px;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.alert-icon {
  font-size: 3rem;
  color: #f59e0b;
}

.alert-message {
  font-size: 1.1rem;
  color: #d1d5db;
  line-height: 1.5;
  margin: 0;
}

.choice-card {
  max-width: 480px;
}

.choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.choice-buttons .btn {
  min-width: 140px;
}

/* Batch Saved State */
.batch-saved-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 16px;
}

.batch-saved-message h2 {
  font-size: 2rem;
  color: #3fd07f;
  margin: 0;
}

.batch-saved-message p {
  font-size: 1.1rem;
  color: #9aa0aa;
  margin: 0;
}

.batch-saved-message .btn {
  margin-top: 20px;
  font-size: 1.2rem;
  padding: 16px 32px;
}
