/* Basic Reset & Font */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  max-width: 100%; /* Ensure no horizontal scroll caused by content */
  overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
  font-family: 'Sarabun', sans-serif;
  background: #eef2f6; /* Lighter, cooler background */
  min-height: 100vh;
  padding: 20px;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Removed overflow-x: hidden here as it's in html,body now */
}

.container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff; /* White background */
  border-radius: 16px; /* More pronounced border-radius */
  padding: 35px; /* More padding */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08); /* Stronger, yet soft shadow */
  border: 1px solid #e5e5e5; /* Light border */
  position: relative; /* For loading overlay and absolute positioning of admin button */
  overflow: hidden; /* For smooth transitions */
}

.header {
  text-align: center;
  margin-bottom: 30px; /* More margin */
}

.header h1 {
  color: #2c3e50; /* Darker, more sophisticated blue/gray */
  font-size: 30px; /* Larger font */
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: none;
  display: flex; /* For icon alignment */
  align-items: center;
  justify-content: center;
  gap: 10px; /* Space between icon and text */
}
.header h1 svg {
    width: 30px; /* Adjust icon size */
    height: 30px;
}
/* Material Icons specific adjustment */
.header h1 .material-icons {
    font-size: 30px; /* Match SVG size */
    color: rgb(0, 0, 0); /* Ensure color is applied */
}


.header p {
  color: #7f8c8d; /* Softer gray */
  font-size: 16px;
  font-weight: 300;
  line-height: 1.5;
}

/* Admin Controls (Top Right) */
.admin-controls {
    position: absolute;
    top: 20px; /* Adjust as needed */
    right: 20px; /* Adjust as needed */
    z-index: 10; /* Ensure it's on top */
}
.admin-controls button {
    margin: 0; /* Remove default button margins */
    padding: 8px 15px; /* Adjust padding for smaller button */
    border-radius: 8px; /* Slightly smaller border-radius */
    border: none;
    cursor: pointer;
    font-size: 14px; /* Smaller font size for compact button */
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Lighter shadow */
    background: #3f51b5;
    color: white;
    display: flex; /* For icon alignment */
    align-items: center;
    gap: 6px; /* Space between icon and text */
}
.admin-controls button svg {
    width: 16px; /* Adjust icon size */
    height: 16px;
    color: white; /* Ensure SVG is white */
}

.admin-controls button:hover {
    background: #536dfe;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(63, 81, 181, 0.25);
}

/* Person Selection Screen */
.person-selection .header {
    margin-top: 40px; /* Add top margin to prevent overlap with admin button */
}

/* Search Container */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px; /* Space below search bar */
    align-items: center;
}

.search-container .form-control {
    flex-grow: 1; /* Allows input to take available space */
    padding: 12px 15px; /* Slightly less padding than other inputs */
    font-size: 15px;
}

.search-container .search-button {
    width: auto; /* Allow button to size based on content */
    padding: 12px 20px; /* Adjust padding */
    margin-top: 0; /* Remove top margin */
}


.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Larger min-width */
  gap: 20px; /* More gap */
  margin-top: 25px;
}

.person-card {
  background: #ffffff;
  border-radius: 12px; /* Softer border-radius */
  padding: 22px; /* More padding */
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Slower, smoother transition */
  border: 1px solid #e0e0e0; /* Lighter border */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.person-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(63, 81, 181, 0.08), transparent); /* Slightly stronger hover gradient */
  transition: left 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); /* Slower transition */
}

.person-card:hover::before {
  left: 100%;
}

.person-card:hover {
  transform: translateY(-5px); /* More pronounced lift */
  border-color: #536dfe; /* Brighter blue on hover */
  box-shadow: 0 15px 25px rgba(63, 81, 181, 0.15); /* More pronounced shadow */
}

.person-avatar {
  width: 90px; /* Larger avatar */
  height: 90px; /* Larger avatar */
  border-radius: 50%;
  margin: 0 auto 15px; /* More margin */
  background: #7986cb; /* Softer blue */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px; /* Larger font */
  color: white;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(63, 81, 181, 0.25); /* More pronounced shadow */
  position: relative;
  overflow: hidden;
}

.person-avatar .person-icon {
    width: 60%;
    height: 60%;
}
/* Style for SVG icons inside avatar */
.person-avatar svg {
    width: 60%;
    height: 60%;
    fill: white;
}
/* Material Icons within person-avatar */
.person-avatar .material-icons {
    font-size: 36px; /* Match SVG size */
    color: white;
}


