* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
}

body {
  margin: 0;
  background: #f5f5f5;
}

/* Hide sections initially */
#dnrRatingSection,
#simpleRatingSection {
  display: none;
}

/* App Bar */
.app-bar {
  background: #1976d2;
  color: #fff;
  padding: 12px 16px;
}

.app-bar h1 {
  margin: 0;
  font-size: 20px;
}

/* Main Page Wrapper */
.page {
  max-width: 900px;
  margin: 16px auto;
  padding: 0 16px 32px;
}

/* Card/Form Container */
.form {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Input Fields */
.field {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 14px;
  margin-bottom: 4px;
}

.field small {
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"] {
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid #bdbdbd;
  outline: none;
  background-color: #ffffff;
  transition: 0.15s;
}

input:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 1px #1976d233;
}

/* Horizontal Row */
.row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap; /* Make responsive */
}

.flex-1 {
  flex: 1;
  min-width: 200px; /* Prevent shrink too small */
}

/* Buttons */
.btn {
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}

.btn.primary {
  background: #1976d2;
  color: #fff;
}

.btn.primary:hover {
  background: #1565c0;
}

.full-width {
  width: 100%;
  margin-top: 16px;
}

.otp-btn {
  height: 42px;
  white-space: nowrap;
}

/* Section Titles */
.section-title {
  font-weight: 600;
  font-size: 14px;
  margin: 12px 0 8px;
}

/* Responsive Table */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.feedback-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px; /* avoid breaking in mobile */
}

.feedback-table th,
.feedback-table td {
  border: 1px solid #bdbdbd;
  padding: 8px;
  vertical-align: middle;
}

.feedback-table th {
  background: #e0e0e0;
  font-weight: 600;
  text-align: center;
}

.feedback-table td:first-child {
  width: 60%;
  text-align: left;
}

/* Rating Cells */
.rate-cell {
  height: 55px;
  cursor: pointer;
}

/* Vertical Rotated Headers */
.rotated {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 4px;
}

/* Selected Styles */
.selected-excellent {
  background-color: #4caf50;
  color: #000;
}

.selected-ok {
  background-color: #ff9800;
  color: #000;
}

.selected-poor {
  background-color: #f44336;
  color: #000;
}

/* Overall Ratings (Chips) */
.overall-rating {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rating-chip {
  flex: 1;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #bdbdbd;
  cursor: pointer;
  text-align: center;
  min-width: 100px;
}

.rating-chip.excellent {
  border-color: #4caf50;
}

.rating-chip.ok {
  border-color: #ff9800;
}

.rating-chip.poor {
  border-color: #f44336;
}

.rating-chip.selected.excellent {
  background: #4caf50;
  color: #fff;
}

.rating-chip.selected.ok {
  background: #ff9800;
  color: #fff;
}

.rating-chip.selected.poor {
  background: #f44336;
  color: #fff;
}

/* QR Wrapper */
.qr-section {
  text-align: center;
  margin-top: 24px;
}

.qr-placeholder {
  width: 160px;
  height: 160px;
  border: 2px dashed #9e9e9e;
  border-radius: 8px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #757575;
}

/* Snackbar */
#snackbar {
  visibility: hidden;
  min-width: 250px;
  background: #323232;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 12px 16px;
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  font-size: 14px;
}

#snackbar.show {
  visibility: visible;
  animation: fadein 0.3s, fadeout 0.3s 2.7s;
}

@keyframes fadein {
  from {
    opacity: 0;
    bottom: 0;
  }
  to {
    opacity: 1;
    bottom: 24px;
  }
}

@keyframes fadeout {
  from {
    opacity: 1;
    bottom: 24px;
  }
  to {
    opacity: 0;
    bottom: 0;
  }
}

/* =============================
   MOBILE RESPONSIVE OPTIMIZATION
   ============================= */

@media (max-width: 600px) {
  .app-bar h1 {
    font-size: 18px;
  }

  .page {
    padding: 0 12px 24px;
  }

  .form {
    padding: 12px;
  }

  input,
  .btn,
  .rating-chip {
    font-size: 13px;
  }

  .qr-placeholder {
    width: 140px;
    height: 140px;
  }

  .rate-cell {
    height: 45px;
  }
}
/* =================================================
   SUPER RESPONSIVE MODE  (For 100% mobile perfect)
   ================================================= */
