:root {
  --primary: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.4);
  --secondary: #0ea5e9;
  --bg-deep: #020617;
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Montserrat', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  /* Prevent horizontal scroll */
  width: 100%;
  position: relative;
  line-height: 1.6;
}

/* Animated Mesh Background */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background:
    radial-gradient(circle at 0% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(2, 6, 23, 1) 0%, rgba(2, 6, 23, 1) 100%);
}

.bg-mesh::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  margin: 1rem;
  z-index: 1;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: clamp(1.5rem, 5vw, 3rem);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.8s ease-out;
}

header {
  text-align: left;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 8vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-dim);
  font-size: clamp(0.875rem, 3vw, 1rem);
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 0.5rem;
    margin: 0;
    width: 100%;
    /* Ensure no extra width triggers scroll */
    max-width: 100vw;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .glass-card {
    padding: 1rem;
    /* Reduced from 1.5rem */
    border-radius: 20px;
    width: 100%;
    border-left: none;
    border-right: none;
    border-radius: 0;
    /* Full width on very small screens */
  }

  header {
    margin-bottom: 1.5rem;
  }
}

@media (min-width: 400px) and (max-width: 640px) {

  /* Slightly loose for larger mobiles */
  .glass-card {
    border-radius: 20px;
    border: 1px solid var(--glass-border);
  }
}

.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.input-group.full-width {
  grid-column: span 2;
}

.input-group.full-width {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .input-group.full-width {
    grid-column: span 1;
  }

  .input-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .input-row select,
  .input-row input {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  /* Improve Header Wrapping */
  h1 {
    font-size: 1.5rem !important;
    /* Slightly smaller to fit "ลงทะเบียนสมาชิก" */
    line-height: 1.3 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* word-break: keep-all; Removed to allow breaking if necessary */
  }

  header h1 {
    font-size: 1.5rem !important;
  }
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: var(--transition);
  padding-left: 0.25rem;
}

.required {
  color: #ef4444;
  margin-left: 2px;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.875rem 1rem;
  color: #fff;
  font-family: var(--font-main);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

select option {
  background: #0f172a;
  color: #fff;
}

/* Checkbox Group Styling */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.checkbox-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  transform: translateX(4px);
}

.checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--glass-border);
  border-radius: 6px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.checkbox-item input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.checkbox-item input[type="checkbox"]:checked::after {
  content: '\2714';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-item input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.checkbox-label {
  color: var(--text-main);
  font-size: 0.95rem;
  user-select: none;
  flex: 1;
}

.submit-btn {
  width: 100%;
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
  position: relative;
  overflow: hidden;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* Ensure long modals start from top */
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Prevent blocking clicks when hidden */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  /* Enable scrolling */
  padding: 2rem 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 2.5rem;
  text-align: left;
  /* Changed from center for better readabilty in detail */
  max-width: 480px;
  width: 100%;
  transform: translateY(20px) scale(0.95);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  margin: auto;
  /* Required for centering in a scrollable flex parent */
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    border-radius: 20px;
  }
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
}

/* Navigation Tabs and Section Handling */
.tab-content {
  display: none !important;
}

