/* ==================
     NEW DESIGN SYSTEM 
     ================== */
  :root {
    --primary: #479E78; /* Deep Green from logo for actions */
    --primary-light: #E4F3EF; /* Lighter shade of the green for highlights */
    --secondary: #3A322B; /* Dark, warm brown/grey for text */
    --background: #FDFCF9; /* Sophisticated off-white */
    --surface: #FFFFFF;
    --surface-alt: #f2f7dd; /* Light cream color for mini tracker */
    --border-color: #EDEAE6; /* Softer border color */
    --muted-text: #8A8177; /* Muted warm grey */
    --success: #22c55e;
    --success-bg: #e8f7ea;
    --success-text: #1b6e2e;
    --warning: #ffc107;
    --warning-bg: #fff3cd;
    --warning-text: #946200;
    --error: #dc2626;
    --error-bg: #e68b02;
    --shadow: 0 8px 24px rgba(149, 157, 165, 0.1);
    --shadow-hover: 0 10px 30px rgba(149, 157, 165, 0.15);
  }

  /* === Base Styles === */
  html, body {
    scroll-behavior: smooth;
  }
  body {
    margin: 0;
    font-family: 'Kanit', -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans Thai", sans-serif;
    background-image: url('/img/bg2.1.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3 {
    font-weight: 500;
    color: var(--secondary);
  }

  b, strong {
    font-weight: 500;
  }

  .wrap {
    max-width: 940px;
    margin: 0 auto;
    padding: 24px 16px;
  }
  
  .muted {
    color: var(--muted-text);
    font-size: 14px;
  }

  .subtitle {
    font-size: 1rem;
    color: var(--secondary);
    margin-top: 8px; /* Adjusted margin */
    margin-bottom: 24px;
  }

  .header-container {
    text-align: center; /* Center content */
  }

  .logo-img {
    height: 200px; /* ปรับความสูงโลโก้ได้ที่นี่ */
    width: auto;
    object-fit: contain;
  }
  
  .welcome-message {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 24px;
    min-height: 29px; /* Reserve space to prevent layout shift */
  }

  /* === View Management === */
  .view {
    display: none; /* Hide all views by default */
  }
  .view.active {
    display: block; /* Show only the active view */
  }

  /* === Initial Choice View === */
  .choice-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
  }
  @media(min-width: 768px) {
    .choice-container {
      grid-template-columns: 1fr 1fr;
    }
  }
  .choice-card {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--secondary);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .choice-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
  }
  .choice-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
  }
  .choice-card .muted {
    font-size: 1rem;
  }

  /* === Components === */
  .card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
  }

  .sectionhdr {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }

  .badge {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    color: var(--surface);
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
  }
  
  .title {
    font-weight: 500;
    font-size: 1.125rem;
  }

  button, a.choice-card {
    -webkit-tap-highlight-color: transparent;
  }

  button {
    cursor: pointer;
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-family: 'Kanit', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 48px; /* Ensure button height is consistent */
  }
  button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }
  button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
  }
  button[disabled] {
    opacity: .5;
    cursor: not-allowed;
  }
  
  #submitBtn {
    background: linear-gradient(135deg, #61beac 0%, #47a079 100%);
    font-size: 18px;
    padding: 14px 24px;
  }
  
  .linkbtn {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
  }
  .linkbtn:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
  }
  .linkbtn:hover:not(:disabled) .spinner {
      border-top-color: #fff;
  }

  input[type=text], textarea {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #fff;
    color: var(--secondary);
  }
  input[type=text]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 158, 120, 0.2);
  }
  textarea{min-height:80px}

  /* === Layout Grids === */
  .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
  @media(min-width:760px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
  }

  /* === Specific Element Styling === */
  .pkg-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-color); }
  .flv-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-color); }
  .spc-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-color); }
  .cart-item-card { margin-top: 10px; padding: 12px; border: 1px solid var(--border-color); border-radius: 12px; }
  .cart-item-title { font-weight: 500; font-size: 1.1rem; }


  .qty { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--border-color); border-radius: 999px; padding: 4px; }
  .qty button { background: #fff; color: var(--secondary); border: none; width: 30px; height: 30px; border-radius: 999px; padding: 0; box-shadow: none; font-size: 18px; min-height: auto; }
  .qty button:hover { background: var(--primary-light); }
  .qty span {
    font-weight: 500;
    min-width: 20px;
    text-align: center;
  }

  .pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 400;
  }
  .okpill { background: var(--success-bg); color: var(--success-text); }
  .need { background: var(--warning-bg); color: var(--warning-text); }
  .okpills { background: #e7f5ff;color:#09589c; }
  .pill.special { background: #f0e6ff; color: #6a0dad; }

  .tot {
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
    padding-top: 12px;
    font-weight: 500;
    font-size: 1.2rem;
  }
  
  /* [MODIFIED 6.5.5] Styles for discount rows */
  .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
  }
  .summary-row.discount {
      color: var(--success-text);
  }
  .summary-row.grand-total {
    font-weight: 500;
    font-size: 1.2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
  }


  #next1, #next2, #next3, #log { display: none !important; }
  #pkgGrid{ display:grid !important; grid-template-columns:1fr !important; gap:10px !important; }

  /* === Package Button Overrides === */
  .pkgbtn {
    background: #fff !important;
    color: var(--secondary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    text-align: left !important;
    width: 100% !important;
    box-shadow: none !important;
    transition: all 0.2s ease;
    min-height: auto;
  }
  .pkgbtn:hover:not(.selected) {
    border-color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow) !important;
  }
  .pkgbtn.selected {
    background: var(--primary-light) !important;
    color: var(--secondary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary) !important;
  }

  /* === Tracking & Mini Tracker === */
  .track-success {
    background: var(--success) !important;
    box-shadow: 0 0 0 0 rgba(34,197,94,.6);
    animation: pulseGreen 1.4s infinite;
  }
  @keyframes pulseGreen { 0%{box-shadow:0 0 0 0 rgba(34,197,94,.6)} 70%{box-shadow:0 0 0 10px rgba(34,197,94,0)} 100%{box-shadow:0 0 0 0 rgba(34,197,94,0)} }

  #miniTracker { 
    margin: 8px 0 20px;
    background-color: var(--surface-alt);
    border-color: #f8ebda;
  }
  .mini-card { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 10px; margin-top: 8px; transition: all .2s ease; }
  .mini-card:hover { transform: scale(1.02); box-shadow: var(--shadow); }
  .mini-badge {
    font-size: 12px;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 400;
  }
  .mini-new { background: var(--warning-bg); color: var(--warning-text); }
  .mini-do { background:#e7f5ff;color:#09589c; }
  .mini-done { background: var(--success-bg); color: var(--success-text); }
  .mini-del { background:#f0fdf4;color:#166534; }
  .mini-right { margin-left: auto; color: var(--muted-text); }
  .mini-link {
    cursor: pointer;
    text-decoration: underline;
    color: var(--primary);
    font-weight: 500;
  }
  
  /* Stacked Tracking Cards */
  .track-stack { max-width: 940px; margin: 12px auto; padding: 0; }
  .tcard { background:#fff; border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin: 12px 0; }
  .tcode {
    font-size: 36px;
    font-weight: 500;
    letter-spacing: 2px;
    margin: 2px 0 6px;
    color: var(--primary);
  }
  .tstatus { font-size: 16px; margin-top: 6px; display: flex; align-items: center; gap: 10px; }
  .tdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 0 rgba(255, 209, 102, .6); animation: pulse 1.4s infinite; }
  .tdot.done { background: #4caf50; animation: none; }
  .tdot.green { background: var(--success); animation: pulseGreen 1.4s infinite; }
  @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 209, 102, .6); } 70% { box-shadow: 0 0 0 10px rgba(255, 209, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); } }
  
  /* === Image Lightbox === */
  #imgLightbox {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,.7); z-index: 99999;
    cursor: zoom-out; backdrop-filter: blur(4px);
  }
  #imgLightbox.open { display: flex; }
  #imgLightbox img {
    max-width: 92vw; max-height: 92vh;
    border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
    cursor: auto;
  }
  #imgLightbox .close {
    position: fixed; top: 10px; right: 12px;
    font-size: 36px; color: #fff; cursor: pointer; user-select: none;
    text-shadow: 0 1px 4px #000;
  }
  
  /* === Tracking View (After Submit) === */
  #trackingView { 
    max-width: 940px; 
    margin: 12px auto; 
    padding: 0; 
  }
  .track-card { background: #fff; border: 1px solid var(--border-color); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
  .track-title {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 1.25rem;
  }
  .track-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
  .track-btn {
    cursor: pointer;
    border: 2px solid var(--primary);
    border-radius: 10px;
    background: #fff;
    color: var(--primary);
    padding: 10px 14px;
    font-weight: 500;
    transition: all .2s ease;
  }
  .track-btn:hover { background: var(--primary); color: #fff; }

  .action-buttons-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .action-buttons-container #submitBtn {
    width: 100%;
  }

  /* === Google Translate Widget === */
  #google_translate_element {
    position: fixed;
    top: 10px;
    right: 16px;
    z-index: 9999;
  }
  .goog-te-banner-frame.skiptranslate {
      display: none !important;
  } 
  body {
      top: 0px !important; 
  }

  /* === Custom Toast Notification === */
  #toast {
    position: fixed;
    bottom: -100px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--error-bg);
    color: var(--error);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--error);
    box-shadow: var(--shadow-hover);
    z-index: 10000;
    transition: bottom 0.5s ease-in-out;
    font-weight: 500;
  }
  #toast.show {
    bottom: 20px;
  }
  #toast.success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success);
  }
  
  /* === Gemini API Loading Spinner === */
  .spinner {
    display: none; /* Hide by default */
    border: 3px rgba(255, 255, 255, 0.3) solid;
    border-radius: 50%;
    border-top-color: #fff; /* For dark buttons */
    width: 16px;
    height: 16px;
    animation: spin 1s ease-in-out infinite;
  }

  .linkbtn .spinner {
    border-top-color: var(--primary); /* For link buttons */
  }

  button.loading .spinner {
    display: block;
  }
  
  button.loading .btn-text {
    display: none;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }


  /* ============================ */
  /* === MOBILE RESPONSIVENESS === */
  /* ============================ */
  @media (max-width: 767px) {
      .wrap {
          padding: 16px 12px;
      }

      .logo-img {
          height: 160px; /* Slightly smaller logo on mobile */
          margin-top: 0;
      }

      .subtitle {
          font-size: 1rem;
          margin-bottom: 16px;
      }
      
      .card {
          padding: 16px;
          margin: 16px 0;
          border-radius: 16px;
      }

      .sectionhdr {
          gap: 10px;
          margin-bottom: 12px;
      }
      
      .badge {
          width: 32px;
          height: 32px;
          font-size: 13px;
      }

      .title {
          font-size: 1rem;
      }
      
      button {
          padding: 10px 16px;
      }
      
      #submitBtn {
          padding: 12px 20px;
          width: 100%; /* Make submit button full width on mobile */
      }

      .linkbtn {
          width: 100%;
          text-align: center;
      }

      .pkg-thumb {
          width: 56px;
          height: 56px;
      }
      
      .flv-thumb {
          width: 40px;
          height: 40px;
      }

      .choice-card.image-button {
        height: 150px;
      }
      
  }

  .floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s ease;
  }
  .floating-cart:hover {
    transform: scale(1.1);
  }
  .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #cartModal {
      display: none;
      position: fixed;
      z-index: 101;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      overflow: auto;
      background-color: rgba(0,0,0,0.4);
      animation: fadeIn 0.5s;
  }
  .modal-content {
      background-color: #fefefe;
      margin: 15% auto;
      padding: 20px;
      border: 1px solid #888;
      width: 90%;
      max-width: 600px;
      border-radius: 20px;
      box-shadow: 0 4px 12px rgba(0,0,0,.15);
      animation: slideInTop 0.5s;
      /* [FIX 3] Ensure padding/border don't cause overflow */
      box-sizing: border-box; 
  }
  @keyframes fadeIn {
      from {opacity: 0;}
      to {opacity: 1;}
  }
  @keyframes slideInTop {
      from {transform: translateY(-50px); opacity: 0;}
      to {transform: translateY(0); opacity: 1;}
  }

  .close {
      color: #aaa;
      float: right;
      font-size: 28px;
      font-weight: bold;
  }

  .close:hover,
  .close:focus {
      color: black;
      text-decoration: none;
      cursor: pointer;
  }

  /* === [NEW] Achievement & Generic Modal Styles === */
  .ach-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* Changed from flex to none */
    align-items: center;
    justify-content: center;
    z-index: 1001; /* Higher than cart modal */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
  }
  .ach-modal-overlay.show {
    display: flex; /* Show when class is added */
    opacity: 1;
    visibility: visible;
  }
  .ach-modal-content {
    background: var(--surface);
    padding: 24px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    text-align: center;
  }
  .ach-modal-overlay.show .ach-modal-content {
    transform: scale(1);
  }
  .ach-modal-header {
    margin-bottom: 16px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .ach-modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.4rem;
  }
  .ach-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--muted-text);
  }
  .ach-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .ach-item {
  position: relative;
  padding: 3px; /* ความหนาของเส้นขอบ */
  border-radius: 14px; /* ความโค้งของขอบนอก */
  overflow: hidden;
  z-index: 1;
  background: transparent; /* ทำให้พื้นหลังโปร่งใส */
  margin-bottom: 16px; /* ย้าย margin มาไว้ที่นี่ */
}

