* {
  box-sizing: border-box;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background-color: #ffffff;
  min-height: 100vh;
  padding-bottom: 60px;
}

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

/* App Bar */
.app-bar {
  background: rgba(255, 255, 255, 0.98);
  color: #1a202c;
  padding: 24px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.app-bar h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(90deg, #3591ed, #51a5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Main Page Wrapper */
.page {
  max-width: 750px;
  margin: 40px auto;
  padding: 0 20px;
  
}

/* Card/Form Container */
.form {
  background: rgba(255, 255, 255, 0.95);
  padding: 48px;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.field label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #2d3748;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field small {
  font-size: 13px;
  color: #718096;
  margin-bottom: 8px;
  font-weight: 500;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"] {
  padding: 16px 20px;
  font-size: 15px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  outline: none;
  background-color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  color: #2d3748;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  width: 100%;
}

input[type="text"]:hover,
input[type="tel"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="date"]:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

textarea {
  padding: 16px 20px;
  font-size: 15px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  outline: none;
  background-color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  color: #2d3748;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  resize: vertical;
  font-family: inherit;
  width: 100%;
}

textarea:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Custom File Upload */
.file-upload-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  top: 0;
  left: 0;
}

.file-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border: 3px dashed #cbd5e0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  font-weight: 600;
  color: #4a5568;
}