.tab-content.active {
  display: block !important;
  animation: fadeInSlideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* --- Hiso Parent UI Refinement --- */

.hiso-tabs {
  display: flex;
  justify-content: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 20px;
  margin: 0 auto 3rem auto;
  max-width: 500px;
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.hiso-tab {
  flex: 1;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-main);
  font-weight: 700;
  cursor: pointer;
  border-radius: 15px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.hiso-tab span {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.hiso-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.hiso-tab:hover span {
  transform: translateY(-2px);
}

.hiso-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 10px 20px -5px var(--primary-glow),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

@media (max-width: 600px) {
  .hiso-tabs {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }

  .hiso-tab {
    padding: 12px 15px;
    font-size: 0.9rem;
    width: 100%;
  }
}

/* Track Status Section */
.track-container {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}

.track-search-box {
  display: flex;
  flex-direction: column;
  /* Stack input and button */
  align-items: center;
  /* Center the button */
  gap: 15px;
  margin-top: 2rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s ease;
}

@media (max-width: 480px) {
  .track-search-box {
    flex-direction: column;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .track-search-box input {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 10px;
    width: 100%;
  }

  .track-search-box .track-btn {
    width: 100%;
    padding: 15px;
    border-radius: 16px;
  }
}

.track-search-box:focus-within {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.track-search-box input {
  width: 100%;
  /* Full width input */
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  /* Underline style for cleaner look in column */
  color: #fff;
  padding: 10px;
  font-family: var(--font-main);
  outline: none;
  font-size: clamp(0.95rem, 4vw, 1.15rem);
  font-weight: 500;
  text-align: center;
  /* Center text input too for symmetry */
}



.track-search-box input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.track-btn {
  background: linear-gradient(135deg, var(--secondary) 0%, #0284c7 100%);
  color: white;
  border: none;
  padding: 12px 45px;
  /* Larger clickable area */
  border-radius: 100px;
  /* Pill shape */
  font-weight: 700;
  cursor: pointer;
  width: auto;
  /* Allow centering */
  min-width: 150px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.track-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

.track-result-area {
  margin-top: 1rem;
}

/* Track Result Card */
.track-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  animation: fadeInSlideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.track-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--status-color, var(--primary));
}

.track-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.track-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--status-bg);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.track-request-id {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.track-update-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
}

.track-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  background: rgba(255, 255, 255, 0.02);
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.track-item-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.track-item-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.track-empty {
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--glass-border);
  border-radius: 24px;
}

.track-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.track-empty-text {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 300px;
  margin: 0 auto;
}

@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--secondary) 0%, #06b6d4 100%);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: #fff;
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
}

.info-modal h2 {
  color: var(--secondary);
}

.footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* Summary Receipt Styles */
.summary-modal {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.summary-receipt {
  text-align: left;
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

.receipt-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.receipt-section:last-of-type {
  border-bottom: none;
}

.highlight-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  margin-bottom: 1rem;
}

.section-lheader .subtitle {
  color: var(--text-dim);
  font-size: 1.125rem;
  margin-top: 0.5rem;
}

.contact-info {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-info p {
  color: var(--secondary);
  font-size: 0.875rem;
  margin: 0;
}

.section-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.request-number {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.05em;
}

.section-value {
  color: var(--text-main);
  font-size: 0.9rem;
  margin: 0;
}

.section-title {
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 480px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.info-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-value {
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  display: grid;
  gap: 0.4rem;
}

.doc-list li {
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-size: 0.85rem;
}

.reason-text {
  color: var(--text-main);
  line-height: 1.5;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.instructions-box {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid var(--secondary);
  border-radius: 12px;
  padding: 0.75rem;
}

.instructions-box .section-title {
  border-bottom-color: var(--secondary);
  color: var(--secondary);
}

.instructions-list {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
  color: var(--text-main);
  line-height: 1.6;
  font-size: 0.85rem;
}

.instructions-list li {
  margin-bottom: 0.4rem;
}

.instructions-list strong {
  color: var(--primary);
}

.receipt-footer {
  text-align: center;
  padding-top: 0.75rem;
  margin-top: 1rem;
  border-top: 2px solid var(--primary);
  color: var(--text-dim);
}

.receipt-footer p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
}

.footer-contact {
  color: var(--secondary) !important;
  font-size: 0.75rem !important;
  margin: 0.5rem 0 !important;
}

.footer-date {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}


/* Action Buttons */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

@media (max-width: 640px) {
  .action-buttons {
    grid-template-columns: 1fr;
  }
}

.action-btn {
  padding: 0.875rem 1rem;
  border-radius: 10px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.action-btn span {
  font-size: 1.25rem;
}

.pdf-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.pdf-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

.image-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
}

.image-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
}

.email-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

.email-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.action-btn:active {
  transform: translateY(0);
}


@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hiso Modal Styles */
.hiso-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  /* Changed from flex-start to center for better initial alignment */
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Prevent blocking */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 1rem;
  /* Reduced padding */
}

.hiso-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hiso-modal-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  transform: translateY(20px) scale(0.95);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  /* Removal of overflow: hidden to ensure components like textareas/inputs or shadow work better */
  margin: auto;
}

.hiso-modal-overlay.active .hiso-modal-card {
  transform: translateY(0) scale(1);
}

.hiso-modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.hiso-modal-card.success::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.hiso-modal-card.error::before {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.hiso-modal-card.warning::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.hiso-modal-card.warning .hiso-modal-icon {
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5));
}