/* 2. ตัว Gradient ที่วิ่งอยู่เบื้องหลัง (เหมือนเดิม) */
.ach-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(45deg, #ff6b6b, #ffcd39, #48c6ef, #70d6bf, #a8a8ff, #ff6b6b);
  background-size: 400% 400%;
  z-index: -1;
  animation: gradientBorder 8s ease infinite;
}

/* 3. กล่องใน (.ach-item-content) - สำหรับใส่เนื้อหาและมีสีพื้นหลังทึบ */
.ach-item-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px; /* ระยะห่างของเนื้อหาจากขอบ */
  background: var(--surface); /* สีพื้นหลังทึบ (สีขาว) */
  border-radius: 12px; /* ความโค้งของขอบใน (เล็กกว่าขอบนอกเล็กน้อย) */
  text-align: left;
}

/* Animation (เหมือนเดิม) */
@keyframes gradientBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ถ้าต้องการให้ไอคอนและข้อความอยู่เหนือ gradient ให้เพิ่ม z-index ให้กับส่วนนี้ด้วย */
.ach-icon, .ach-details {
  position: relative;
  z-index: 2; /* ทำให้ไอคอนและข้อความอยู่เหนือ ach-item และ gradient */
}

/* ปรับสีพื้นหลังของ ach-item ให้เป็นสีเดียว เพื่อให้เห็น gradient ชัดขึ้น */
.ach-item {
  background: #ffffff; /* หรือสีพื้นหลังของ card ของคุณ */
}
  .ach-icon {
    font-size: 2rem;
    color: var(--primary);
    flex-shrink: 0;
    width: 50px;
    text-align: center;
  }
  .ach-details {
    flex-grow: 1;
  }
  .ach-name {
    font-weight: 500;
    color: var(--secondary);
  }
  .ach-desc {
    font-size: 0.9rem;
    color: var(--muted-text);
  }

  /* === [NEW] Confetti Canvas Style === */
  #celebrationCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002; /* Higher than the achievement modal overlay */
    pointer-events: none; /* Make it unclickable */
  }
  
  /* [NEW] Style for Pending Points Notice */
  #pendingPointsNotice {
    display: none; /* Hidden by default */
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
    text-align: center;
  }
  #pendingPointsNotice a {
      color: var(--primary);
      font-weight: 500;
  }

  /* [NEW 6.5.5] Styles for Rewards Section in Cart */
  #rewardsSection {
    margin-top: 20px;
  }
  .reward-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 10px;
  }
  .reward-item.selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary);
  }
  .reward-item input[type="radio"] {
    flex-shrink: 0;
  }
  .reward-details {
    flex-grow: 1;
  }
  .reward-name {
    font-weight: 500;
  }
  .reward-desc {
    font-size: 0.9em;
    color: var(--muted-text);
  }

  /* === [NEW] LIFF Login Modal Enhancements === */
  .liff-login-modal, .liff-login-modal * {
    box-sizing: border-box;
  }
  .liff-login-modal {
    max-width: 420px;
    text-align: center;
    border: 2px solid var(--primary);
    background: linear-gradient(-45deg, #E4F3EF, #ffffff, #FDFCF9, #E4F3EF);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    padding: 24px;
  }

  @keyframes gradientBG {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
  }

  .liff-modal-title {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 500;
    width: 100%;
    text-align: center;
  }
  .liff-modal-subtitle {
    font-size: 1rem;
    color: var(--muted-text);
    text-align: center;
    line-height: 1.5;
  }
  .benefits-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    text-align: left;
    display: inline-block;
  }
  .benefits-list li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  .benefits-list li i {
    color: var(--primary);
    background-color: var(--primary-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .liff-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: #00B900;
    color: white;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    text-decoration: none;
    margin-top: 1rem;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 185, 0, 0.2);
    transition: all 0.2s ease;
  }
  .liff-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 185, 0, 0.3);
  }

  /* Styles for image button */
  .choice-card.image-button {
    padding: 0;
    position: relative;
    
    /* 1. ปิดหรือลบความสูงที่ล็อคไว้เดิม */
    /* height: 150px; */ 
    
    /* 2. กำหนดให้ยืดหดตามสัดส่วนจริงของภาพคุณ (1200 หาร 466) */
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 466; /* <-- ใส่เลขขนาดภาพของคุณลงไปตรงๆ ได้เลย */
    
    overflow: hidden;
    
    /* 3. (เพิ่มเติม) ปรับเพื่อให้แน่ใจว่าภาพจะขยายเต็มพื้นที่ที่จองไว้ */
    display: flex; 
}
#choiceDrinks {
    aspect-ratio: 1200 / 555 !important; /* บังคับใช้สัดส่วนนี้เฉพาะปุ่มนี้ */
}

  .choice-card.image-button img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image covers the button area without distortion */
    display: block;
  }



  /* === Login Modal Styles === */
  .login-modal {
    max-width: 500px;
    width: 90vw;
  }

  .login-modal-title {
    font-size: 1.5rem;
    color: var(--secondary);
    margin: 0;
    text-align: center;
  }

  .login-modal-subtitle {
    text-align: center;
    color: var(--muted-text);
    margin-bottom: 2rem;
    font-size: 1rem;
  }

  .login-modal-body {
    padding: 0 1.5rem 1.5rem;
  }

  .login-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .login-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .login-section h3 i {
    color: var(--primary);
  }

  .login-description {
    margin: 0 0 1rem 0;
    color: var(--muted-text);
    font-size: 0.9rem;
  }

  .phone-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .phone-input-container input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
    transition: all 0.2s ease;
  }

  .phone-input-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 158, 120, 0.2);
  }

  .login-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  }

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

  .phone-btn:hover {
    background: #3d8a66;
  }

  .line-btn {
    background: #00B900;
    color: white;
  }

  .line-btn:hover {
    background: #009900;
  }

  .guest-btn {
    background: var(--muted-text);
    color: white;
  }

  .guest-btn:hover {
    background: #6b6b6b;
  }

  .social-benefits {
    margin: 1rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .benefit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary);
  }

  .benefit-item i {
    color: var(--primary);
    background-color: var(--primary-light);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
  }

  /* Responsive adjustments for login modal */
  @media (max-width: 768px) {
    .login-modal {
      width: 95vw;
      max-height: 90vh;
      overflow-y: auto;
    }
    
    .social-benefits {
      grid-template-columns: 1fr;
    }
    
    .login-section {
      padding: 1rem;
    }
    
    .login-modal-body {
      padding: 0 1rem 1rem;
    }
  }


  /* === Points Modal Styles === */
  .points-modal {
      max-width: 450px;
      width: 90vw;
      text-align: center;
  }

  .points-modal-header {
      padding: 2rem 1.5rem 1rem;
      background: linear-gradient(135deg, var(--primary) 0%, #2d7a4f 100%);
      color: white;
      border-radius: 16px 16px 0 0;
      position: relative;
      overflow: hidden;
  }

  .points-modal-header::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
      animation: shimmer 3s ease-in-out infinite;
  }

  @keyframes shimmer {
      0%, 100% { transform: rotate(0deg); }
      50% { transform: rotate(180deg); }
  }

  .points-icon {
      width: 60px;
      height: 60px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 1rem;
      font-size: 1.5rem;
      animation: bounce 2s ease-in-out infinite;
  }

  @keyframes bounce {
      0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
      40% { transform: translateY(-10px); }
      60% { transform: translateY(-5px); }
  }

  .points-modal-header h2 {
      margin: 0 0 0.5rem 0;
      font-size: 1.8rem;
      font-weight: 600;
  }

  .points-modal-header p {
      margin: 0;
      opacity: 0.9;
      font-size: 1rem;
  }

  .points-modal-body {
      padding: 2rem 1.5rem;
  }

  .points-animation {
      margin-bottom: 2rem;
  }

  .points-counter {
      display: flex;
      align-items: baseline;
      justify-content: center;
      gap: 0.5rem;
      margin-bottom: 1.5rem;
  }

  .points-number {
      font-size: 3rem;
      font-weight: 700;
      color: var(--primary);
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
  }

  .points-label {
      font-size: 1.2rem;
      color: var(--secondary);
      font-weight: 500;
  }

  .points-complete .points-number {
      animation: pointsGlow 0.6s ease-out;
  }

  @keyframes pointsGlow {
      0% { transform: scale(1); }
      50% { transform: scale(1.2); color: #ff6b35; }
      100% { transform: scale(1); }
  }

  .points-details {
      background: var(--surface);
      border-radius: 12px;
      padding: 1.5rem;
      margin-bottom: 1.5rem;
      border: 1px solid var(--border-color);
  }

  .detail-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.5rem 0;
      font-size: 0.95rem;
  }

  .detail-row:not(:last-child) {
      border-bottom: 1px solid var(--border-color);
  }

  .detail-row.total {
      font-weight: 600;
      font-size: 1.1rem;
      color: var(--primary);
      margin-top: 0.5rem;
      padding-top: 1rem;
      border-top: 2px solid var(--primary);
      border-bottom: none;
  }

  .points-benefits {
      background: var(--primary-light);
      border-radius: 12px;
      padding: 1.5rem;
      text-align: left;
  }

  .points-benefits h4 {
      margin: 0 0 1rem 0;
      color: var(--primary);
      font-size: 1.1rem;
      text-align: center;
  }

  .points-benefits ul {
      margin: 0;
      padding: 0;
      list-style: none;
  }

  .points-benefits li {
      padding: 0.5rem 0;
      position: relative;
      padding-left: 1.5rem;
      font-size: 0.9rem;
      color: var(--secondary);
  }

  .points-benefits li::before {
      content: '✨';
      position: absolute;
      left: 0;
      top: 0.5rem;
  }

  .points-modal-footer {
      padding: 1rem 1.5rem 1.5rem;
  }

  .points-modal-footer .btn {
      width: 100%;
      padding: 1rem 2rem;
      font-size: 1.1rem;
      font-weight: 600;
      border-radius: 12px;
      background: var(--primary);
      color: white;
      border: none;
      cursor: pointer;
      transition: all 0.2s ease;
  }

  .points-modal-footer .btn:hover {
      background: #3d8a66;
      transform: translateY(-2px);
      box-shadow: 0 6px 16px rgba(71, 158, 120, 0.3);
  }

  /* === Points Badge in Profile Button === */
  .points-badge {
      background: var(--primary);
      color: white;
      padding: 0.2rem 0.6rem;
      border-radius: 12px;
      font-size: 0.8rem;
      font-weight: 600;
      margin-left: 0.5rem;
      display: inline-block;
  }

  /* === Auto-fill Enhancements === */
  .suggestion-dropdown {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: white;
      border: 1px solid var(--border-color);
      border-top: none;
      border-radius: 0 0 8px 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      z-index: 1000;
      max-height: 200px;
      overflow-y: auto;
  }

  .suggestion-item {
      padding: 0.75rem 1rem;
      cursor: pointer;
      border-bottom: 1px solid var(--border-color);
      transition: background-color 0.2s ease;
  }

  .suggestion-item:hover {
      background-color: var(--primary-light);
  }

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

  .suggestion-meta {
      font-size: 0.8rem;
      color: var(--muted-text);
      margin-top: 0.2rem;
  }

  /* === Form Field Enhancements === */
  .form-field-enhanced {
      position: relative;
  }

  .form-field-enhanced input[readonly] {
      background-color: #f8f9fa;
      border-color: #e9ecef;
      color: #6c757d;
  }

  .form-field-enhanced .field-icon {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--muted-text);
      pointer-events: none;
  }

  /* === Loading States === */
  .loading-spinner {
      display: inline-block;
      width: 16px;
      height: 16px;
      border: 2px solid #f3f3f3;
      border-top: 2px solid var(--primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
  }

  @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
  }

  /* === Responsive Adjustments === */
  @media (max-width: 768px) {
      .points-modal {
          width: 95vw;
          max-height: 90vh;
          overflow-y: auto;
      }
      
      .points-modal-header {
          padding: 1.5rem 1rem 0.75rem;
      }
      
      .points-modal-header h2 {
          font-size: 1.5rem;
      }
      
      .points-number {
          font-size: 2.5rem;
      }
      
      .points-modal-body {
          padding: 1.5rem 1rem;
      }
      
      .points-benefits {
          padding: 1rem;
      }
  }

  /* === Animation Utilities === */
  .fade-in {
      animation: fadeIn 0.3s ease-out;
  }

  @keyframes fadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
  }

  .slide-up {
      animation: slideUp 0.4s ease-out;
  }

  @keyframes slideUp {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
  }

  #loading-overlay {
      position: fixed;
      inset: 0;
      background-color: rgba(0, 0, 0, 0.7);
      display: none; /* ซ่อนไว้ก่อน */
      align-items: center;
      justify-content: center;
      flex-direction: column;
      z-index: 10000;
      color: white;
  }
  #loading-overlay .spinner {
      width: 50px;
      height: 50px;
      border: 5px solid #f3f3f3;
      border-top: 5px solid var(--primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 20px;
  }
  #loading-text {
      font-size: 1.2rem;
  }
  @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
  }

  /* ================================================= */
  /* === [FINAL] TOPPING GRID & IMAGE LAYOUT STYLES === */
  /* ================================================= */

  /* 1. Container for 2 Columns (Topping Grid) */
  .topping-grid {
      display: grid;
      grid-template-columns: 1fr; /* Default: 1 column on mobile */
      gap: 10px; /* Space between items */
      margin-top: 10px;
  }

  @media(min-width: 760px) {
      .topping-grid {
          grid-template-columns: repeat(2, 1fr); /* 2 columns on desktop */
      }
  }

  /* 2. Individual Item Card (.topping-item) */
  .topping-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      cursor: pointer;
      background: var(--surface);
      border: 1px solid var(--border-color);
      border-radius: 12px;
      padding: 10px; 
      transition: all 0.2s ease;
      min-height: 40px; /* Ensures minimum height even without content */
  }

  /* 3. Info Container (Image + Text) */
  .topping-info {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-grow: 1;
      position: relative; /* สำคัญสำหรับตำแหน่งของ Placeholder */
      /* เนื่องจากเราลบ margin-left ออกจาก topping-text ใน JS แล้ว, เราไม่จำเป็นต้องมี margin-left: 52px; ที่นี่อีก */
  }
  
  /* 4. Image/Placeholder Size */
  .topping-thumb {
      width: 40px;
      height: 40px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border-color);
      flex-shrink: 0;
      z-index: 2; /* รูปจริงอยู่ด้านบน */
      /* [NEW FIX] ให้รูปภาพถูกวางใน flow และ Placeholder ถูกวางแบบ Absolute */
      position: absolute;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
  }
  
  /* 5. Placeholder Style */
  .topping-placeholder {
      /* [NEW FIX] ให้ Placeholder แสดงผลเป็น Flex */
      display: flex; 
      align-items: center;
      justify-content: center;
      
      width: 40px;
      height: 40px;
      border-radius: 6px;
      background-color: var(--primary-light);
      color: var(--primary);
      font-size: 1.2rem;
      
      /* [NEW FIX] วางซ้อนทับตำแหน่งเดียวกันกับรูปภาพ */
      position: absolute; 
      top: 50%;
      left: 0;
      transform: translateY(-50%);
      z-index: 1; /* อยู่ด้านล่างรูปภาพจริง */
      
      border: 1px solid var(--primary);
  }

  /* 6. Text Container */
  .topping-text {
      display: flex;
      flex-direction: column;
      
      /* [FINAL FIX] ชดเชยพื้นที่รูปภาพ 40px + gap 12px */
      margin-left: 52px; 
  }

  .image-zoom-container {
    position: relative; /* ทำให้ไอคอนซูมลอยอยู่เหนือรูปได้ */
    display: inline-block; /* ทำให้ container มีขนาดพอดีกับรูป */
    line-height: 0; /* แก้ปัญหาระยะห่างแปลกๆ ใต้รูป */
    flex-shrink: 0; 
}