@media (max-width: 768px) {
  
  /* FORCEROWS TO STACK */
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  /* ALL FIELDS FULL WIDTH */
  .flex-1 {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 100% !important;
  }

  /* INPUTS FULL WIDTH */
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="number"],
  input[type="date"] {
    width: 100% !important;
  }

  /* BUTTONS FULL WIDTH */
  .btn,
  .full-width {
    width: 100% !important;
  }

  /* GIVE SMALLER PADDING */
  .page {
    padding: 0 10px 20px;
  }
  
  .form {
    padding: 12px;
  }

  /* TABLE -> SCROLL SMOOTH ON SMALL SCREENS */
  .table-wrapper {
    overflow-x: auto;
  }

  .feedback-table {
    min-width: 650px;
  }
  
  /* CHIPS RESPONSIVE */
  .overall-rating {
    flex-direction: column;
  }

  .rating-chip {
    width: 100%;
  }

  /* QR Size */
  .qr-placeholder {
    width: 130px;
    height: 130px;
  }
}

/* Very small screens (<=480px) */
@media (max-width: 480px) {

  .app-bar h1 {
    font-size: 16px;
  }

  .rating-chip {
    padding: 8px;
    font-size: 12px;
  }

  .rate-cell {
    height: 40px;
  }
}
/* FORCE ROW STACK ON SMALL DEVICES */
@media (max-width: 900px) {
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .flex-1 {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 100% !important;
  }
  input,
  .btn,
  .rating-chip {
    width: 100% !important;
  }
  .overall-rating {
    flex-direction: column;
  }
  .rating-chip {
    margin-bottom: 8px;
  }
}

/* TABLE RESPONSIVE SCROLL */
@media (max-width: 768px) {
  .table-wrapper {
    overflow-x: auto;
  }
  .feedback-table {
    min-width: 600px;
  }
  .feedback-table th,
  .feedback-table td {
    padding: 6px;
    font-size: 12px;
  }
  .rotated {
    padding: 2px;
  }
}

/* QR SCALING */
@media (max-width: 600px) {
  .qr-placeholder {
    width: 120px;
    height: 120px;
  }
}

/* SUPER SMALL MOBILE  */
@media (max-width: 480px) {
  .app-bar h1 {
    font-size: 16px;
  }
  input,
  .btn,
  .rating-chip {
    font-size: 12px;
  }
  .feedback-table th,
  .feedback-table td {
    font-size: 11px;
  }
  .rate-cell {
    height: 35px;
  }
  .rating-chip {
    padding: 6px;
  }
/* Popup Modal Styles */
.popup-modal {
  display: none; /* hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5); /* semi-transparent overlay */
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px; /* space for mobile screens */
  box-sizing: border-box;
}

.popup-content {
  background: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  max-width: 350px;
  width: 100%; /* adapt on small screens */
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  font-family: Arial, sans-serif;
}

.popup-content p {
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 500;
  color: #222;
  word-wrap: break-word;
}

.popup-content .btn {
  background-color: #1976d2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.popup-content .btn:hover {
  background-color: #155a9c;
}

/* Responsive adjustments for very small screens */
@media (max-width: 400px) {
  .popup-content {
    padding: 16px 20px;
    max-width: 90%;
  }

  .popup-content p {
    font-size: 15px;
  }

  .popup-content .btn {
    width: 100%;
    padding: 10px 0;
    font-size: 14px;
  }
}
/* Popup Modal Styles */
.popup-modal {
  display: none; /* hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5); /* semi-transparent background */
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: #fff;
  padding: 20px 30px;
  border-radius: 10px;
  text-align: center;
  max-width: 300px;
  width: 80%;
}

#popupCloseBtn {
  padding: 8px 20px;       /* smaller padding */
  font-size: 14px;         /* smaller font */
  min-width: auto;         /* prevent it from stretching */
  margin-top: 15px;
  border-radius: 5px;
  cursor: pointer;
}

}