.hiso-modal-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 15px var(--primary-glow));
  animation: modalPulse 2s infinite ease-in-out;
}

.hiso-modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #fff;
}

.hiso-modal-message {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hiso-modal-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.hiso-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 25px -5px rgba(16, 185, 129, 0.4);
}

@keyframes modalPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .glass-card {
    padding: 1.25rem !important;
  }

  h1 {
    font-size: 1.5rem !important;
  }

  .subtitle {
    font-size: 0.8rem !important;
  }

  .hiso-tabs {
    flex-direction: column !important;
  }

  .checkbox-label {
    white-space: normal !important;
    word-break: break-word !important;
  }

  .track-search-box input {
    font-size: 0.9rem !important;
    padding: 12px 15px !important;
  }

  .track-search-box .track-btn {
    padding: 10px 15px !important;
    font-size: 0.9rem !important;
  }
}

/* Generated Image Preview */
#imagePreviewContainer img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* --- Authentication Pages (Login/Register) --- */
.auth-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  padding: 2.5rem;
  width: 100%;
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.auth-register-promo {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.promo-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.register-btn-hiso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--secondary);
  border-radius: 16px;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.register-btn-hiso::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(14, 165, 233, 0) 100%);
  opacity: 0;
  transition: var(--transition);
}

.register-btn-hiso:hover {
  transform: translateY(-3px);
  background: rgba(14, 165, 233, 0.1);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
}

.register-btn-hiso:hover::before {
  opacity: 1;
}

.register-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--secondary), #0ea5e9);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.register-content {
  text-align: left;
  flex: 1;
}

.register-title {
  display: block;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
}

.register-desc {
  display: block;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.register-arrow {
  color: var(--secondary);
  font-size: 1.2rem;
  font-weight: 700;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.register-btn-hiso:hover .register-arrow {
  transform: translateX(4px);
  color: #38bdf8;
}

@media (max-width: 480px) {
  .register-btn-hiso {
    padding: 0.875rem;
  }
}

.separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

.separator::before,
.separator::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.separator::before {
  margin-right: .5em;
}

.separator::after {
  margin-left: .5em;
}

/* Dynamic Student List */
.student-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.student-item {
  position: relative;
  animation: fadeInSlideUp 0.3s ease;
}

.remove-student-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
  z-index: 10;
}

.remove-student-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

.student-item input {
  padding-right: 3rem;
  /* Space for remove button */
}

.add-student-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--glass-border);
  color: var(--text-dim);
  width: 100%;
  padding: 0.875rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
}

/* --- Premium User Profile Pill --- */
.hiso-user-menu {
  display: flex;
  align-items: center;
  gap: 24px;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 16px 6px 8px;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.profile-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.15);
}

.profile-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transform: translateX(-100%);
  transition: 0.5s;
}

.profile-pill:hover::before {
  transform: translateX(100%);
}