/* 2. สไตล์ของไอคอนซูม */
.zoom-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* จัดให้อยู่กลางรูปเป๊ะๆ */
    
    background-color: rgba(0, 0, 0, 0.6); /* พื้นหลังสีดำโปร่งแสง */
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%; /* ทำให้เป็นวงกลม */
    display: flex;
    align-items: center;
    justify-content: center;
    
    font-size: 14px;
    opacity: 0; /* ซ่อนไว้เป็นค่าเริ่มต้น */
    
    /* ทำให้คลิก "ทะลุ" ไอคอนไปโดนรูปภาพข้างใต้ได้ */
    pointer-events: none; 
    
    /* เรียกใช้ Animation */
    animation: pulse-zoom 3s infinite;
}

/* 3. การเคลื่อนไหว (Animation) ของไอคอน */
@keyframes pulse-zoom {
    0% {
        opacity: 0.07;
        transform: translate(-50%, -50%) scale(0.8);
    }
    15% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(1);
    }
    40% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(1);
    }
    55% {
        opacity: 0.1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 0.07;
    }
}

.auth-modal-overlay {
    display: none; /* เริ่มต้นด้วยการซ่อนไว้ */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.auth-modal-overlay.show {
    display: flex !important;
}

/* ========================================= */
/* === [NEW BLOCK] Shop Status Overlay Styles === */
/* ========================================= */

/* 1. Blur Effect on Body (when closed) */
body.blurred > *:not(#shop_status_overlay):not(#toast):not(#loading-overlay) {
    filter: blur(5px);
    pointer-events: none;
    transition: filter 0.3s ease;
}
/* ป้องกันการเลื่อนหน้าจอเมื่อร้านปิด */
body.blurred {
    overflow: hidden; 
}

/* 2. Overlay Container */
#shop_status_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 1000;
    text-align: center;
    font-size: 1.5rem;
    font-family: 'Kanit', sans-serif;
    animation: fadeIn 0.5s;
}