.file-upload-label:hover {
  background: linear-gradient(135deg, #e6f2ff 0%, #d6e9ff 100%);
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
}

.file-upload-icon {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Station Autocomplete */
.station-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.suggestion-item {
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid #f7fafc;
  transition: all 0.2s ease;
  color: #4a5568;
}

.suggestion-item:hover {
  background: linear-gradient(135deg, #e6f2ff 0%, #d6e9ff 100%);
  color: #667eea;
  padding-left: 24px;
}

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

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

.flex-1 {
  flex: 1;
  min-width: 200px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 14px;
  padding: 16px 32px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn.primary {
  background: linear-gradient(90deg, #3591ed, #51a5e9);
  color: #fff;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.btn.primary:active {
  transform: translateY(-1px);
}

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

.info-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #667eea;
  background: #fff;
  color: #667eea;
  font-size: 14px;
  font-weight: 700;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pnr-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.pnr-status::before,
.pnr-status::after {
  content: "";
}

.pnr-status.valid::before {
  display: block;
  width: 10px;
  height: 5px;
  border-left: 3px solid #48bb78;
  border-bottom: 3px solid #48bb78;
  transform: rotate(-45deg);
  margin: 6px auto;
}

.pnr-status.invalid::before,
.pnr-status.invalid::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 3px;
  background: #f56565;
}

.pnr-status.invalid::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.pnr-status.invalid::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.icon-valid,
.icon-invalid {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 8px;
}

.icon-valid::before {
  content: "";
  display: block;
  width: 10px;
  height: 5px;
  border-left: 3px solid #48bb78;
  border-bottom: 3px solid #48bb78;
  transform: rotate(-45deg);
  margin: 5px auto;
}

.icon-invalid {
  position: relative;
}

.icon-invalid::before,
.icon-invalid::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 3px;
  background: #f56565;
}

.icon-invalid::before {
  top: 8px;
  left: 3px;
  transform: rotate(45deg);
}

.icon-invalid::after {
  top: 8px;
  left: 3px;
  transform: rotate(-45deg);
}

/* Section Titles */
.section-title {
  font-weight: 700;
  font-size: 18px;
  margin: 20px 0 16px;
  color: #2d3748;
  letter-spacing: -0.3px;
}

/* Responsive Table */
.table-wrapper {
  width: 100%;
  overflow: hidden;              /* instead of overflow-x:auto */
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: #ffffff;           /* same as form background */
}

.feedback-table {
  width: 100%;
  border-collapse: collapse;     /* instead of separate */
  border-spacing: 0;
  font-size: 14px;
  min-width: 0;                  /* remove 600px constraint */
  border-radius: 0;              /* wrapper handles radius */
}

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

.feedback-table th {
  background: linear-gradient(90deg, #3591ed, #51a5e9);
  color: #fff;
  font-weight: 700;
  text-align: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* Rating Cells */
.rate-cell {
  height: 60px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-size: 20px;
}

.rate-cell:hover {
  background: #f7fafc;
  transform: scale(1.05);
}

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

/* Selected Styles */
.selected-excellent {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: #fff;
  font-weight: bold;
}

.selected-ok {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
  color: #fff;
  font-weight: bold;
}

.selected-poor {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: #fff;
  font-weight: bold;
}

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

.rating-chip {
  flex: 1 1 0;          /* each = 1/3 width */
  min-width: 0;
  height: 44px;         /* same height for all */
  padding: 0 16px;      /* horizontal only */
  display: flex;
  align-items: center;  /* vertical center text */
  justify-content: center;
  border-radius: 999px;
}

.rating-chip:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.rating-chip.excellent {
  border-color: #48bb78;
  color: #48bb78;
}

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

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

.rating-chip.selected.excellent {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: #fff;
  border-color: #48bb78;
  box-shadow: 0 8px 24px rgba(72, 187, 120, 0.4);
}

.rating-chip.selected.ok {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
  color: #fff;
  border-color: #ed8936;
  box-shadow: 0 8px 24px rgba(237, 137, 54, 0.4);
}

.rating-chip.selected.poor {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: #fff;
  border-color: #f56565;
  box-shadow: 0 8px 24px rgba(245, 101, 101, 0.4);
}

/* Popup Modal Styles */
.popup-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.popup-content {
  background: #fff;
  padding: 32px 40px;
  border-radius: 20px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popup-content p {
  margin-bottom: 24px;
  font-size: 17px;
  font-weight: 600;
  color: #2d3748;
}

.popup-content .btn {
  min-width: 120px;
}

/* Inline media grid */
#inlineMediaContainer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.inline-media-item {
  position: relative;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.inline-media-item:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.inline-media-item img,
.inline-media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inline-media-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  line-height: 26px;
  text-align: center;
  transition: all 0.2s ease;
}

.inline-media-remove:hover {
  background: #f56565;
  transform: scale(1.1);
}

/* Media preview popup */
#mediaPreviewContainer {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 12px;
}

#mediaPreviewPopup .popup-content {
  max-width: 90%;
  max-height: 90vh;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .app-bar h1 {
    font-size: 22px;
  }

  .page {
    margin: 24px auto;
    padding: 0 16px;
  }

  .form {
    padding: 32px 24px;
    border-radius: 20px;
  }

  .field {
    margin-bottom: 20px;
  }

  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  textarea {
    padding: 14px 16px;
    font-size: 14px;
  }

  .btn {
    padding: 14px 24px;
    font-size: 15px;
  }

  .row {
    flex-direction: column;
  }

  .flex-1 {
    width: 100%;
    min-width: 100%;
  }

  .overall-rating {
    flex-direction: row;
  }

  .rating-chip {
    width: 100%;
  }
  /* stable column widths */
.feedback-table td:first-child,
.feedback-table th:first-child {
  width: 55%;
}

.feedback-table th:nth-child(2),
.feedback-table th:nth-child(3),
.feedback-table th:nth-child(4),
.feedback-table td:nth-child(2),
.feedback-table td:nth-child(3),
.feedback-table td:nth-child(4) {
  width: 15%;
}

/* avoid layout jump on hover */
.rate-cell {
  box-sizing: border-box;
}

.rate-cell:hover {
  background: #f7fafc;
  transform: none;  /* remove scale(1.05) */
}

  
}

@media (max-width: 480px) {
  .app-bar {
    padding: 20px 16px;
  }

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

  .form {
    padding: 24px 20px;
  }

  .field label {
    font-size: 11px;
  }

  .rating-chip {
    padding: 14px 20px;
    font-size: 14px;
  }

  .rate-cell {
    height: 50px;
  }

  #inlineMediaContainer {
    grid-template-columns: repeat(2, 1fr);
  }
}
