/* (Unchanged / complete styles) */
/* I've re-used your existing CSS (keeps UI identical). Save this as style.css. */

/* ============================================
   Chemistry Virtual Lab - Complete Styles
   ============================================ */

/* === CSS Variables / Design Tokens === */
:root {
  --color-primary: hsl(234, 55%, 63%);
  --color-primary-hover: hsl(220, 70%, 40%);
  --color-secondary: hsl(0, 0%, 96%);
  --color-danger: hsl(0, 65%, 50%);
  --color-danger-hover: hsl(0, 65%, 40%);
  --color-success: hsl(140, 60%, 40%);
  --color-background: linear-gradient(135deg, #e8f3ff, #d7e9ff);

  --color-surface: hsl(0, 0%, 100%);
  --color-text: hsl(220, 15%, 20%);
  --color-text-muted: hsl(220, 10%, 50%);
  --color-border: hsl(220, 15%, 85%);
  --color-accent: hsl(45, 90%, 55%);
  --color-liquid-glycine: hsl(180, 50%, 70%);
  --color-liquid-naoh: hsl(220, 60%, 75%);
  --shadow-sm: 0 1px 3px hsla(0, 0%, 0%, 0.1);
  --shadow-md: 0 4px 12px hsla(0, 0%, 0%, 0.15);
  --shadow-lg: 0 8px 24px hsla(0, 0%, 0%, 0.2);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

.equipment-tray {
  background: white;
  max-height: 260px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  /* display: flex; */
}


.equipment-tray h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--color-text);
  position: sticky;
  top: 0;
  background: white;
}


/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  /* min-height: 100vh; */
  background-image: url("assets/table.png") !important;
  background-repeat: no-repeat !important;
  background-position: top bottom !important;
  background-size: contain;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;

}

.lab-bench {
  position: absolute;
  bottom: 40px;
  /* table stays at bottom */
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  height: 260px;

}

/* Individual apparatus positions on table */

.lab-item[data-item="beaker"] {
  left: 20%;
}

.lab-item[data-item="conical_flask"] {
  left: 30%;
}

.lab-item[data-item="measuring_cylinder"] {
  left: 40%;
}

.lab-item[data-item="glycine"] {
  left: 50%;
  bottom: 90px;
}

.lab-item[data-item="burette"] {
  left: 60%;
}

.lab-item[data-item="stand"] {
  left: 70%;
}

.lab-item[data-item="ph_meter"] {
  left: 80%;
}


.screen {
  background: transparent !important;
}


/* === Utility Classes === */
.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  padding: 20px;
}

/* === Buttons === */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: hsl(0, 0%, 92%);
}

.btn-action {
  background: var(--color-success);
  color: white;
  padding: 10px 20px;
}

.btn-action:hover:not(:disabled) {
  background: hsl(140, 60%, 35%);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-hover);
}

/* === Landing Screen === */
#landing-screen {
  width: 100%;
  max-width: none;
  margin: 0;
}


.lab-header {
  text-align: center;
  margin-bottom: 30px;
}

.lab-header h1 {
  font-size: 2.5rem;
  background-color: wheat;
  /* margin-bottom: 100px; */
  color: var(--color-primary);
  margin-bottom: 8px;
}