.overlay-content {
    background: #333;
    padding: 30px;
    border-radius: 15px;
    max-width: 80%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.animated-icon {
    font-size: 4rem;
    color: #ffc107;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-8px); }
}

.pre-order-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.2s;
}

/* 3. New Styles for Cart Delivery Buttons (แก้ไขบรรทัด ~748) */
#deliveryNowBtn, #deliveryLaterBtn, #deliveryWalkinBtn { /* <-- เพิ่ม #deliveryWalkinBtn */
    /* Base style inherited from .btn .linkbtn */
    border: 2px solid var(--border-color);
}
#deliveryNowBtn.selected, #deliveryLaterBtn.selected {
    /* สีที่เลือกแล้ว */
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--secondary);
    box-shadow: 0 0 0 2px var(--primary);
}
/* [NEW] Style สำหรับปุ่ม Walk-in เมื่อถูกเลือก */
#deliveryWalkinBtn.selected {
    border-color: var(--secondary); /* ใช้สี Secondary (Dark Text) เป็นขอบ */
    background-color: #f0f0f0; /* Light Gray Highlight */
    color: var(--secondary);
    box-shadow: 0 0 0 2px var(--secondary);
}
#deliveryNowBtn:disabled {
    /* ปุ่มจัดส่งทันทีเมื่อร้านปิด */
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f8f8 !important;
    color: #999 !important;
}

