/* =========================
   EMOJI STACK & STATES
   ========================= */
.emoji-wrapper {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 2rem;
}
.emoji-wrapper .emoji {
  position: absolute;
  top: 0;
  left: 0;
}
.emoji-wrapper .emoji:not(:first-of-type) {
  transform: scale(0.6);
  left: -0.2rem;
}

.undercooked .emoji {
  filter: sepia(1) hue-rotate(10deg) saturate(300%);
}

.burnt {
  filter: grayscale(1) brightness(0.3); 
}
.invalid,
.unmatched {
  filter: grayscale(1) contrast(1.2);
}

/* =========================
   BASIC ELEMENTS & PALETTE
   ========================= */
:root {
  --pizza-bg: #fdf7ec;
  --pizza-card: #ffffff;
  --pizza-border: #e0d5c2;
  --pizza-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  --pizza-red: #ce0000;
  --pizza-text: #343a40;
}

body {
  background-color: rgba(223, 219, 229, 0.95);
  margin: 0;
  line-height: 1.5;
}
.modal {
    overflow-y: hidden;
}
/* Invalid form feedback */
.is-invalid {
  border-color: #dc3545 !important;
}

/* =========================
   GAME CONTAINER & GRID
   ========================= */
.game-container {
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--pizza-shadow);
  background: rgba(255, 255, 255, 0.96);
  margin: 10px;
}

.gridcontainer {
  gap: 12px;
}

/* Headings inside Kanban columns */
.gridcontainer h3,
.gridcontainer h4,
.gridcontainer h5 {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.05rem;
  color: var(--pizza-red);
}

/* Tiny accent pill before headings */
.gridcontainer h3::before,
.gridcontainer h4::before,
.gridcontainer h5::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffc857, #ff7b00);
}

/* =========================
   PIZZA BUILDERS
   ========================= */
.pizza-builder-container {
  border: 1px solid #4a4a4a;
  padding: 10px;
  margin-bottom: 10px;
  min-height: 120px;
}
.pizza-builder-dropzone {
  background-color: #d3d3d3;
  min-height: 80px;
  border: 1px dashed #4a4a4a;
  padding: 10px;
}

/* Ingredient tokens */
.ingredient {
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  margin: 4px;
  padding: 6px 10px;
  cursor: pointer;
  touch-action: manipulation;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    border-color 0.1s ease;
}
.ingredient:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18);
}
.ingredient.selected {
  border: 2px solid var(--pizza-red);
  box-shadow: 0 0 0 2px rgba(206, 0, 0, 0.2);
}

/* Shared zones (drop/piles) */
#prepared-pool,
#pizza-builder,
#pizza-builders-container .pizza-builder-dropzone,
#oven,
#built-pizzas,
#completed,
#wasted,
#orders-list {
  background: #f7f7fb;
  border-radius: 8px;
  border: 2px dashed #b0b0c0 !important;
  padding: 8px;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}

/* Hover feedback for zones (orders list excluded) */
#prepared-pool:hover,
#pizza-builder:hover,
#pizza-builders-container .pizza-builder-dropzone:hover,
#oven:hover,
#built-pizzas:hover,
#completed:hover,
#wasted:hover {
  box-shadow: 0 0 0 3px rgba(206, 0, 0, 0.1);
  transform: translateY(-1px);
  border-color: var(--pizza-red) !important;
}

/* =========================
   ORDER CARDS
   ========================= */
.order-card {
  background-color: #e9ecef;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  margin: 5px;
  width: clamp(140px, 30vw, 180px);
  height: clamp(140px, 25vw, 120px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  text-align: center;
}
.order-id {
  font-weight: bold;
  margin-bottom: 5px;
}
.order-ingredients {
  margin: 5px 0;
  font-size: 1rem;
}
.order-emoji {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
}

/* =========================
   GITHUB RIBBON
   ========================= */
.fork-me-on-github {
  overflow: hidden !important;
}
.fork-me-on-github:hover .octo-arm {
  animation: octocat-wave 560ms ease-in-out;
}
@media (max-width: 500px) {
  .fork-me-on-github:hover .octo-arm {
    animation: none;
  }
  .fork-me-on-github .octo-arm {
    animation: octocat-wave 560ms ease-in-out;
  }
}

/* =========================
   BUTTONS
   ========================= */
.btn-custom,
#start-round,
#submit-pizza,
#oven-on,
#oven-off {
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    filter 0.1s ease;
}
.btn-custom:hover,
#start-round:hover,
#submit-pizza:hover,
#oven-on:hover,
#oven-off:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
  filter: brightness(1.03);
}

