/* ==========================================================
   Han Oto - arayüz bileşenleri
   Form alanları, Tom Select (açılır listeler), Notyf (bildirimler),
   Bootstrap Modal (açılır pencereler), buton yükleniyor durumu
   ========================================================== */

:root {
  --ui-bg: #1b1b1e;
  --ui-bg-hover: #202024;
  --ui-border: rgba(255, 255, 255, .12);
  --ui-border-hover: rgba(255, 255, 255, .24);
  --ui-text: #f2f2f2;
  --ui-muted: rgba(255, 255, 255, .5);
  --ui-radius: 12px;
  --ui-focus: 0 0 0 4px rgba(233, 2, 30, .18);
  --ui-danger: #ff4d5e;
  --ui-success: #25D366;
  --ui-warning: #f5a524;
  --ui-h: 52px;
  --ui-pop: #202024;
  --ui-heading: #fff;
  --ui-soft: rgba(255, 255, 255, .06);
  --ui-text-2: rgba(255, 255, 255, .72);
}

/* ---------- Alan düzeni ---------- */
.ui-field { position: relative; margin-bottom: 0; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  color: rgba(255, 255, 255, .78);
}
.field-label .req { color: var(--primary-color); margin-left: 2px; }
.field-label .opt { color: var(--ui-muted); font-weight: 400; margin-left: 4px; }
.field-hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ui-muted); }
.field-error { display: none; margin-top: 6px; font-size: 12.5px; color: var(--ui-danger); }
.ui-field.has-error .field-error { display: block; }

/* ikonlu alan */
.field-icon { position: relative; }
.field-icon > i {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--ui-muted); font-size: 15px; pointer-events: none; transition: color .2s;
}
.field-icon > .form-control { padding-left: 44px !important; }
.field-icon:focus-within > i { color: var(--primary-color); }