/* --- Segmented Control (Option B) --- */
.segmented-control {
    display: flex;
    padding: 4px;
    background: var(--border-color); /* Background of the control */
    border-radius: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.segmented-item {
    flex: 1;
    padding: 10px 10px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease-in-out;
    border: none !important;
    background: transparent !important;
    color: var(--secondary) !important;
    box-shadow: none !important;
}

/* [MODIFIED] เปลี่ยนจากการใช้ .segmented-item มาเป็น .btn.linkbtn โดยตรง */
.btn.linkbtn.selected {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;
    transform: none !important;
}

.btn.linkbtn:hover:not(.selected) {
    color: var(--primary) !important;
    background: var(--surface-alt) !important;
    transform: none !important;
}

.segmented-item.selected {
    background: var(--surface) !important;
    color: var(--primary) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important; /* Subtle inner shadow */
    transform: none !important;
}

.segmented-item:hover:not(.selected) {
    color: var(--primary) !important;
    background: var(--surface-alt) !important;
    transform: none !important;
}

/* === 1. Custom Remove Button in Cart (แก้ไขปุ่มลบ) === */
.remove-item-btn:not(.qty-btn) { 
    /* Base style override */
    background: transparent !important;
    color: var(--error) !important;
    border: 1px solid var(--error) !important;
    box-shadow: none !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease;
    
    max-width: 50px; 
    min-width: 45px;
    white-space: nowrap; 
}

.remove-item-btn:not(.qty-btn):hover {
    background: var(--error) !important;
    color: white !important;
    transform: translateY(-1px);
}

/* Ensure the button stays on the right and is small */
.cart-item-card .row .remove-item-btn {
    margin-left: auto;
    flex-shrink: 0;
}

/* === 3. Full Width Datetime Input (แก้ไขช่องเวลา) === */
#preOrderDatetime {
    width: 100% !important; /* Make it full width */
    padding: 12px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    /* [FIX 3] ทำให้การคำนวณความกว้างรวม Padding และ Border */
    box-sizing: border-box; 
}