/* Primary action colours */
#start-round,
#submit-pizza {
  background: linear-gradient(135deg, #ffb347, #ff7b00);
  border-color: #ff7b00;
}
#oven-on {
  background: linear-gradient(135deg, #28a745, #1d7f33);
  border-color: #1d7f33;
}
#oven-off {
  background: linear-gradient(135deg, #dc3545, #b21f2d);
  border-color: #b21f2d;
}

/* Override Bootstrap button colours */
.btn-primary {
  background-color: #ff5722 !important;
  border-color: #e64a19 !important;
}
.btn-success {
  background-color: #4caf50 !important;
}

/* Oven buttons layout */
.ovenbuttons {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   TIMERS
   ========================= */
.timer-container.oven,
.timer-container.stopwatch {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2vw;
}
.timer-container.oven.oven-active {
  background: radial-gradient(circle at 20% 20%, #ffcc80, #cc0000);
  box-shadow: 0 0 18px rgba(255, 100, 50, 0.7);
}

/* =========================
   MESSAGE PANEL
   ========================= */
#messages {
  background-color: #050608;
  border-radius: 6px;
  border: 2px solid #1f272b;
  padding: 8px 10px;
  color: #7cfc00;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}
#messages .title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #00ff9c;
  opacity: 0.8;
}
#messages .content {
  margin-top: 4px;
  max-height: 5rem;
  overflow-y: auto;
}

/* =========================
   CARD-STYLE PANELS
   ========================= */
#customer-orders,
#game-area,
.gridcontainer > div {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

/* Section headings with emojis */
.ingredients h4,
.builders h3,
.oven h5,
.built h5,
.completed h5,
.wasted h5,
#customer-orders h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}
.ingredients h4::before { content: "🥫"; }
.builders h3::before   { content: "👨‍🍳"; }
.oven h5::before       { content: "🔥"; }
.built h5::before      { content: "📦"; }
.completed h5::before  { content: "✅"; }
.wasted h5::before     { content: "🗑️"; }
#customer-orders h4::before { content: "🧾"; }

/* Header typography */
header h5 {
  margin: 0;
  font-size: 0.95rem;
}

/* =========================
   ROOM TABLE & JOIN FORM
   ========================= */
#room-table {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  overflow: hidden;
}
#room-table thead {
  background: #f5f5fa;
}
#room-table tbody tr {
  cursor: pointer;
  transition:
    background 0.12s ease-out,
    transform 0.12s ease-out;
}
#room-table tbody tr:hover {
  background: #fff8e1;
  transform: translateY(-1px);
}

#join-form .form-control {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03) inset;
}
#join-form .form-control:focus {
  border-color: #ff7b00;
  box-shadow: 0 0 0 0.08rem rgba(255, 123, 0, 0.25);
}
#join-form .form-label {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* =========================
   ROOM MODAL / PIZZAMAN
   ========================= */
.modal-content::before {
  opacity: 0.25;
}

.pizzaman {
  background: #cccccc;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.25rem;
  max-width: 100%;
  position: relative;
  left: 5vw;
  margin-top: 1vh;
}

#roomModal .modal-header {
  border-bottom: none;
  align-items: stretch;
}
#roomModal .modal-title {
  line-height: 1.2;
}

/* =========================
   DEBRIEF MODAL
   ========================= */
#debriefModal .modal-dialog {
  max-width: 520px;
}
#debriefModal .modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}
#debriefModalBody p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
#debriefModalBody p strong {
  font-weight: 600;
  color: #444444;
}
#debriefModalBody p span {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
}

/* Highlight good vs bad */
#debrief-pizzas-completed,
#debrief-fulfilled-orders {
  color: #198754;
}
#debrief-pizzas-wasted,
#debrief-unmatched-pizzas,
#debrief-remaining-orders {
  color: #dc3545;
}

/* =========================
   RESPONSIVE
   ========================= */
/* =========================
   RESPONSIVE
   ========================= */
@media screen and (max-width: 768px) {
  /* 1) Stack header content */
  header {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    align-items: center;
  }

  header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  /* 2) Force game grid into a single column */
  .gridcontainer {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "buttons"
      "ovenbuttons"
      "ingredients"
      "builders"
      "built"
      "oven"
      "completed"
      "wasted";
    gap: 8px;
  }

  .gridcontainer > div {
    margin-bottom: 8px;
    width: 100%;
  }

  /* 3) Oven buttons: vertical stack */
  .ovenbuttons {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* 4) Make main buttons thumb-friendly */
  .btn-custom,
  #start-round,
  #submit-pizza,
  #oven-on,
  #oven-off {
    width: 100%;
  }

  /* 5) Tidy up the join modal layout on mobile */
  #roomModal .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .pizzaman {
    left: 0;
    margin-top: 1rem;
    max-width: 100%;
  }

  /* 6) Slightly smaller messages text */
  #messages {
    font-size: 0.85rem;
  }
}

