:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --primary: #0f3d7a;
  --primary-dark: #072146;
  --primary-light: #eff6ff;
  --accent: #e11d48;
  --gsb-red: #c8102e;
  --teal: #0d9488;
  --emerald: #059669;
  --amber: #d97706;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --radius: 14px;
  --shadow: 0 10px 30px -6px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Clean, Uncluttered Executive Top Header */
.topbar {
  background: linear-gradient(135deg, #072146 0%, #0f3d7a 65%, #1e3a8a 100%);
  color: #fff;
  padding: 12px 24px;
  border-bottom: 3px solid var(--gsb-red);
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: 0 4px 16px rgba(7, 33, 70, 0.2);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gsb-red), #f43f5e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.45);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 0.81rem;
  color: #cbd5e1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-header-cta {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-header-cta:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Searchable Combobox Widget (Used for Language & All Form Dropdowns) */
.scombo {
  position: relative;
  width: 100%;
}

.scombo-lang {
  width: 245px;
}

.scombo-control {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px 2px 11px;
  min-height: 42px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: text;
}

.scombo-lang .scombo-control {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  min-height: 40px;
}

.scombo.open .scombo-control,
.scombo-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 61, 122, 0.14);
}

.scombo-input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  width: 100%;
  padding: 8px 4px !important;
  font-size: 0.88rem !important;
  font-weight: 600;
  color: var(--text) !important;
  background: transparent !important;
  min-width: 0;
}

.scombo-input::placeholder {
  color: #64748b;
  font-weight: 500;
}

.scombo-clear,
.scombo-arrow {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.scombo-clear:hover {
  color: var(--gsb-red);
}

.scombo-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  min-width: 250px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 38px -8px rgba(15, 23, 42, 0.25);
  max-height: 310px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1600;
  display: none;
  padding: 5px;
}

.scombo.open .scombo-menu {
  display: block;
}

.scombo-item {
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scombo-item:hover,
.scombo-item.highlighted {
  background: #eff6ff;
  color: var(--primary);
}

.scombo-item.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.scombo-empty {
  padding: 12px;
  text-align: center;
  font-size: 0.83rem;
  color: #64748b;
}

/* Main Container */
.container {
  max-width: 1440px;
  margin: 14px auto 48px;
  padding: 0 20px;
}

/* Compact Value Proposition & Conversion Trust Bar */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.trust-items {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 0.81rem;
  color: #1e293b;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.country-inline-note {
  font-size: 0.79rem;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 11px;
  border-radius: 999px;
  font-weight: 600;
  max-width: 100%;
}

/* Search & Filter Panel */
.search-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.search-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-tab {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.mode-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(15, 61, 122, 0.2);
}

.search-helper-tip {
  font-size: 0.8rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 13px;
  align-items: end;
}

.mode-field-group {
  display: contents;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
  gap: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  min-height: 42px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 76px;
}

.campus-resolved-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  font-size: 0.86rem;
  font-weight: 600;
  display: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gsb-red), #e11d48);
  color: #fff;
  border: none;
  padding: 11px 18px;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.35);
}

.btn-secondary {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #dbeafe;
}

/* Quick Filter Chips Bar */
.quick-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

.qf-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.qf-chip {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: #334155;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.qf-chip:hover,
.qf-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Selected University / Campus Public Transit Hub Card */
.campus-transit-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 1.5px solid #bae6fd;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px;
  margin-bottom: 18px;
}

.campus-transit-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.campus-transit-header h3 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--primary);
  font-weight: 800;
}