#continueShoppingBtn {
    font-size: 1.05 rem; /* กำหนดขนาดฟอนต์ให้เท่ากัน */
    padding: 14px 24px; /* ปรับ Padding ให้สอดคล้องกับขนาดฟอนต์ใหม่ */
    background: transparent !important; /* ให้พื้นหลังโปร่งใส (เหมือนเดิม) */
    color: #007bff !important; /* สีตัวอักษรเป็นสีฟ้า */
    border: 2px solid #007bff !important; /* สีขอบเป็นสีฟ้า */
}

#continueShoppingBtn:hover {
    /* [NEW COLOR: HOVER STATE] - เมื่อชี้เมาส์ */
    background: #007bff !important; /* พื้นหลังเป็นสีฟ้า */
    color: #fff !important; /* ตัวอักษรเป็นสีขาว */
    border-color: #007bff !important;
}
.duplicate-item-btn {
    /* ใช้สีหลัก (Primary Green) เพื่อให้ดูเป็นปุ่มดำเนินการที่เป็นมิตร */
    background: transparent !important;
    color: var(--primary) !important; 
    border: 1px solid var(--primary) !important;
    box-shadow: none !important;
    
    /* Inherit font size from remove-item-btn for consistency */
    padding: 4px 8px !important; 
    font-size: 13px !important; 
}

.duplicate-item-btn:hover {
    background: var(--primary) !important;
    color: white !important;
}
.edit-item-btn {
    /* ใช้สี Primary Green */
    background: transparent !important;
    color: var(--primary) !important; 
    border: 1px solid var(--primary) !important;
    box-shadow: none !important;
    
    /* Inherit font size/padding for consistency with other small buttons */
    padding: 4px 8px !important; 
    font-size: 13px !important; 
}

.edit-item-btn:hover {
    background: var(--primary) !important;
    color: white !important;
}
/* 1. สไตล์สำหรับ Flavor Grid Item ที่ถูกเลือก (ในหน้า Order Flow) */
.flavor-item-wrap.selected {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light);
    background-color: var(--primary-light);
}

/* 2. สไตล์สำหรับ Topping Grid Item ที่ถูกเลือก (ในหน้า Order Flow) */
.topping-item.selected {
    border-color: var(--primary) !important;
    background-color: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.tap-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    /* ไม่ต้องใช้ transform: translate(-50%, -50%) ที่นี่ เพราะเราจะให้ icon เป็นตัว animate */
    
    /* ซ่อนไว้เป็นค่าเริ่มต้น */
    display: none; 
    
    /* ปรับตำแหน่งเริ่มต้นให้อยู่เหนือศูนย์กลางเล็กน้อย */
    transform: translate(-50%, -50%) translateY(-10px); 
    
    /* ทำให้องค์ประกอบไม่ขวางการคลิกปุ่มด้านล่าง */
    pointer-events: none;
    z-index: 10;
}

/* 2. Style for the Finger Icon (กำหนดขนาดและสี) */
.tap-indicator > i {
    font-size: 2rem; /* ขนาดใหญ่ขึ้น */
    color: #ffffff; 
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-65%, 20%) translateY(-10px);
     text-shadow: 
        0 0 10px rgba(255, 153, 0, 0.5), /* เงาที่ทำให้ดูเด่น (เดิม) */
        -2px -2px 0px #001aad, /* ขอบบนซ้าย */
        2px -2px 0px #001aad,  /* ขอบบนขวา */
        -2px 2px 0px #001aad,   /* ขอบล่างซ้าย */
        2px 2px 0px #001aad;    /* ขอบล่างขวา */
    /* [NEW] ผูกแอนิเมชั่นการจิ้ม */
    animation: finger-tap 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 3. Keyframes: Tapping/Bouncing Motion */
@keyframes finger-tap {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    20% { transform: translateY(-15px) scale(1.05); } /* ยกนิ้วขึ้น */
    40% { transform: translateY(0) scale(1); opacity: 1; } /* จิ้มลง (เหมือนแตะ) */
    60% { transform: translateY(0) scale(1); opacity: 0.5; } /* พักสั้นๆ และจางลง */
    100% { transform: translateY(0) scale(1); opacity: 1; } /* วนลูปกลับมาใหม่ */
}
/* === [NEW] Styles for Disabled/Unusable Reward Item (UX Fix) === */
.reward-item.disabled-item {
    /* 1. ลดความเด่น */
    opacity: 0.6;
    background-color: #f8f8f8; /* สีพื้นหลังให้ดูจางลง */
    border-color: var(--border-color);
    
    /* 2. เปลี่ยน Cursor */
    cursor: not-allowed !important;
}

.reward-item.disabled-item:hover {
    /* ป้องกัน Hover Effect */
    background-color: #f8f8f8;
    box-shadow: none;
    border-color: var(--border-color);
}

.reward-item.disabled-item input[type="radio"] {
    /* ซ่อนตัว Radio Button ที่ถูก Disable */
    opacity: 0.3;
    pointer-events: none;
}