.lab-header h2 {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.lab-bench {
  background: linear-gradient(180deg, #f5f7fa, #d8dde3);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-bottom: 8px solid #b4b8bd;
  /* table edge */
  /* background: var(--color-surface); */
  /* border-radius: var(--radius-lg); */
  /* padding: 30px; */
  background: linear-gradient(180deg, #f5f7fa, #dce1e6);
  /* box-shadow: var(--shadow-md); */
  margin-bottom: 30px;
  /* border-bottom: 6px solid #b4b8bd; */
}

.lab-bench h3 {
  font-size: 1.1rem;
  color: var(--color-text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.apparatus-section {
  margin-bottom: 30px;
}

/* .items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  justify-items: center;
  align-items: end;
} */

/* Disable grid on landing page only */
.lab-landing .items-grid {
  /* display: block; */
  position: relative;
  height: fit-content;
  top: 60vh;
  /* table height */
  width: 100%;
}

/* Remove bench overlay so JPG is visible */
.lab-landing .lab-bench {
  
  background: transparent !important;
  box-shadow: none !important;
  border-bottom: none !important;
  position: absolute;
  min-height: 420px;
}

/*another change*/
/* ================================
   TABLE STACKING (LANDING PAGE)
   ================================ */

.lab-landing .lab-item {
  position: absolute;
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  cursor: grab;
}

/* --- EQUIPMENT (FRONT ROW) --- */

.lab-landing .lab-item[data-item="beaker"] {
  left: 18%;
  bottom: 25px;
}

.lab-landing .lab-item[data-item="conical_flask"] {
  left: 26%;
  bottom: 25px;
}

.lab-landing .lab-item[data-item="measuring_cylinder"] {
  left: 34%;
  bottom: 25px;
}

.lab-landing .lab-item[data-item="pipette"] {
  left: 92%;
  bottom: 15px;
}

.lab-landing .lab-item[data-item="burette"] {
  left: 70%;
  bottom: 25px;
}

.lab-landing .lab-item[data-item="stand"] {
  left: 78%;
  bottom: 25px;
}

.lab-landing .lab-item[data-item="ph_meter"] {
  left: 88%;
  bottom: 25px;
}

/* --- CHEMICALS (BACK ROW) --- */

.lab-landing .lab-item[data-item="naoh"] {
  left: 25%;
  bottom: 100px;
}

.lab-landing .lab-item[data-item="hcl"] {
  left: 30%;
  bottom: 100px;
}

.lab-landing .lab-item[data-item="kcl"] {
  left: 38%;
  bottom: 100px;
}

.lab-landing .lab-item[data-item="glycine"] {
  left: 46%;
  bottom: 25px;
  z-index: -2;
}

.lab-landing .lab-item[data-item="water"] {
  left: 60%;
  bottom: 25px;
  z-index: -2;
}

.lab-item {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  cursor: grab;
  transition: transform 0.2s ease;
  /* position: absolute; */
  bottom: 30px;
  margin-block-start: 14px;
  /* transform: translateX(-50%); */
}

.lab-item:hover {
  transform: translateY(-3px);
}


.lab-item:active {
  cursor: grabbing;
}

.lab-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.lab-item img {
  width: 65px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0px 6px 8px rgba(0, 0, 0, 0.25));
  width: 50px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0px 3px 4px rgba(0, 0, 0, 0.25));
}

.lab-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: -12px;
 text-wrap: inherit;
 margin-inline-end: 8px;
 margin-block-end: 8px;
 
}

.lab-item.chemical {
  background: linear-gradient(135deg, hsl(200, 30%, 95%), hsl(200, 30%, 90%));
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* === Experiment Screen === */
#experiment-screen {
  position: relative;
  display: flex;
}

/* === Step Popup === */
.popup-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.step-popup {
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.popup-step {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.popup-text {
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.5;
}

/* === Experiment Layout === */
.experiment-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .experiment-layout {
    grid-template-columns: 1fr;
  }
}

/* === Workspace Panel === */
.workspace-panel {
  margin: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.setup-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 40px;
  min-height: 350px;
  padding: 20px;
  background: linear-gradient(180deg, hsl(210, 30%, 97%), hsl(210, 30%, 93%));
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

/*another change*/
.lab-landing .lab-item img {
  filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.35));
}


/* === Drop Zones === */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  min-width: 80px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: hsla(220, 70%, 50%, 0.1);
  transform: scale(1.02);
}

.drop-zone.completed {
  border-style: solid;
  border-color: var(--color-success);
  background: hsla(140, 60%, 40%, 0.05);
}

.zone-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: 8px;
}

/* === Burette Visual === */
.burette-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.burette-zone {
  min-height: 250px;
  width: 100px;
}

.burette-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.burette-tube {
  width: 30px;
  height: 200px;
  background: linear-gradient(90deg, hsl(0, 0%, 95%), hsl(0, 0%, 100%), hsl(0, 0%, 95%));
  border: 1px solid hsl(0, 0%, 80%);
  border-radius: 4px 4px 2px 2px;
  position: relative;
  overflow: hidden;
}

.burette-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--color-liquid-naoh), hsl(220, 70%, 65%));
  transition: height 0.5s ease;
}

.burette-scale {
  position: absolute;
  right: -25px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.burette-tap {
  width: 40px;
  height: 12px;
  background: hsl(30, 50%, 50%);
  border-radius: 2px;
  margin-top: 2px;
}

/* === Drop Animation === */
.drop {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 12px;
  background: var(--color-liquid-naoh);
  border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
}

.drop.falling {
  animation: dropFall 0.6s ease-in forwards;
}

@keyframes dropFall {
  0% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateX(-50%) translateY(150px);
    opacity: 0;
  }
}

/* === Beaker Visual === */
.beaker-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.beaker-visual {
  position: relative;
}

.beaker-container {
  width: 100px;
  height: 80px;
  background: linear-gradient(90deg, hsla(0, 0%, 100%, 0.3), hsla(0, 0%, 100%, 0.6), hsla(0, 0%, 100%, 0.3));
  border: 3px solid hsl(0, 0%, 80%);
  border-top: none;
  border-radius: 0 0 10px 10px;
  position: relative;
  overflow: hidden;
}

.beaker-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background: var(--color-liquid-glycine);
  transition: height 0.3s ease, background 0.5s ease;
}

.stir-bar {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 6px;
  background: hsl(0, 0%, 30%);
  border-radius: 3px;
}

.stir-bar.stirring {
  animation: stir 0.5s ease-in-out;
}

@keyframes stir {

  0%,
  100% {
    transform: translateX(-50%) rotate(0deg);
  }

  25% {
    transform: translateX(-50%) rotate(20deg);
  }

  75% {
    transform: translateX(-50%) rotate(-20deg);
  }
}

/* === pH Meter Visual === */
.ph-zone {
  min-height: 120px;
  width: 80px;
}

.ph-meter-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ph-display {
  background: hsl(120, 30%, 20%);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid hsl(0, 0%, 40%);
}