.transit-target-pill {
  background: var(--primary);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.campus-transit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.transit-hub-box {
  background: #fff;
  border: 1px solid #e0f2fe;
  border-radius: 10px;
  padding: 9px 12px;
}

.transit-hub-title {
  font-size: 0.77rem;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 3px;
}

.transit-hub-desc {
  font-size: 0.79rem;
  color: #334155;
  line-height: 1.42;
}

/* Per-Dormitory Transit Mode Badges & Route Summary */
.dist-header-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.transit-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.tbadge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.69rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.tbadge-walk {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.tbadge-marmaray,
.tbadge-rail {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.tbadge-metro {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.tbadge-tram {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

.tbadge-bus {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
}

.tbadge-dolmus {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.transit-route-note {
  margin-top: 5px;
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.38;
  max-width: 280px;
}

.dist-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.btn-transit-dir {
  display: inline-flex;
  align-items: center;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-transit-dir:hover {
  background: #d1fae5;
}

@media (max-width: 960px) {
  .transit-route-note {
    max-width: 100%;
  }
}

/* Dashboard Split: Map + AI Advisor */
.dashboard-split {
  display: grid;
  grid-template-columns: 1fr 410px;
  gap: 16px;
  margin-bottom: 18px;
}

.map-card,
.advisor-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  padding: 16px;
}

#mapContainer {
  width: 100%;
  height: 365px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  z-index: 1;
}

#mapContainer.mobile-collapsed {
  display: none;
}

.btn-mobile-map-toggle {
  display: none;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  justify-content: space-between;
}

.stats-pills-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.stat-pill {
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-pill.state {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.stat-pill.private {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.ai-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Main Comparison Table */
.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header-bar {
  padding: 15px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.table-scroll {
  overflow-x: auto;
}

table.dorm-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table.dorm-table th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 11px 10px;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: normal;
  line-height: 1.28;
  vertical-align: middle;
}

table.dorm-table th:nth-child(1) { width: 15%; }
table.dorm-table th:nth-child(2) { width: 19%; }
table.dorm-table th:nth-child(3) { width: 12%; }
table.dorm-table th:nth-child(4) { width: 13%; }
table.dorm-table th:nth-child(5) { width: 17%; }
table.dorm-table th:nth-child(6) { width: 13%; }
table.dorm-table th:nth-child(7) { width: 11%; }

html[dir="rtl"] table.dorm-table th,
html[dir="rtl"] table.dorm-table td {
  text-align: right;
}

table.dorm-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

table.dorm-table tr.dorm-row:hover {
  background: #f8fafc;
}

.dorm-name-heading {
  font-weight: 800;
  font-size: 0.96rem;
  color: #0f172a;
  margin-bottom: 5px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 4px;
  margin-bottom: 4px;
}

.badge-kyk {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-ozel {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-vakif {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.badge-kiz {
  background: #fce7f3;
  color: #9d174d;
}

.badge-erkek {
  background: #e0f2fe;
  color: #075985;
}

.badge-karma {
  background: #fef3c7;
  color: #92400e;
}

.badge-foreign-yes {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-quota {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.dist-km-big {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--primary);
}

.dist-walk {
  color: var(--emerald);
}

.commute-tag {
  display: inline-block;
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--teal);
  font-weight: 600;
}

.price-main {
  font-weight: 800;
  color: #0f172a;
  font-size: 0.92rem;
}

.btn-apply-row {
  width: 100%;
  white-space: normal;
  line-height: 1.25;
  padding: 9px 8px;
  font-size: 0.81rem;
  text-align: center;
}

/* Sticky Side-by-Side Comparison Bar */
.compare-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 15px 35px rgba(7, 33, 70, 0.45);
  z-index: 1800;
  display: none;
  align-items: center;
  gap: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: center;
}

.compare-bar.active {
  display: flex;
}

/* Guides & GSB Support Grid */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.guide-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.guide-box h4 {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.98rem;
}

.guide-box p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  white-space: pre-line;
}

/* Official & SEO Footer */
.site-footer {
  background: #072146;
  color: #cbd5e1;
  padding: 36px 20px 28px;
  border-top: 4px solid var(--gsb-red);
  margin-top: 48px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.footer-gsb-banner {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}

.footer-gsb-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.footer-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 9px 15px;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.84rem;
  transition: background 0.15s;
}

.footer-pill-link:hover {
  background: rgba(255, 255, 255, 0.22);
}

.footer-pill-link.red {
  background: var(--gsb-red);
  border-color: #f43f5e;
}

.footer-seo-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.footer-col-wide {
  grid-column: span 2;
}

.footer-col h4 {
  color: #fff;
  margin: 0 0 10px;
  font-size: 0.92rem;
}

.footer-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-seo-chip {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: none;
}

.footer-seo-chip:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-close-btn {
  border: none;
  background: #f1f5f9;
  color: #334155;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.apply-summary-box {
  background: #eff6ff;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.modal-form-grid {
  grid-template-columns: 1fr 1fr;
}

.ai-response-box {
  margin-top: 10px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  font-size: 0.84rem;
  max-height: 230px;
  overflow-y: auto;
  white-space: pre-line;
}

/* ============================================================================
 * RESPONSIVE DESIGN: TABLETS (<= 1100px) & MOBILE PHONES (<= 960px / <= 640px)
 * ============================================================================ */

@media (max-width: 1100px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
  .footer-col-wide {
    grid-column: span 1;
  }
}

/* Tablet & Mobile Card Transformation for the 7-Column Dormitory Table */
@media (max-width: 960px) {
  .topbar {
    padding: 10px 14px;
    position: relative; /* Frees vertical screen space on mobile phones */
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .btn-header-cta {
    width: 100%;
    text-align: center;
    padding: 9px 10px;
    font-size: 0.79rem;
    white-space: normal;
  }

  .scombo-lang {
    width: 100%;
  }

  .scombo-menu {
    min-width: 0;
    left: 0;
    right: 0;
    max-height: 270px;
  }

  .container {
    padding: 0 12px;
    margin-top: 10px;
  }

  .btn-mobile-map-toggle {
    display: inline-flex;
    align-items: center;
  }

  #mapContainer {
    height: 255px;
  }

  /* Transform 7-Column Table into Clean, Touch-Friendly Mobile Dormitory Cards */
  .table-card {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  .table-header-bar {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 13px 15px;
  }

  .table-scroll {
    overflow: visible;
  }

  table.dorm-table,
  table.dorm-table tbody {
    display: block;
    width: 100%;
  }

  table.dorm-table thead {
    display: none;
  }

  table.dorm-table tr.dorm-row {
    display: block;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    margin-bottom: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  }

  table.dorm-table tr.dorm-row td {
    display: block;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border-light);
    max-width: 100% !important;
    min-width: 0 !important;
  }

  table.dorm-table tr.dorm-row td:first-child {
    padding-top: 0;
  }

  table.dorm-table tr.dorm-row td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    padding-top: 12px;
  }

  /* Display column header above each field on mobile cards */
  table.dorm-table tr.dorm-row td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
    margin-bottom: 4px;
  }

  table.dorm-table tr.dorm-row td.cell-dorm-title::before,
  table.dorm-table tr.dorm-row td.cell-action::before {
    display: none;
  }

  .btn-apply-row {
    min-height: 46px;
    font-size: 0.95rem;
  }
}

/* Smartphone-Specific Refinements (<= 640px) */
@media (max-width: 640px) {
  /* Prevent iOS Safari auto-zoom on input focus by ensuring 16px font-size */
  .scombo-input,
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"],
  .field textarea,
  .field select {
    font-size: 16px !important;
  }

  .scombo-item {
    padding: 11px 12px;
    font-size: 0.9rem;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .brand-title {
    font-size: 1.16rem;
  }

  .brand-sub {
    font-size: 0.76rem;
  }

  .trust-strip {
    padding: 10px 12px;
  }

  .trust-items {
    gap: 8px;
    font-size: 0.76rem;
  }

  .search-card {
    padding: 14px 13px;
  }

  .mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .mode-tab {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  /* Horizontal touch-scroll for Quick Filter Chips on narrow screens */
  .quick-filters-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .qf-label,
  .qf-chip {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .footer-pill-link {
    width: 100%;
    justify-content: center;
    text-align: center;
    border-radius: 12px;
  }

  /* Bottom-sheet modal UX on mobile phones */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    padding: 18px 15px 24px;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }
}