.reward-item.disabled-item .reward-name,
.reward-item.disabled-item .reward-desc {
    /* ทำให้ข้อความเป็นสีเทาอ่อนลง */
    color: var(--muted-text) !important;
}

/* === [NEW] Styles for Reward Detail Collapse (UX Fix) === */

/* 1. New Layout for Reward Details Container */
.reward-details {
    flex-grow: 1;
    position: relative; /* Anchor สำหรับปุ่มรายละเอียด */
    padding-right: 80px; /* เพิ่มพื้นที่สำหรับปุ่ม "รายละเอียด" */
    overflow: hidden; 
}

/* 2. Style for Truncated/Preview Description (แสดงแค่ 1 บรรทัด) */
.reward-desc-preview {
    font-size: 0.9em;
    color: var(--muted-text);
    /* บังคับให้แสดงแค่บรรทัดเดียวและซ่อนส่วนที่เกิน */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; 
}

/* 3. Style for the Details Toggle Button */
.details-toggle-btn {
    position: absolute;
    bottom: 0px; /* วางไว้มุมขวาล่าง */
    right: 15px;
    
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    padding: 2px 5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    
    /* Overrides default button styles */
    box-shadow: none;
    min-height: auto;
    width: auto;
    display: inline; 
}

/* 4. Style for the Full Description Area (Hidden by default) */
.reward-full-desc {
    display: none; /* ซ่อนไว้ตั้งแต่แรก */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.9em;
    color: var(--secondary);
    white-space: normal; /* อนุญาตให้ข้อความแสดงได้หลายบรรทัด */
    width: 100%;
}
.reward-full-desc.show {
    /* แสดงเมื่อผู้ใช้คลิกปุ่ม */
    display: block;
}

/* ========================================= */
/* ========================================= */
/* === CONSOLIDATED BEVERAGE SECTION STYLES === */
/* ========================================= */

/* --- A. Debug / Logger Styles (ย้ายจาก index2.html) --- */
#log-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 300px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    font-family: monospace;
    font-size: 12px;
    border-radius: 5px;
    border: 1px solid #333;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 9999;
}
#log-header {
    background-color: #222;
    padding: 5px;
    font-weight: bold;
    text-align: center;
}
#log-output {
    padding: 5px;
    height: 100%;
    overflow-y: scroll;
    word-wrap: break-word;
}

/* --- B. Layout Grids (รวมและแก้ไข) --- */

.beverage-grid { /* Grid หลักแสดงเมนูเครื่องดื่ม */
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    padding: 10px 0;
}

.bev-pkg-grid { /* Grid เลือกขนาดแก้ว */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    gap: 10px;
    justify-items: center; 
}

.bev-sweet-grid { /* Grid เลือกระดับความหวาน */
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* FIX: บังคับเป็น 4 คอลัมน์ แก้ปัญหาทะลุจอ */
    gap: 10px;
}

/* Note: ไม่จำเป็นต้องมี Media Query สำหรับ bev-sweet-grid อีก */

.bev-topping-grid { /* Grid เลือกท็อปปิ้งเครื่องดื่ม */
    display: grid;
    grid-template-columns: 1fr; /* 1 คอลัมน์บนมือถือ */
    gap: 10px;
}
@media (min-width: 760px) {
    .bev-topping-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์บนจอใหญ่ */
    }
}


/* --- C. Product Item Styles (Image Style) --- */

.beverage-grid-item.image-style {
    position: relative;
    overflow: hidden;
    padding: 0; 
    border: none; 
    border-radius: 12px; 
    background: none;
    display: flex; 
    flex-direction: column; 
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow); 
}
.beverage-grid-item.image-style:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover); 
}

.beverage-thumb.large {
    display: block;
    width: 100%;           /* ให้กว้างเต็มพื้นที่ของการ์ด */
    height: auto;          /* ให้ความสูงปรับตามสัดส่วนที่กำหนด */
    
    /* กำหนดสัดส่วน กว้าง 355 : สูง 455 */
    aspect-ratio: 355 / 455;   
    
    object-fit: cover;     /* สำคัญ: ตัดส่วนเกินออก เพื่อให้ภาพไม่เบี้ยว */
    object-position: center; /* จัดกึ่งกลางภาพ */
    
    border-radius: 0; 
}

.beverage-name.below {
    width: 100%;
    background-color: #fff85021;
    color: #000000;
    padding: 10px 8px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    box-sizing: border-box;
    border-bottom-left-radius: 11px;
    border-bottom-right-radius: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, 1px 1px 0 #ffffff;
}


/* --- D. Option and Topping Item Styles (รวม Bev-option-label และ Bev-topping-item) --- */

/* Base Style for Package and Sweetness Options (bev-option-label) */
.bev-option-label {
    display: inline-flex; 
    align-items: center; 
    padding: 8px 12px;
    border: 1px solid var(--border-color); 
    border-radius: 8px;
    cursor: pointer; 
    transition: all 0.2s ease-in-out;
    background-color: #fff; 
    margin: 5px; /* จาก index2.html */
    text-align: center; 
    flex-grow: 1; 
    min-width: 80px; 
    font-size: 0.9rem;
}
/* Note: ใช้ bev-option-item เป็น alias ของ bev-option-label ใน JS */
.bev-option-label input[type="radio"],
.bev-option-label input[type="checkbox"] {
    margin-right: 8px; 
    accent-color: var(--primary); 
}
.bev-option-label.selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style for Topping Options (bev-topping-item) */
.bev-topping-item { 
    display: flex; 
    align-items: center; 
    padding: 10px;
    border: 1px solid var(--border-color); 
    border-radius: 8px;
    cursor: pointer; 
    transition: all 0.2s ease; 
    background-color: #fff;
    margin-bottom: 10px; 
}
.bev-topping-item input[type="checkbox"] {
    margin-right: 10px;
    flex-shrink: 0; 
    accent-color: var(--primary);
}
.bev-topping-item.selected { 
    border-color: var(--primary); 
    background-color: var(--primary-light); 
}
.bev-topping-item.disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    background-color: #f8f8f8; 
}

/* --- Stepper Style: ปุ่มวงกลม + ตัวเลขใหญ่ --- */
.qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* ระยะห่างระหว่างปุ่มกับตัวเลข */
    background: transparent; /* พื้นหลังใส เพื่อให้ปุ่มดูลอยเด่น */
}