.avatar-glow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.avatar-glow.has-image {
  background: transparent;
  padding: 0;
  border: 2px solid var(--primary);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.hiso-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 8px;
  box-shadow: 0 0 10px var(--primary);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.view-profile-text {
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.8;
}

.logout-mini-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-mini-btn:hover {
  background: #ef4444;
  color: white;
  transform: rotate(90deg);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* ===== Premium Countdown Styles (Shared) ===== */
.countdown-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  /* More modern than 12px */
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 110px;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.countdown-icon {
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hourglassRotate 2.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes hourglassRotate {
  0% {
    transform: rotate(0deg);
  }

  40% {
    transform: rotate(180deg);
  }

  50% {
    transform: rotate(180deg);
  }

  90% {
    transform: rotate(360deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.countdown-text {
  letter-spacing: 0.02em;
}

/* States */
.countdown-active {
  background: rgba(14, 165, 233, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.2);
  box-shadow: 0 4px 15px -5px rgba(14, 165, 233, 0.3);
}

.countdown-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
  box-shadow: 0 4px 15px -5px rgba(245, 158, 11, 0.3);
}

.countdown-overtime {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: overtimePulse 2s infinite;
}

@keyframes overtimePulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
  }

  50% {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
  }
}

.countdown-completed {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.countdown-completed .countdown-icon {
  animation: none;
}

@media (max-width: 640px) {
  .countdown-container {
    padding: 5px 12px;
    font-size: 0.8rem;
    min-width: 90px;
  }
}

/* =========================================
   Multilingual Form Fields - Parent & Student
   ========================================= */

/* Separator heading */
.separator {
  text-align: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 2rem 0 1.25rem 0;
  position: relative;
}

.separator::before,
.separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 25%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--glass-border));
}

.separator::before {
  left: 0;
}

.separator::after {
  right: 0;
  background: linear-gradient(to left, transparent, var(--glass-border));
}

/* Hint text for "ตามบัตรประชาชน" */
.hint-text {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  opacity: 0.8;
  margin-left: 0.25rem;
}

/* Multilang group container */
.multilang-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Arabic field group */
.arabic-group {
  background: rgba(251, 191, 36, 0.02);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.15);
}

.arabic-option-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.arabic-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.arabic-select:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.arabic-input {
  direction: rtl;
  text-align: right;
  font-family: 'Noto Sans Arabic', 'Arabic Typesetting', 'Tahoma', sans-serif;
  font-size: 1.1rem;
  transition: opacity 0.3s ease;
}

.arabic-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Student Card Styles */
.student-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.student-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  transition: all 0.3s ease;
}

.student-item-card:hover {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.student-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.student-number {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
}

.student-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.student-arabic-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(251, 191, 36, 0.02);
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.1);
}

.arabic-select-small {
  flex: 0 0 auto;
  width: auto;
  min-width: 140px;
  padding: 0.625rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  cursor: pointer;
}

.arabic-input-small {
  flex: 1;
  direction: rtl;
  text-align: right;
  font-family: 'Noto Sans Arabic', 'Tahoma', sans-serif;
  padding: 0.625rem 0.75rem;
  transition: opacity 0.3s ease;
}

.arabic-input-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Remove student button */
.remove-student-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-student-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.02);
}