.ph-display span {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  color: hsl(120, 80%, 50%);
}

.ph-display.updating {
  animation: phFlash 0.3s ease;
}

@keyframes phFlash {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.ph-probe {
  width: 8px;
  height: 60px;
  background: linear-gradient(180deg, hsl(0, 0%, 50%), hsl(0, 0%, 70%));
  border-radius: 0 0 4px 4px;
}

/* === Reagent Area === */
.reagent-area {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 20px;
}

.reagent-zone {
  min-width: 140px;
  min-height: 60px;
  padding: 12px;
}

/* === Control Panel === */
.control-panel {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* === Data Panel === */
.data-panel {
  display: flex;
  /* flex-direction: column; */
  gap: 30px;
}

.table-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.table-container h3 {
  margin-bottom: 12px;
  color: var(--color-text);
  font-size: 1rem;
}

.table-scroll {
  max-height: 250px;
  overflow-y: auto;
}

#data-table {
  width: 100%;
  border-collapse: collapse;
}

#data-table th,
#data-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

#data-table th {
  background: var(--color-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

#data-table tbody tr:hover {
  background: hsla(220, 70%, 50%, 0.05);
}

#data-table tbody tr.new-row {
  animation: highlightRow 0.5s ease;
}

@keyframes highlightRow {
  from {
    background: hsla(45, 90%, 55%, 0.3);
  }

  to {
    background: transparent;
  }
}

/* === Graph Container === */
.graph-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.graph-container h3 {
  margin-bottom: 12px;
  color: var(--color-text);
  font-size: 1rem;
}

#graph-canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* === Results Panel === */
.results-panel {
  background: linear-gradient(135deg, hsl(220, 50%, 97%), hsl(220, 50%, 94%));
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.results-panel h3 {
  color: var(--color-primary);
  margin-bottom: 16px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.result-item:last-child {
  border-bottom: none;
}

.result-item.highlight {
  background: hsla(45, 90%, 55%, 0.2);
  margin: 8px -12px -12px;
  padding: 12px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.result-item span:last-child {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
}

/* === Precautions Panel === */
.precautions-panel {
  background: linear-gradient(135deg, hsl(45, 80%, 95%), hsl(45, 80%, 90%));
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 24px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.precautions-panel h3 {
  color: hsl(30, 70%, 40%);
  margin-bottom: 12px;
}

.precautions-panel ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.precautions-panel li {
  padding: 8px 12px;
  background: hsla(0, 0%, 100%, 0.7);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  position: relative;
  padding-left: 28px;
}

.precautions-panel li::before {
  content: "⚡";
  position: absolute;
  left: 8px;
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .lab-header h1 {
    font-size: 1.8rem;
  }

  .lab-header h2 {
    font-size: 1rem;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
  }

  .lab-item {
    padding: 12px 8px;
  }

  .lab-item img {
    width: 40px;
    height: 50px;
  }

  .setup-area {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: auto;
    padding: 15px;
  }

  .control-panel {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .popup-container {
    left: 10px;
    right: 10px;
  }

  .step-popup {
    max-width: none;
  }
}

/* === Stand Placeholder === */
.stand-placeholder {
  width: 60px;
  height: 120px;
  background: hsl(30, 30%, 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.placed-item img {
  max-width: 60px;
  max-height: 100px;
  object-fit: contain;
}

/* ================================
   LAB LANDING BACKGROUND
   ================================ */

.lab-landing {
  background: url("assets/lab_table_bg.jpg") no-repeat center bottom;
  background-size: cover;
  min-height: 100vh;
  position: relative;
}

/* ================================
   EQUIPMENT TRAY – HORIZONTAL FIX
   ================================ */

#equipment-tray .items-grid {
  display: flex;
  flex-direction: row;
  /* KEY */
  gap: 20px;
  align-items: center;
  overflow-x: auto;
  /* scroll if many items */
  padding: 10px 0;
}

#equipment-tray .lab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  width: 55px;
  height: auto;
}

/* ================================
   DROP ZONE HIGHLIGHT (STEP GUIDANCE)
   ================================ */

.drop-zone.highlight {
  outline: 3px dashed #1f6fff;
  background-color: rgba(31, 111, 255, 0.08);
  box-shadow: 0 0 15px rgba(31, 111, 255, 0.6);
  animation: pulseGlow 1.2s infinite;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 8px rgba(31, 111, 255, 0.4);
  }

  50% {
    box-shadow: 0 0 18px rgba(31, 111, 255, 0.8);
  }

  100% {
    box-shadow: 0 0 8px rgba(31, 111, 255, 0.4);
  }
}


.burette-setup {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
/* ================================
   MOBILE DRAG SUPPORT
   ================================ */

.lab-item {
  touch-action: none;          /* prevents scroll hijack */
  user-select: none;
  -webkit-user-drag: none;
}

.lab-item img {
  pointer-events: none;        /* VERY IMPORTANT */
  -webkit-touch-callout: none; /* disables image menu */
}
.lab-item.used {
  opacity: 0.3;
  pointer-events: none;
}