/* =========================
   LOADING OVERLAY
   ========================= */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: radial-gradient(
    circle at top,
    #fff7e6 0%,
    #f2e3ff 40%,
    #dfdbe5 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}
#loading-overlay.hide {
  opacity: 0;
  pointer-events: none;
}
#loading-overlay .loading-inner {
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}
.loading-logo {
  max-width: 120px;
  margin-bottom: 0.75rem;
}
.loading-text {
  margin: 0;
  font-family: "Sigmar", system-ui, sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pizza-red);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%,
  100% {
    opacity: 0.9;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* =========================
   PIZZA VISUALS
   ========================= */
.pizza-visual {
  position: relative;
  width: 60px;
  height: 60px;
  background-color: #f3e5ab;
  border: 2px solid #e0c097;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
  overflow: hidden;
}
.pizza-visual.has-sauce::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  background-color: #d32f2f;
  border-radius: 50%;
  opacity: 0.9;
}
.topping-icon {
  position: absolute;
  font-size: 14px;
  z-index: 2;
}
.pos-1 { top: 10%; left: 30%; }
.pos-2 { top: 30%; left: 60%; }
.pos-3 { top: 60%; left: 20%; }
.pos-4 { top: 60%; left: 60%; }
.pos-5 { top: 35%; left: 35%; }
.pos-6 { top: 15%; left: 15%; }

/* =========================
   MODAL BACKDROP & SCROLL
   ========================= */
.modal-backdrop {
  background: radial-gradient(
    circle at top,
    #fff7e6 0%,
    #f2e3ff 40%,
    #dfdbe5 100%
  ) !important;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  position: fixed !important;
  height: 100vh !important;
  width: 100vw !important;
  overflow: hidden !important;
}
.modal-backdrop.show {
  opacity: 1 !important;
}



/* Add to main.css */

/* 1. Prevent browser scrolling when touching an ingredient */
.ingredient {
  touch-action: none; 
  user-select: none;
  -webkit-user-select: none;
}

/* 2. Style the item being dragged (The one under your finger) */
.sortable-fallback {
  opacity: 1 !important;
  background: #fff;
  border: 2px solid #ce0000;
  box-shadow: 0 15px 30px rgba(0,0,0,0.3);
  transform: scale(1.1); /* Pop effect */
  cursor: grabbing;
  z-index: 9999;
}

/* 3. Style the empty space left behind */
.sortable-ghost {
  opacity: 0.3;
  background: #e0e0e0;
  border: 1px dashed #999;
}

/* 4. Hide the original item while dragging (optional, keeps it clean) */
.sortable-chosen {
  background: #f0f0f0;
}

/* Make Active Rooms + High Scores area use full height on mobile */
@media (max-width: 768px) {

  /* Make the Room modal fill the viewport */
  #roomModal .modal-dialog {
    margin: 0;               /* remove top/bottom gap */
    max-width: 100%;
    height: 100vh;           /* full viewport height */
  }

  #roomModal .modal-content {
    height: 100%;            /* fill dialog */
    max-height: none !important;
    display: flex;
    flex-direction: column;
  }

  #roomModal .modal-header,
  #roomModal .modal-footer {
    flex-shrink: 0;          /* keep natural height */
  }

  /* Main scroll area for Active Rooms + High Scores */
  #roomModal .modal-body {
    flex: 1;
    min-height: 0;
    max-height: none !important;  /* override global 75vh */
    overflow-y: auto;             /* single scrollable region */
  }
}

/* Let the entire Room modal scroll on mobile */
@media (max-width: 768px) {

  /* Remove height caps for this modal */
  #roomModal .modal-content,
  #roomModal .modal-body {
    max-height: none !important;
    overflow-y: visible !important;
  }

  /* Full-width mobile dialog */
  #roomModal .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Let the whole modal scroll if it’s taller than the viewport */
  #roomModal {
    overflow-y: auto !important;
  }
}


/* Stronger borders for all form controls */
.form-control {
  border: 2px solid #4a4a4a !important;  /* dark grey = good contrast on white */
}

/* Visible focus state */
.form-control:focus-visible {
  outline: 3px solid #000;
  outline-offset: 2px;
}

/* Stronger contrast borders for interactive dropzones */
#prepared-pool,
#pizza-builder,
#pizza-builders-container .pizza-builder-dropzone,
#oven,
#built-pizzas,
#completed,
#wasted,
#orders-list {
  border: 2px dashed #4a4a4a !important;  /* darker border for contrast */
}