/* ---------- Metin alanları ---------- */
body.dark-scheme .form-control,
body.dark-scheme .text-light .form-control {
  height: var(--ui-h);
  margin-bottom: 0;
  padding: 0 16px;
  font-size: 15px;
  color: var(--ui-text);
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
body.dark-scheme textarea.form-control { height: auto; min-height: 120px; padding: 14px 16px; line-height: 1.6; resize: vertical; }
body.dark-scheme .form-control::placeholder { color: rgba(255, 255, 255, .35); opacity: 1; }
body.dark-scheme .form-control:hover { border-color: var(--ui-border-hover); background: var(--ui-bg-hover); }
body.dark-scheme .form-control:focus {
  outline: 0;
  color: var(--ui-text);
  background: var(--ui-bg-hover);
  border-color: var(--primary-color);
  box-shadow: var(--ui-focus);
}
body.dark-scheme .form-control.is-invalid,
body.dark-scheme .ui-field.has-error .form-control,
body.dark-scheme .form-control.error_input {
  border-color: var(--ui-danger) !important;
  box-shadow: 0 0 0 4px rgba(255, 77, 94, .14);
  background-image: none;
}
body.dark-scheme select.form-control {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23E9021E' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
  cursor: pointer;
}
body.dark-scheme select.form-control option { background: #1b1b1e; color: #fff; }
/* eski şablonun ok ikonlarını gizle (Tom Select kendi okunu çiziyor) */
.ui-field .icofont-simple-down { display: none; }

/* sayı alanı */
body.dark-scheme input[type=number].form-control { -moz-appearance: textfield; }

/* adet seçici */
.qty-stepper { display: inline-flex; align-items: stretch; height: var(--ui-h); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-bg); overflow: hidden; }
.qty-stepper button { width: 44px; border: 0; background: transparent; color: #fff; font-size: 18px; transition: background .2s; }
.qty-stepper button:hover { background: rgba(255, 255, 255, .06); }
.qty-stepper input.form-control { width: 56px !important; height: 100% !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; text-align: center; padding: 0 !important; font-weight: 700; }
.qty-stepper:focus-within { border-color: var(--primary-color); box-shadow: var(--ui-focus); }
.qty-stepper.sm { height: 42px; }
.qty-stepper.sm button { width: 34px; font-size: 15px; }
.qty-stepper.sm input.form-control { width: 42px !important; }

/* radyo kartları (teslimat seçimi) */
.choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.choice { position: relative; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; gap: 10px; height: 100%;
  padding: 14px 16px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  background: var(--ui-bg); color: #fff; font-size: 14.5px; transition: border-color .2s, box-shadow .2s;
}
.choice span i { color: var(--ui-muted); font-size: 17px; }
.choice input:checked + span { border-color: var(--primary-color); box-shadow: var(--ui-focus); }
.choice input:checked + span i { color: var(--primary-color); }
.choice input:focus-visible + span { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* ---------- Tom Select (koyu tema) ---------- */
.ts-wrapper { width: 100%; }
/* Tom Select, select'in form-control sınıfını sarmalayıcıya kopyalar: çift çerçeveyi önle */
body.dark-scheme .ts-wrapper.form-control,
body.dark-scheme .text-light .ts-wrapper.form-control {
  height: auto; min-height: 0; padding: 0; border: 0; background: none !important; box-shadow: none !important;
}
.ts-wrapper .ts-control {
  min-height: var(--ui-h);
  padding: 0 44px 0 16px;
  display: flex; align-items: center;
  color: var(--ui-text);
  background: var(--ui-bg) !important;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
  font-size: 15px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.ts-wrapper .ts-control:hover { border-color: var(--ui-border-hover); }
.ts-wrapper.focus .ts-control { border-color: var(--primary-color); box-shadow: var(--ui-focus); }
.ts-wrapper.single .ts-control::after {
  content: ''; position: absolute; right: 16px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23E9021E' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E") no-repeat center / 14px;
  transition: transform .2s;
}
.ts-wrapper.single.dropdown-active .ts-control::after { transform: rotate(180deg); border: 0; margin-top: -7px; }
.ts-wrapper .ts-control > input { color: var(--ui-text) !important; font-size: 15px; }
.ts-wrapper .ts-control > input::placeholder { color: rgba(255, 255, 255, .35); }
.ts-wrapper.single .ts-control .item { color: var(--ui-text); }
.ts-wrapper.has-error .ts-control, .ui-field.has-error .ts-control { border-color: var(--ui-danger) !important; box-shadow: 0 0 0 4px rgba(255, 77, 94, .14); }
.ts-wrapper.multi .ts-control { padding: 8px 12px; gap: 6px; flex-wrap: wrap; }
.ts-wrapper.multi .ts-control > div { margin: 0; padding: 4px 10px; border-radius: 8px; background: rgba(233, 2, 30, .16); color: var(--ui-text); border: 0; }
.ts-dropdown {
  margin-top: 6px;
  color: var(--ui-text);
  background: var(--ui-pop);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
  overflow: hidden;
  z-index: 1060;
}
.ts-dropdown .ts-dropdown-content { max-height: 280px; padding: 6px; }
.ts-dropdown .option { padding: 10px 12px; border-radius: 8px; }
.ts-dropdown .option.active { background: rgba(233, 2, 30, .12); color: var(--ui-text); }
.ts-dropdown .option.selected { color: var(--primary-color); font-weight: 600; }
.ts-dropdown .no-results { padding: 10px 12px; color: var(--ui-muted); }
.ts-dropdown .dropdown-input-wrap { padding: 8px; border-bottom: 1px solid var(--ui-border); }
.ts-dropdown .dropdown-input { height: 40px; padding: 0 12px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-bg); color: var(--ui-text); }
.ts-dropdown .dropdown-input:focus { outline: 0; border-color: var(--primary-color); }

/* ---------- Butonlar: yükleniyor durumu ---------- */
.btn-main, .btn { position: relative; }
.is-loading { pointer-events: none; opacity: .85; }
.is-loading > * { visibility: hidden; }
.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%;
  animation: ui-spin .7s linear infinite;
}
input.is-loading { color: transparent !important; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.btn-cart.is-loading::after { width: 16px; height: 16px; margin: -8px 0 0 -8px; }

/* ---------- Notyf bildirimleri ---------- */
.notyf { z-index: 2000; }
.notyf__toast {
  max-width: 420px !important;
  padding: 0 !important;
  border-radius: 14px !important;
  background: #202024 !important;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 20px 45px rgba(0, 0, 0, .5) !important;
}
.notyf__wrapper { padding: 14px 16px !important; align-items: flex-start; }
.notyf__message { color: #f2f2f2; font-size: 14.5px; line-height: 1.5; font-family: var(--body-font); }
.notyf__message a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.notyf__message strong { color: #fff; }
.notyf__icon { margin-top: 1px; }
.notyf__ripple { display: none !important; }
.notyf__toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--toast-accent, var(--primary-color)); }
.notyf__toast--success { --toast-accent: var(--ui-success); }
.notyf__toast--error { --toast-accent: var(--ui-danger); }
.notyf__toast--warning { --toast-accent: var(--ui-warning); }
.notyf__toast--info { --toast-accent: #4ea1ff; }
.notyf__dismiss-btn { background: transparent !important; opacity: .6; }
.notyf__dismiss-btn:hover { opacity: 1; }
.toast-ico { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; background: var(--toast-accent, var(--primary-color)); }

/* ---------- Bootstrap Modal (koyu tema) ---------- */
.ui-modal .modal-dialog { max-width: 440px; }
.ui-modal .modal-content {
  color: var(--ui-text);
  background: var(--ui-pop);
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
}
.ui-modal .modal-body { padding: 34px 30px 26px; text-align: center; }
.ui-modal .modal-icon {
  width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  color: var(--modal-accent, var(--primary-color));
  background: color-mix(in srgb, var(--modal-accent, #E9021E) 16%, transparent);
}
.ui-modal .modal-title { margin-bottom: 10px; font-size: 22px; color: var(--ui-heading); }
.ui-modal .modal-text { color: var(--ui-text-2); line-height: 1.65; }
.ui-modal .modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.ui-modal .modal-actions .btn-main { min-width: 140px; }
.ui-modal .btn-close-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--ui-soft); color: var(--ui-text); }
.ui-modal .btn-close-x:hover { filter: brightness(1.3); }
.modal-backdrop.show { opacity: .7; }
.btn-ghost { background: var(--ui-soft) !important; color: var(--ui-text) !important; }
.btn-ghost:hover { filter: brightness(1.25); }

/* ---------- Form kartı ---------- */
.form-card { background: #141416; border: 1px solid rgba(255, 255, 255, .07); border-radius: 20px; padding: 36px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.form-card h2 { display: flex; align-items: center; gap: 12px; }
.form-card .form-head-ico { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(233, 2, 30, .14); color: var(--primary-color); font-size: 20px; }
.form-section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ui-muted); }
.form-section-title::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .08); }
@media (max-width: 575px) { .form-card { padding: 24px 18px; border-radius: 16px; } }

@media (prefers-reduced-motion: reduce) {
  .is-loading::after { animation-duration: 1.6s; }
  .ts-wrapper.single .ts-control::after, .form-control, .choice span { transition: none; }
}

.cart-badge.bump { animation: badge-bump .45s ease; }
@keyframes badge-bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

#vin::placeholder { text-transform: none; }
.toast-ico::before { line-height: 1; }

