/* ==========================================================================
   Midas Ziyaretçi Giriş Formu - Modern Mobil Uyumlu Stil Dosyası
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --primary-shadow: rgba(79, 70, 229, 0.25);
  
  --emerald: #059669;
  --emerald-light: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #d97706;
  --amber-light: #fffbeb;
  --amber-border: #fde68a;

  --destructive: #dc2626;
  --destructive-light: #fef2f2;

  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 16px 12px max(32px, env(safe-area-inset-bottom)) 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Sayfa Kapsayıcısı */
.app-container {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}

/* Üst Başlık & Logo */
.header-box {
  text-align: center;
  margin-bottom: 18px;
  padding: 4px 8px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  border-radius: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.header-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Ana Form Kartı */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 18px;
  transition: all 0.2s ease;
}

@media (min-width: 640px) {
  body {
    padding: 32px 16px 48px 16px;
  }
  .form-card {
    padding: 28px 24px;
  }
}

/* Form Başlığı */
.card-header-bar {
  text-align: center;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Grid & Yerleşimler */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 480px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  margin-bottom: 13px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.form-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.form-label .req {
  color: var(--destructive);
  font-weight: 900;
}

.form-label .opt {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.reset-btn {
  background: none;
  border: none;
  color: var(--destructive);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.reset-btn:hover {
  text-decoration: underline;
}

/* Giriş Alanları */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-input,
.form-select {
  width: 100%;
  height: 46px;
  padding: 0 12px 0 38px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px; /* iOS Safari otomatik zoom'u engellemek için mobil 16px */
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

@media (min-width: 640px) {
  .form-input,
  .form-select {
    height: 44px;
    font-size: 13.5px;
  }
}

.form-input.no-icon,
.form-select.no-icon {
  padding-left: 12px;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Bölüm & Kişi Özel Kutusu */
.highlight-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
}

.clear-input-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.clear-input-btn:hover {
  color: var(--text-main);
}

/* Açılır Öneri Listesi (Autocomplete Dropdown) */
.suggestions-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.suggestions-popup.active {
  display: block;
}

.popup-header {
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.popup-item {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.1s ease;
}

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

.popup-item:hover,
.popup-item:active {
  background: var(--primary-light);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-initial {
  width: 26px;
  height: 26px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  shrink-0: 0;
}

.item-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-dept {
  font-size: 10px;
  color: var(--text-muted);
}

.default-tag {
  font-size: 9px;
  font-weight: 800;
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid var(--amber-border);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.item-ext {
  font-size: 11px;
  font-family: monospace;
  font-weight: 700;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  shrink-0: 0;
}

/* Hızlı Seçim Butonları (Pill Buttons) */
.pills-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.pills-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pill-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: var(--bg);
}

.pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px var(--primary-shadow);
}

.pill-btn .star-icon {
  color: #f59e0b;
}

.pill-btn.active .star-icon {
  color: #fef08a;
}

.pill-btn .ext-tag {
  font-size: 9px;
  font-family: monospace;
  opacity: 0.8;
}

/* Araç Bilgileri Kutusu */
.vehicle-box {
  background: #f5f7ff;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
  display: none;
}

.vehicle-box.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.plate-input {
  text-transform: uppercase;
  font-family: monospace;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.companion-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

@media (min-width: 480px) {
  .companion-row {
    grid-template-columns: 1fr 1fr;
  }
}

.companion-row input {
  height: 38px;
  font-size: 12px;
}

.companion-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(79, 70, 229, 0.15);
}

/* KVKK & Onay */
.kvkk-box {
  margin: 14px 0 16px 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  shrink-0: 0;
}

.checkbox-label a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

/* Gönder Butonu */
.submit-btn {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px var(--primary-shadow);
  transition: all 0.15s ease;
}

.submit-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.submit-btn.loading .spinner {
  display: inline-block;
}

.submit-btn.loading .btn-text {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   BAŞARI & ONAY EKRANI
   ========================================================================== */
.success-card {
  display: none;
  text-align: center;
  padding: 8px 0;
  animation: fadeIn 0.3s ease;
}

.success-card.active {
  display: block;
}

.check-badge {
  width: 64px;
  height: 64px;
  background: var(--emerald-light);
  border: 2px solid var(--emerald-border);
  color: var(--emerald);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.success-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
}

.success-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.summary-table {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 16px 0;
  text-align: left;
  font-size: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-muted);
  font-weight: 600;
}

.summary-val {
  font-weight: 800;
  color: var(--text-main);
  text-align: right;
}

.rules-box {
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: left;
  margin-bottom: 18px;
}

.rules-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 11px;
  color: #78350f;
  font-weight: 600;
}

@media (min-width: 480px) {
  .rules-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

.new-reg-btn {
  width: 100%;
  height: 44px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
}

.new-reg-btn:hover {
  background: var(--bg);
}

/* Footer */
.footer-text {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 18px;
}

/* KVKK Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Toast Bildirim */
.toast-msg {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
  max-width: 90vw;
  text-align: center;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-msg.error {
  background: var(--destructive);
}

.toast-msg.success {
  background: var(--emerald);
}