/* Add student button */
.add-student-btn {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-student-btn:hover {
  background: rgba(16, 185, 129, 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

/* Legacy student-item support (backward compatibility) */
.student-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  position: relative;
}

.student-item input {
  width: 100%;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .student-arabic-row {
    flex-direction: column;
  }

  .arabic-select-small {
    width: 100%;
    min-width: auto;
  }

  .separator::before,
  .separator::after {
    width: 15%;
  }
}

/* Hiso Link Styling */
.hiso-link {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  padding: 0 4px;
}

.hiso-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.hiso-link:hover {
  text-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.hiso-link:hover::after {
  width: 100%;
}

/* =========================================
   Glassmorphism Register Button (Hiso)
   ========================================= */
.auth-register-promo {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.promo-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.register-btn-hiso {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;

  /* Glassmorphism Core */
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* Faint border */
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  /* Top light highlight */
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  /* Bottom shadow for depth */

  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 0 20px rgba(255, 255, 255, 0.02);
  /* Inner subtle glow */

  padding: 1rem 1.25rem;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  /* Bouncy spring */
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Shine Effect */
.register-btn-hiso::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.1),
      transparent);
  transform: skewX(-20deg);
  transition: 0.5s;
}

.register-btn-hiso:hover::after {
  left: 120%;
  transition: 0.7s ease-in-out;
}

.register-btn-hiso:hover {
  transform: translateY(-4px) scale(1.02);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 10px 10px -5px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.register-btn-hiso:active {
  transform: translateY(-1px) scale(0.98);
}

.register-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.register-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.register-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.register-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  transition: color 0.3s ease;
}

.register-btn-hiso:hover .register-desc {
  color: rgba(255, 255, 255, 0.9);
}

.register-arrow {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.register-btn-hiso:hover .register-arrow {
  background: var(--primary);
  color: #fff;
  transform: translateX(4px) rotate(-45deg);
  box-shadow: 0 0 15px var(--primary-glow);
  border-color: transparent;
}

/* =========================================
   Mobile Optimization Logic & Form Layouts
   ========================================= */

/* Auth Container */
.auth-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  z-index: 2;
}

/* Ensure Auth Card Fits */
.auth-card {
  width: 100%;
  max-width: 100%;
}

/* Form Row (Flex wrapper for Title + Name) */
.form-row {
  display: flex;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  z-index: 2;
}

/* Ensure Auth Card Fits */
.auth-card {
  width: 100%;
  max-width: 100%;
}

/* Form Row (Flex wrapper for Title + Name) */
.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
}

/* Responsive Rules for Mobile */
@media (max-width: 480px) {
  .auth-container {
    padding: 0.75rem;
  }

  .glass-card.auth-card {
    padding: 1.5rem;
    border-radius: 20px;
  }

  /* On very small screens, ensure inputs maximize space */
  .form-row input {
    width: 100%;
    min-width: 0;
    /* Prevent flex overflow */
  }

  .form-row select {
    cursor: not-allowed;
    opacity: 0.6;
  }

  /* Mobile-specific button improvements */
  @media (max-width: 768px) {
    .submit-btn {
      min-height: 56px;
      /* Larger touch target */
      font-size: 1rem;
      padding: 1rem 1.5rem;
      margin-top: 1.5rem;
      -webkit-appearance: none;
      appearance: none;
      border: none;
      outline: none;
    }

    /* Ensure form elements don't block button */
    .form-grid {
      position: relative;
    }

    /* Fix any overflow issues */
    .glass-card {
      overflow: visible;
    }

    /* Improve touch targets for all interactive elements */
    .checkbox-item {
      min-height: 48px;
      -webkit-tap-highlight-color: transparent;
    }

    .hiso-tab {
      min-height: 48px;
      -webkit-tap-highlight-color: transparent;
    }
  }

  /* =========================================
   Enhanced Mobile Viewport & Layout Fixes
   ========================================= */

  /* Prevent horizontal scroll */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  @media (max-width: 480px) {

    /* Main container adjustments */
    main.container {
      padding: 0 !important;
      margin: 0 !important;
      width: 100% !important;
      max-width: 100vw !important;
    }

    /* Glass card full width on small screens */
    .glass-card {
      margin: 0 !important;
      width: 100% !important;
      max-width: 100% !important;
      border-radius: 0 !important;
      padding: 1rem !important;
    }

    /* Header section spacing */
    header {
      padding-right: 100px;
      /* Space for auth button */
    }

    /* Auth section positioning */
    #authSection {
      top: 0.75rem !important;
      right: 0.75rem !important;
    }

    /* Profile pill compact on mobile */
    .profile-pill {
      padding: 4px 10px 4px 4px !important;
      gap: 8px !important;
    }

    .avatar-glow {
      width: 28px !important;
      height: 28px !important;
      font-size: 0.75rem !important;
    }

    .user-name {
      font-size: 0.75rem !important;
      max-width: 80px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .logout-mini-btn {
      width: 32px !important;
      height: 32px !important;
    }

    /* Hiso user menu compact layout */
    .hiso-user-menu {
      gap: 10px !important;
    }

    /* Form input improvements */
    .input-group {
      margin-bottom: 0.75rem;
    }

    label {
      font-size: 0.8rem;
    }

    input,
    select,
    textarea {
      font-size: 16px !important;
      /* Prevent iOS zoom on focus */
      padding: 0.75rem !important;
    }

    /* Checkbox text wrap */
    .checkbox-label {
      font-size: 0.85rem !important;
      line-height: 1.4 !important;
    }

    /* Submit button full width */
    .submit-btn {
      width: 100% !important;
      margin-left: 0 !important;
      margin-right: 0 !important;
    }

    /* Track section improvements */
    .track-card {
      padding: 1.25rem !important;
      border-radius: 16px !important;
    }

    .track-card-header {
      flex-direction: column !important;
      gap: 1rem !important;
    }

    .track-request-id {
      font-size: 1.35rem !important;
    }

    .track-grid {
      grid-template-columns: 1fr !important;
      gap: 15px !important;
      padding: 1rem !important;
    }

    .track-item[style*="grid-column: span 2"] {
      grid-column: span 1 !important;
    }

    /* Modal improvements */
    .modal-content {
      margin: 0.5rem !important;
      max-height: calc(100vh - 1rem) !important;
      border-radius: 20px !important;
    }

    .summary-modal {
      max-width: calc(100vw - 1rem) !important;
    }

    /* Hiso modal compact */
    .hiso-modal-card {
      padding: 1.5rem !important;
      margin: 0.5rem !important;
      max-width: calc(100vw - 1rem) !important;
    }

    .hiso-modal-icon {
      font-size: 2.5rem !important;
      margin-bottom: 1rem !important;
    }

    .hiso-modal-title {
      font-size: 1.2rem !important;
    }

    .hiso-modal-message {
      font-size: 0.9rem !important;
      margin-bottom: 1.5rem !important;
    }
  }

  /* Extra small screens (< 360px) */
  @media (max-width: 360px) {
    .glass-card {
      padding: 0.75rem !important;
    }

    h1 {
      font-size: 1.25rem !important;
    }

    .subtitle {
      font-size: 0.75rem !important;
    }

    .hiso-tab {
      padding: 10px !important;
      font-size: 0.8rem !important;
    }

    .submit-btn {
      font-size: 0.95rem !important;
      padding: 0.875rem !important;
    }

    .checkbox-label {
      font-size: 0.8rem !important;
    }
  }

  /* =========================================
   Action Button Mobile Fixes  
   ========================================= */

  @media (max-width: 480px) {
    .action-buttons {
      gap: 0.5rem !important;
    }

    .action-btn {
      padding: 0.75rem !important;
      font-size: 0.85rem !important;
      min-height: 48px;
    }

    /* Receipt section mobile */
    .summary-receipt {
      padding: 0.75rem !important;
    }

    .receipt-section {
      padding-bottom: 0.5rem !important;
      margin-bottom: 0.75rem !important;
    }

    .info-grid {
      gap: 0.5rem !important;
    }

    .info-item {
      padding: 0.4rem !important;
    }
  }

  /* Header section spacing */
  header {
    padding-right: 100px;
    /* Space for auth button */
  }

  /* Auth section positioning */
  #authSection {
    top: 0.75rem !important;
    right: 0.75rem !important;
  }

  /* Profile pill compact on mobile */
  .profile-pill {
    padding: 4px 10px 4px 4px !important;
    gap: 8px !important;
  }

  .avatar-glow {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  .user-name {
    font-size: 0.75rem !important;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logout-mini-btn {
    width: 32px !important;
    height: 32px !important;
  }

  /* Hiso user menu compact layout */
  .hiso-user-menu {
    gap: 10px !important;
  }

  /* Form input improvements */
  .input-group {
    margin-bottom: 0.75rem;
  }

  label {
    font-size: 0.8rem;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
    /* Prevent iOS zoom on focus */
    padding: 0.75rem !important;
  }

  /* Checkbox text wrap */
  .checkbox-label {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }

  /* Submit button full width */
  .submit-btn {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Track section improvements */
  .track-card {
    padding: 1.25rem !important;
    border-radius: 16px !important;
  }

  .track-card-header {
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .track-request-id {
    font-size: 1.35rem !important;
  }

  .track-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    padding: 1rem !important;
  }

  .track-item[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }

  /* Modal improvements */
  .modal-content {
    margin: 0.5rem !important;
    max-height: calc(100vh - 1rem) !important;
    border-radius: 20px !important;
  }

  .summary-modal {
    max-width: calc(100vw - 1rem) !important;
  }

  /* Hiso modal compact */
  .hiso-modal-card {
    padding: 1.5rem !important;
    margin: 0.5rem !important;
    max-width: calc(100vw - 1rem) !important;
  }

  .hiso-modal-icon {
    font-size: 2.5rem !important;
    margin-bottom: 1rem !important;
  }

  .hiso-modal-title {
    font-size: 1.2rem !important;
  }

  .hiso-modal-message {
    font-size: 0.9rem !important;
    margin-bottom: 1.5rem !important;
  }
}

/* Extra small screens (< 360px) */
@media (max-width: 360px) {
  .glass-card {
    padding: 0.75rem !important;
  }

  h1 {
    font-size: 1.25rem !important;
  }

  .subtitle {
    font-size: 0.75rem !important;
  }

  .hiso-tab {
    padding: 10px !important;
    font-size: 0.8rem !important;
  }

  .submit-btn {
    font-size: 0.95rem !important;
    padding: 0.875rem !important;
  }

  .checkbox-label {
    font-size: 0.8rem !important;
  }
}

/* =========================================
   Action Button Mobile Fixes  
   ========================================= */

@media (max-width: 480px) {
  .action-buttons {
    gap: 0.5rem !important;
  }

  .action-btn {
    padding: 0.75rem !important;
    font-size: 0.85rem !important;
    min-height: 48px;
  }

  /* Receipt section mobile */
  .summary-receipt {
    padding: 0.75rem !important;
  }

  .receipt-section {
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.75rem !important;
  }

  .info-grid {
    gap: 0.5rem !important;
  }

  .info-item {
    padding: 0.4rem !important;
  }

  .doc-list li {
    font-size: 0.8rem !important;
    padding: 0.3rem 0.5rem !important;
  }

  .instructions-list {
    font-size: 0.8rem !important;
  }
}

/* --- History & Tracking Items --- */
.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.history-no {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
}

.history-date {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.history-student {
  color: #fff;
  font-weight: 600;
  font-size: 1.1rem;
}

.history-docs {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-arrow {
  opacity: 0.3;
  transition: var(--transition);
}

.history-item:hover .history-arrow {
  opacity: 1;
  transform: translateX(5px);
}

/* Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pending { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-processing { background: rgba(14, 165, 233, 0.1); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.status-completed { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-picked_up { background: rgba(139, 92, 246, 0.1); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.status-rejected { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Track Result Card */
.track-card {
  background: var(--glass-bg);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.1);
  animation: slideUp 0.4s ease-out;
}

.track-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.track-id {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.track-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 0.95rem;
  gap: 1rem;
}

.track-row span {
  color: var(--text-dim);
  min-width: 80px;
}

.track-row strong {
  text-align: right;
  color: #fff;
}

.track-docs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.track-docs span {
  font-size: 0.85rem;
  color: var(--secondary) !important;
  text-align: right;
}

.track-notes {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border-left: 3px solid var(--primary);
}

.track-notes h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--primary);
}

.track-notes p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-main);
}

.track-notes small {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-dim);
}