.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.person-fullName { /* Changed from person-name */
  font-size: 18px; /* Larger font */
  font-weight: 600;
  color: #34495e; /* Darker text */
  margin-bottom: 6px; /* More margin */
}

.person-shortName { /* New style for short name */
    font-size: 15px;
    color: #7f8c8d;
    font-weight: 400;
    margin-top: -4px; /* Adjust as needed */
    margin-bottom: 8px; /* Space between short name and phone */
}

.person-phone {
  font-size: 14px; /* Slightly larger font */
  color: #95a5a6; /* Softer gray */
  font-weight: 400;
}

.person-actions {
  margin-top: 10px; /* More margin */
  display: flex;
  gap: 10px; /* More gap */
  justify-content: center;
}

.person-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px; /* Larger icon */
  color: #95a5a6; /* Softer gray */
  transition: color 0.2s ease;
}

.person-actions button:hover {
  color: #3f51b5; /* Deeper blue on hover */
}

.person-actions .delete-btn {
  color: #e74c3c; /* Brighter red */
}
.person-actions .delete-btn:hover {
  color: #c0392b; /* Darker red on hover */
}

/* Amount Input Screen */
.amount-screen, .qr-screen {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.amount-screen.active, .qr-screen.active {
  opacity: 1;
  transform: translateY(0);
}

.back-button {
  background: #3f51b5;
  border: 1px solid #ffffff; /* Softer border */
  color: #ffffff; /* Softer dark gray */
  padding: 10px 18px; /* More padding */
  border-radius: 10px; /* Softer border-radius */
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px; /* Slightly larger font */
  font-weight: 500;
  margin-bottom: 20px; /* More margin */
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.back-button .material-icons {
    font-size: 20px; /* Adjust Material Icon size in back button */
}


.back-button:hover {
 background: #536dfe;
  transform: translateX(-5px); /* More pronounced slide */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.selected-person {
  text-align: center;
  margin-bottom: 30px; /* More margin */
  padding: 20px; /* More padding */
  background: #fdfdfd; /* Lighter background */
  border-radius: 12px; /* Softer border-radius */
  border: 1px solid #f0f0f0; /* Lighter border */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.selected-person .person-avatar {
  width: 80px; /* Slightly larger avatar */
  height: 80px; /* Slightly larger avatar */
  font-size: 32px; /* Slightly larger font */
}

.selected-person .person-avatar .person-icon {
    width: 60%;
    height: 60%;
}
.selected-person .person-avatar svg {
    width: 60%;
    height: 60%;
}
/* Material Icons within selected-person avatar */
.selected-person .person-avatar .material-icons {
    font-size: 32px; /* Match SVG size */
    color: white;
}


.form-group {
  margin-bottom: 22px; /* More margin */
}

.form-group label {
  display: block;
  margin-bottom: 8px; /* More margin */
  font-weight: 600;
  color: #555;
  font-size: 15px;
  display: flex; /* For icon alignment */
  align-items: center;
  gap: 6px;
}
.form-group label svg {
    width: 18px; /* Adjust icon size */
    height: 18px;
    color: #555;
}
.form-group label .material-icons {
    font-size: 18px; /* Match SVG size */
    color: #555;
}


.form-control {
  width: 100%;
  padding: 14px 18px; /* More padding */
  border: 1px solid #dcdcdc; /* Softer border */
  border-radius: 10px; /* Softer border-radius */
  font-size: 16px;
  font-family: 'Sarabun', sans-serif;
  transition: all 0.2s ease;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: #536dfe; /* Brighter blue for focus */
  background: #fff;
  box-shadow: 0 0 0 4px rgba(83, 109, 254, 0.2); /* Softer shadow on focus */
  transform: translateY(-2px); /* Slightly more pronounced lift */
}

.btn {
  width: 100%;
  padding: 15px; /* More padding */
  background: #3f51b5; /* Deeper blue */
  color: white;
  border: none;
  border-radius: 10px; /* Softer border-radius */
  font-size: 17px; /* Slightly larger font */
  font-weight: 600;
  font-family: 'Sarabun', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 15px;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: 0 8px 15px rgba(63, 81, 181, 0.2); /* Initial shadow */
  display: flex; /* For icon alignment */
  align-items: center;
  justify-content: center;
  gap: 8px; /* Space between icon and text */
}
.btn svg {
    width: 20px; /* Adjust icon size for buttons */
    height: 20px;
    color: white;
}
.btn .fa {
    font-size: 20px; /* Match SVG size for Font Awesome icons */
    color: white;
}


.btn:hover {
  transform: translateY(-3px); /* More pronounced lift */
  box-shadow: 0 12px 20px rgba(63, 81, 181, 0.3); /* More pronounced shadow */
  background: #536dfe; /* Brighter blue on hover */
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 10px rgba(63, 81, 181, 0.2);
}

.btn-download { /* Style for download button */
  background: #00bcd4; /* Cyan color */
  margin-top: 15px; /* Add margin to separate from QR display */
}
.btn-download svg {
    color: white;
}

.btn-download:hover {
  background: #00acc1; /* Darker cyan on hover */
  box-shadow: 0 12px 20px rgba(0, 188, 212, 0.3);
}

/* QR Result Screen */
.qr-container {
  text-align: center;
  margin-top: 30px; /* More margin */
  padding: 25px;
  background: #fdfdfd;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

#qrcode {
  margin-bottom: 20px; /* More margin */
  display: inline-block; /* To center the canvas */
}

/* The canvas for QR code and text will be generated dynamically,
   so we apply styling directly to the canvas element. */
#qrcode canvas {
  border-radius: 10px; /* Softer border-radius */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* More pronounced shadow */
  max-width: 100%; /* Ensure QR code is responsive */
  height: auto; /* Maintain aspect ratio */
}

.merchant-info {
  background: #4a69bd; /* Richer blue */
  color: white;
  padding: 18px; /* More padding */
  border-radius: 10px;
  margin-top: 15px; /* More margin */
  text-align: center;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.merchant-info h3 {
  font-size: 20px; /* Larger font */
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.merchant-info h3 svg {
    width: 22px; /* Adjust icon size */
    height: 22px;
    color: white;
}

.merchant-info p {
  font-size: 16px; /* Larger font */
  font-weight: 400;
  opacity: 0.95;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.merchant-info p svg {
    width: 18px; /* Adjust icon size */
    height: 18px;
    color: white;
}
.merchant-info p .material-icons {
    font-size: 18px; /* Match SVG size */
    color: white;
}


.amount-display {
  background: #27ae60; /* Vibrant green */
  color: white;
  padding: 15px; /* More padding */
  border-radius: 10px;
  margin-top: 15px;
  font-size: 18px; /* Larger font */
  font-weight: 600;
  text-align: center;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.amount-display svg {
    width: 20px; /* Adjust icon size */
    height: 20px;
    color: white;
}


.success-message {
  background: #e6ffe6; /* Very light green */
  color: #28a745; /* Darker green text */
  padding: 15px; /* More padding */
  border-radius: 10px;
  margin-top: 20px;
  text-align: center;
  font-weight: 600;
  animation: fadeInSlideUp 0.6s ease-out forwards; /* New animation */
  border: 1px solid #d4edda; /* Green border */
  display: flex; /* For icon alignment */
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}
.success-message svg {
    width: 20px; /* Adjust icon size */
    height: 20px;
    color: #28a745;
}


@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-message {
  background: #ffe6e6; /* Very light red */
  color: #dc3545; /* Darker red text */
  padding: 15px;
  border-radius: 10px;
  margin-top: 20px;
  text-align: center;
  font-weight: 600;
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; /* More natural shake */
  border: 1px solid #f5c6cb; /* Red border */
  display: flex; /* For icon alignment */
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.error-message svg {
    width: 20px; /* Adjust icon size */
    height: 20px;
    color: #dc3545;
}


@keyframes shake {
  10%, 90% { transform: translateX(-5px); }
  20%, 80% { transform: translateX(10px); }
  30%, 50%, 70% { transform: translateX(-10px); }
  40%, 60% { transform: translateX(10px); }
}

.new-qr-btn {
  background: #2ecc71; /* Brighter green */
  margin-top: 20px;
}
.new-qr-btn svg {
    color: white;
}


.new-qr-btn:hover {
  box-shadow: 0 12px 20px rgba(46, 204, 113, 0.3); /* More pronounced shadow */
  background: #27ae60; /* Slightly darker green on hover */
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9); /* Slightly more opaque */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  border-radius: 16px;
  flex-direction: column;
  gap: 20px; /* More gap */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
  border: 7px solid #f3f3f3; /* Lighter grey */
  border-top: 7px solid #3f51b5; /* Deeper blue */
  border-radius: 50%;
  width: 60px; /* Larger spinner */
  height: 60px; /* Larger spinner */
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite; /* Bouncier spin */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 18px; /* Larger font */
  color: #3f51b5;
  font-weight: 600;
}

/* User ID Display (hidden on public page) */
.user-id-display {
  display: none; /* Hide user ID on public page */
}

/* --- Responsive Adjustments --- */

/* For tablets and larger phones (e.g., up to 768px) */
@media (max-width: 768px) {
    .container {
        padding: 30px;
        margin: 15px; /* Add some margin on larger phones/small tablets */
    }

    .header h1 {
        font-size: 28px;
    }
    .header h1 svg, .header h1 .material-icons {
        width: 28px;
        height: 28px;
        font-size: 28px;
    }

    .header p {
        font-size: 15px;
    }

    .person-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Adjust min-width for grid cards */
        gap: 15px;
    }

    .person-card {
        padding: 20px;
    }

    .person-avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
        margin-bottom: 12px;
    }
    .person-avatar svg, .person-avatar .material-icons {
        width: 55%;
        height: 55%;
        font-size: 32px;
    }

    .person-fullName {
        font-size: 17px;
    }

    .person-shortName {
        font-size: 14px;
    }

    .person-phone {
        font-size: 13px;
    }

    .form-control {
        padding: 12px 15px;
        font-size: 15px;
    }

    .btn {
        padding: 14px;
        font-size: 16px;
    }
    .btn svg, .btn .fa {
        width: 18px;
        height: 18px;
        font-size: 18px;
    }

    .qr-container {
        padding: 20px;
    }

    .merchant-info h3 {
        font-size: 18px;
    }
    .merchant-info h3 svg {
        width: 20px;
        height: 20px;
    }

    .merchant-info p, .amount-display {
        font-size: 15px;
    }
    .merchant-info p svg, .merchant-info p .material-icons, .amount-display svg {
        width: 16px;
        height: 16px;
        font-size: 16px;
    }

    .success-message, .error-message {
        padding: 12px;
        font-size: 14px;
    }
    .success-message svg, .error-message svg {
        width: 18px;
        height: 18px;
    }
}


/* For small mobile devices (e.g., up to 480px) */
@media (max-width: 480px) {
  body {
    padding: 10px; /* Reduce overall body padding */
  }

  .container {
    margin: 10px; /* Smaller margin */
    padding: 25px 20px; /* Adjusted padding for smaller screens */
    border-radius: 12px; /* Slightly smaller border-radius */
  }
  
  .header {
    margin-bottom: 20px; /* Reduce header margin */
  }

  .header h1 {
    font-size: 24px; /* Smaller header font */
    gap: 8px;
  }
  .header h1 svg, .header h1 .material-icons {
    width: 24px;
    height: 24px;
    font-size: 24px;
  }
  
  .header p {
    font-size: 14px;
  }

  .admin-controls {
      top: 10px; /* Move slightly closer to the top */
      right: 10px; /* Move slightly closer to the right */
  }
  .admin-controls button {
      font-size: 12px; /* Smaller font for admin button */
      padding: 5px 10px; /* Smaller padding */
      gap: 4px;
      border-radius: 6px;
  }
  .admin-controls button svg {
    width: 12px;
    height: 12px;
  }

  .person-selection .header {
    margin-top: 40px; /* Adjust for admin button */
  }

  .search-container {
      flex-direction: column; /* Stack search input and button */
      gap: 15px; /* More space between stacked items */
      margin-bottom: 20px;
  }

  .search-container .form-control {
      padding: 10px 12px; /* Smaller padding for search input */
      font-size: 14px;
  }

  .search-container .search-button {
      width: 100%; /* Make search button full width */
      padding: 10px; /* Smaller padding */
  }

  .person-grid {
    grid-template-columns: 1fr; /* Single column on very small screens */
    gap: 15px;
  }
  
  .person-card {
    padding: 15px; /* Smaller padding for cards */
  }
  
  .person-avatar {
    width: 70px; /* Smaller avatar */
    height: 70px;
    font-size: 28px;
    margin-bottom: 10px;
  }
  .person-avatar svg, .person-avatar .material-icons {
    width: 50%;
    height: 50%;
    font-size: 28px;
  }

  .person-fullName {
      font-size: 16px;
      margin-bottom: 4px;
  }

  .person-shortName {
      font-size: 13px;
      margin-bottom: 6px;
  }

  .person-phone {
      font-size: 12px;
  }

  .back-button {
      padding: 8px 15px;
      font-size: 13px;
      margin-bottom: 15px;
      border-radius: 8px;
  }
  .back-button .material-icons {
      font-size: 18px;
  }

  .selected-person {
      padding: 15px;
      margin-bottom: 20px;
      border-radius: 10px;
  }
  .selected-person .person-avatar {
      width: 70px;
      height: 70px;
      font-size: 28px;
  }
  .selected-person .person-avatar svg, .selected-person .person-avatar .material-icons {
    width: 50%;
    height: 50%;
    font-size: 28px;
  }

  .form-group {
      margin-bottom: 18px;
  }

  .form-group label {
      font-size: 14px;
      margin-bottom: 6px;
  }
  .form-group label svg, .form-group label .material-icons {
      width: 16px;
      height: 16px;
      font-size: 16px;
  }

  .form-control {
      padding: 10px 12px;
      font-size: 14px;
      border-radius: 8px;
  }

  .btn {
      font-size: 15px;
      padding: 12px;
      margin-top: 10px;
      border-radius: 8px;
  }
  .btn svg, .btn .fa {
      width: 18px;
      height: 18px;
      font-size: 18px;
  }

  .qr-container {
    padding: 15px;
    margin-top: 20px;
    border-radius: 10px;
  }

  #qrcode canvas {
      max-width: 90%; /* Further restrict QR code size */
      margin: 0 auto; /* Center the canvas */
  }

  .merchant-info {
      padding: 15px;
      border-radius: 8px;
      margin-top: 10px;
  }

  .merchant-info h3 {
      font-size: 16px;
      margin-bottom: 6px;
  }
  .merchant-info h3 svg {
      width: 18px;
      height: 18px;
  }

  .merchant-info p {
      font-size: 13px;
      gap: 6px;
  }
  .merchant-info p svg, .merchant-info p .material-icons {
      width: 14px;
      height: 14px;
      font-size: 14px;
  }

  .amount-display {
      padding: 12px;
      font-size: 14px;
      border-radius: 8px;
      margin-top: 10px;
  }
  .amount-display svg {
      width: 16px;
      height: 16px;
  }

  .success-message, .error-message {
    flex-direction: column; /* Stack text and icon on small screens */
    font-size: 13px;
    padding: 10px;
    margin-top: 15px;
    border-radius: 8px;
  }
  .success-message svg, .error-message svg {
      width: 16px;
      height: 16px;
      margin-bottom: 5px; /* Add space between icon and text when stacked */
  }

  .new-qr-btn {
      margin-top: 15px;
  }

  .loading-text {
      font-size: 16px;
  }
  .spinner {
      width: 50px;
      height: 50px;
      border-width: 6px;
  }
}

/* Hide number input spin buttons for WebKit browsers (Chrome, Safari) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -webkit-touch-callout: none; /* Disable callout */
    -webkit-appearance: none; /* Remove default iOS input styling */
    appearance: none;
}



/* QR Result Screen */
.qr-container {
  /* สไตล์สำหรับคอนเทนเนอร์หลักของ QR Code */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #ffffff; /* สีพื้นหลังของคอนเทนเนอร์ */
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-width: 400px; /* กำหนดความกว้างสูงสุด */
  margin: 40px auto; /* จัดกึ่งกลางหน้าจอ */
}

#qrcode {
  margin-bottom: 10px; /* ระยะห่างด้านล่างจาก QR Code */
  display: inline-block; /* ทำให้สามารถจัดกึ่งกลาง canvas ได้ */
}

/* นี่คือส่วนสำคัญสำหรับการทำให้เส้นกรอบ "ออกมาจาก" QR Code */
#qrcode canvas {

  /* เพิ่ม padding เพื่อให้มีช่องว่างระหว่าง QR Code กับเส้นกรอบ */
  padding: 20px; /* ตัวอย่าง: เพิ่มช่องว่าง 10px รอบ QR Code */

  /* เส้นกรอบ: ความหนา 2px, รูปแบบ solid (เส้นทึบ), สีดำ */
  border: 2px solid rgb(221, 218, 218);
  border-radius: 1rem;

  /* เงา (ถ้ายังต้องการให้มี) */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);

  /* การปรับขนาดพื้นฐาน */
  max-width: 100%; /* ตรวจสอบให้แน่ใจว่า QR Code ตอบสนองต่อขนาดหน้าจอ */
  height: auto; /* รักษาสัดส่วนของภาพ */
}

/* สไตล์สำหรับข้อความด้านล่าง QR Code (ถ้ามี) */
.qr-text {
  font-size: 1.1em;
  color: #333;
  text-align: center;
  margin-top: 10px;
}