.qty-btn {
    /* --- กำหนดขนาดที่ต้องการตรงนี้ --- */
    width: 30px !important;   /* ลองปรับเป็น 30px ดูครับ */
    height: 30px !important;  /* ต้องเท่ากับ width ถึงจะกลม */
    
    /* --- ล้างค่าที่อาจจะล็อกขนาดปุ่มไว้ --- */
    min-width: 0 !important;  /* ยกเลิกการห้ามเล็กกว่า 45px */
    min-height: 0 !important; 
    padding: 0 !important;    /* ลบ padding ที่ดันให้ปุ่มอ้วน */
    margin: 0 !important;
    
    /* --- ดีไซน์ --- */
    border-radius: 50% !important; /* 50% คือวงกลมเป๊ะๆ (33% จะเป็นสี่เหลี่ยมมน) */
    border: 1px solid #e0e0e0 !important;
    background-color: #ffffff !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    
    /* --- จัดกึ่งกลาง --- */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    cursor: pointer;
    font-size: 12px !important; 
    line-height: 1 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* เอฟเฟกต์ตอนชี้เมาส์ */
.qty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.qty-btn:active {
    transform: scale(0.95); /* ยุบลงเมื่อกด */
}

/* สีเฉพาะปุ่ม */
.qty-btn.minus {
    color: #ef4444; /* สีแดง */
    border-color: #ce3333;
}
.qty-btn.minus:hover {
    background-color: #fef2f2;
}

.qty-btn.plus {
    color: var(--primary); /* สีเขียว (ตามธีม) */
    border-color: #d1fae5;
}
.qty-btn.plus:hover {
    background-color: #ecfdf5;
}

/* ตัวเลขตรงกลาง */
.qty-num {
    min-width: 24px;
    text-align: center;
    font-weight: 700;  /* ตัวหนา */
    font-size: 18px;   /* ขนาดใหญ่กว่าปุ่ม */
    color: #333;
    line-height: 1;
}

/* สไตล์ป้ายจำนวนคูปอง (วงกลมสีแดงหรือเขียวตามธีม) */
.coupon-badge {
    background-color: var(--primary); /* สีเขียวตามธีมร้าน */
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

/* --- Reward Grouping Styles --- */

/* ปุ่มดูทั้งหมด (สีฟ้าอ่อน ดูเป็นมิตร) */
.btn-expand-group {
    background-color: #e0f2fe;
    color: #0284c7;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.85em;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    margin-top: 5px;
    transition: background-color 0.2s;
}
.btn-expand-group:hover {
    background-color: #bae6fd;
}

/* กล่องรายการย่อย (Child List) */
.reward-sub-list {
    display: none; /* ซ่อนไว้ก่อน */
    margin-left: 20px; /* ย่อหน้าเข้าไป */
    padding-left: 10px;
    border-left: 2px solid #e5e7eb; /* เส้นกั้นซ้ายให้รู้ว่าเป็นกลุ่ม */
    margin-top: 5px;
    margin-bottom: 10px;
    background-color: #f9fafb;
    border-radius: 0 0 8px 8px;
}
.reward-sub-list.show {
    display: block; /* แสดงเมื่อมีคลาส show */
    animation: slideDown 0.3s ease-out;
}

/* รายการย่อยแต่ละใบ */
.reward-item.child {
    border: none;
    border-bottom: 1px solid #f3f4f6;
    background: transparent;
    padding: 10px;
    margin-bottom: 0;
}
.reward-item.child:last-child {
    border-bottom: none;
}

/* อนิเมชั่นเลื่อนลงเบาๆ */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* สไตล์ปุ่ม "รายละเอียด" มุมขวาล่าง */
.view-detail-link {
    font-size: 0.8em;
    color: #6ba377; /* สีเทาจางๆ */
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}
.view-detail-link:hover {
    color: var(--primary); /* สีเขียวเมื่อเอาเมาส์ชี้ */
}

/* ปรับแต่ง Modal ให้สวยงาม (ทับของเดิมหรือเพิ่มใหม่) */
.ach-modal-content h3 {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
}
.ach-modal-content ul {
    padding-left: 20px;
    margin: 10px 0;
}

.btn-add-more-row {
    width: 100%;
    background-color: transparent;
    border: 2px dashed #d1d5db; /* เส้นประสีเทาอ่อน */
    color: #6b7280;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0; /* เว้นระยะบนล่าง */
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-add-more-row:hover {
    border-color: var(--primary); /* สีเขียวเมื่อชี้ */
    color: var(--primary);
    background-color: #f0fdf4; /* พื้นหลังเขียวอ่อนๆ */
}

.btn-add-more-row i {
    font-size: 1.1em;
}

/* ป้าย NEW แบบ Modern Gradient */
.badge-new-flavor {
    display: inline-block;
    /* ไล่สีจากแดงชมพูไปส้ม ให้ดูมีมิติ */
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    color: white;
    font-size: 0.65em; /* ปรับลดนิดหน่อยเพื่อให้เข้ากับทรงแคปซูล */
    font-weight: 700;
    letter-spacing: 0.5px; /* เพิ่มระยะห่างตัวอักษรให้อ่านง่าย */
    padding: 3px 8px; /* เพิ่มพื้นที่หายใจ */
    border-radius: 99px; /* ทำเป็นทรงแคปซูล */
    margin-left: 8px;
    vertical-align: middle;
    /* เงาสีแดงจางๆ ให้ดูนุ่มนวล */
    box-shadow: 0 2px 6px rgba(255, 71, 87, 0.4);
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    
    /* Animation เดิม (ดีอยู่แล้วครับ กินเครื่องน้อย) */
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* =========================================
   FLAVOR STATUS & BADGES (เพิ่มใหม่)
   ========================================= */

/* 1. การ์ดรสชาติเมื่อสินค้าหมด */
.flavor-item.is-sold-out {
    position: relative;
    opacity: 0.6;             /* จางลง */
    filter: grayscale(80%);   /* สีซีดลงเกือบขาวดำ */
    pointer-events: none;     /* ห้ามกด */
    user-select: none;
}

/* 2. ป้ายตัวหนังสือ SOLD OUT ทับรูป */
.sold-out-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg); /* เอียงนิดๆ ให้ดูอาร์ต */
    background-color: rgba(220, 38, 38, 0.9); /* สีแดงเข้ม โปร่งแสงนิดหน่อย */
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border: 2px solid white;
}

/* 3. ป้ายกำกับ (Badge) ต่างๆ */
.flavor-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.badge-tag {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #444;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
}

/* ป้ายสถานะพิเศษ (New / Best Seller) */
.badge-special {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 99px; /* ทรงแคปซูล */
    font-weight: 700;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.badge-new {
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%); /* แดงชมพู */
}

.badge-best {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); /* ทองส้ม */
}

/* ปรับ Type Badge ให้ดูดีขึ้น */
.badge-type-creamy { background-color: #fff7ed; color: #9a3412; border-color: #ffedd5; }
.badge-type-sorbet { background-color: #f0fdf4; color: #166534; border-color: #dcfce7; }
.badge-type-lowsugar { background-color: #ecfeff; color: #0e7490; border-color: #cffafe; }