/* components.css — ortak bileşenler (v2 · modern). Eski sayfaların kullandığı adlar (btn, card, form-control, table...) korunur. */
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: translateY(10px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Buton */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap-min); padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: 600 var(--fs-base)/1 var(--font); letter-spacing: .005em; text-decoration: none; cursor: pointer;
  color: #fff; background-color: var(--primary-solid); background-image: var(--grad-primary);
  box-shadow: var(--shadow-btn), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: filter .15s, transform .15s var(--ease), box-shadow .15s, background-color .15s, border-color .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn-primary { background-color: var(--primary-solid); background-image: var(--grad-primary); }
.btn-success { background-color: var(--success-solid); background-image: var(--grad-success); }
.btn-danger { background-color: var(--danger-solid); background-image: var(--grad-danger); }
.btn-ghost {
  background: rgba(255, 255, 255, .04); color: var(--text);
  border-color: var(--border-strong); box-shadow: none;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); border-radius: 10px; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 56px; font-size: var(--fs-lg); font-weight: 700; border-radius: 14px; }
.btn-icon { width: var(--tap-min); padding: 0; }
.btn-primary, .btn:not([class*="btn-"]) { box-shadow: var(--shadow-btn), 0 10px 26px -12px rgba(232, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-success { box-shadow: var(--shadow-btn), 0 10px 26px -12px rgba(16, 185, 129, .55), inset 0 1px 0 rgba(255, 255, 255, .18); }
@media (hover: hover) {
  .btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
  .btn:active { transform: translateY(1px) scale(.99); }
  .btn-ghost:hover { background: rgba(255, 255, 255, .09); border-color: #4b4b55; filter: none; }
}

/* Form */
.field { margin-bottom: var(--sp-4); }
.field > label, label.label { display: block; margin-bottom: 7px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-dim); letter-spacing: .005em; }
.form-control {
  display: block; width: 100%; min-height: var(--tap-min); padding: 10px 14px;
  background: rgba(255, 255, 255, .035); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: 400 1rem/1.4 var(--font); /* 16px: iOS yakınlaştırmasını önler */
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea.form-control { min-height: 96px; resize: vertical; }
.form-control::placeholder { color: #7d7d86; }
@media (hover: hover) { .form-control:hover:not(:focus):not([readonly]) { border-color: #4b4b55; } }
.form-control:focus { outline: none; border-color: var(--primary); background: rgba(255, 255, 255, .06); box-shadow: var(--ring); }
.form-control.is-invalid { border-color: var(--danger-text); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.form-control:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 100px #1d1d21 inset; caret-color: var(--text); }
.field__error { margin-top: 6px; font-size: var(--fs-sm); color: var(--danger-text); }
.field__hint { margin-top: 6px; font-size: var(--fs-sm); color: var(--text-dim); }

/* Kart */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 120px), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  overflow: hidden; margin-bottom: var(--sp-4);
}
.card-header { padding: var(--sp-4) 22px; background: rgba(255, 255, 255, .025); border-bottom: 1px solid var(--border); }
.card-body { padding: 22px; }
a.card--link { display: block; color: inherit; text-decoration: none; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s; }
@media (hover: hover) { a.card--link:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-card), 0 14px 34px -16px rgba(232, 0, 0, .45); } }

/* Plaka rozeti — uygulamanın imzası: beyaz zemin, sol kırmızı şerit, tek aralıklı kalın yazı */
.plaka-badge {
  display: inline-block; white-space: nowrap;
  padding: 3px 12px 3px 14px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #e9e9ec); color: #111;
  border-left: 12px solid var(--primary-solid);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 6px 14px -8px rgba(0, 0, 0, .8);
  font: 800 var(--fs-sm)/1.5 var(--font-plate); letter-spacing: .06em; text-transform: uppercase;
}
.plaka-badge--lg { font-size: var(--fs-xl); padding: 4px 18px 4px 20px; border-left-width: 16px; }
@media (max-width: 480px) { .plaka-badge--lg { font-size: var(--fs-lg); padding: 3px 12px 3px 14px; border-left-width: 12px; } }

/* Bilgi satırı (etiket solda, değer sağda) */
.data-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4); padding: 13px 0; border-bottom: 1px solid var(--border); }
.data-row:last-child { border-bottom: 0; }
.data-row__label { color: var(--text-dim); font-size: var(--fs-sm); }
.data-row__value { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Tablo: masaüstünde tablo, telefonda kart listesi (td'lere data-label verin) */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 14px; color: var(--text-dim); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--border-strong); }
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table .num, .table .text-end { text-align: right; }
@media (hover: hover) { .table tbody tr { transition: background-color .15s; } .table tbody tr:hover { background: rgba(255, 255, 255, .03); } }
@media (max-width: 768px) {
  .table--cards, .table--cards tbody { display: block; }
  .table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--cards tr { display: block; margin-bottom: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-2) var(--sp-4); box-shadow: var(--shadow-card); }
  .table--cards td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); padding: 10px 0; border-bottom: 1px solid var(--border); text-align: right; }
  .table--cards td:last-child { border-bottom: 0; }
  .table--cards td:not([data-label]) { display: block; }
  .table--cards td:not([data-label]) > .btn { width: 100%; }
  .table--cards td[data-label]::before { content: attr(data-label); color: var(--text-dim); font-size: var(--fs-sm); text-align: left; flex: none; }
}

/* Özet kutusu (toplam / ödenen / kalan) */
.summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.summary__item { background: var(--surface); padding: var(--sp-4) 18px; }
.summary__label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.summary__value { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.summary__item--paid .summary__value { color: var(--success-text); }
.summary__item--due .summary__value { color: var(--danger-text); }
@media (min-width: 769px) { .summary { grid-template-columns: repeat(4, 1fr); } }

/* Durum etiketi: renk + yazı birlikte (yalnız renge güvenme) */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; background: var(--primary-soft); color: var(--primary-text); box-shadow: inset 0 0 0 1px rgba(255, 90, 90, .22); }
.tag--ok { background: var(--success-soft); color: var(--success-text); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .25); }
.tag--due { background: var(--danger-soft); color: var(--danger-text); box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25); }
.tag--wait { background: var(--warning-soft); color: var(--warning-text); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .25); }

/* Boş durum */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--text-dim); }
.empty i { font-size: 2.25rem; margin-bottom: var(--sp-3); color: var(--border-strong); }
.empty p { margin: 0 0 var(--sp-4); }

/* Modal: telefonda alttan açılan sayfa, masaüstünde ortada pencere */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: none; align-items: flex-end; justify-content: center; background: rgba(4, 4, 6, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal.is-open { display: flex; animation: fade-in .2s ease; }
.modal__panel {
  width: 100%; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, 0) 140px), var(--surface);
  border: 1px solid var(--border-strong); border-bottom: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-pop);
  padding: 12px 22px calc(22px + var(--safe-bottom));
}
.modal.is-open .modal__panel { animation: sheet-up .3s var(--ease); }
.modal__panel::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: var(--border-strong); } /* tutamaç (yalnız telefon) */
.modal__title { margin: 0 0 var(--sp-3); }
.modal__actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal__actions .btn { flex: 1; }
@media (min-width: 769px) {
  .modal { align-items: center; }
  .modal__panel { width: 460px; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); padding: 24px; }
  .modal.is-open .modal__panel { animation: pop-in .25s var(--ease); }
  .modal__panel::before { display: none; }
}

/* Bildirim */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px); transform: translateX(-50%); z-index: var(--z-toast);
  max-width: min(92vw, 420px); padding: 13px 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-weight: 600; font-size: var(--fs-sm);
  animation: toast-in .3s var(--ease);
}
.toast--ok { border-color: var(--success-solid); }
.toast--error { border-color: var(--danger-solid); }
@media (min-width: 769px) { .toast { bottom: 24px; } }

/* Yardımcılar (eski sayfalar kullanıyor) */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.mt-4 { margin-top: 1.5rem; }
.stack > * + * { margin-top: var(--sp-3); }
.row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }

/* Eski müşteri bilgi çubuğu (fatura_olustur vb.) */
.customer-info-bar { display: flex; align-items: center; gap: 20px; }
.info-value { font-size: var(--fs-lg); font-weight: 600; }
.info-divider { width: 1px; height: 25px; background: var(--border-strong); }
@media (max-width: 768px) { .customer-info-bar { flex-direction: column; align-items: flex-start; gap: 6px; } .info-divider { display: none; } }

/* Bildirim kutusu (.alert adları, PHP içindeki hazır mesajlar için de geçerli) */
.notice, .alert {
  padding: 13px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  font-size: var(--fs-sm); line-height: 1.5; background: var(--primary-soft); color: var(--text);
}
.notice--ok, .alert-success { background: var(--success-soft); border-color: var(--success-solid); color: var(--success-text); }
.notice--error, .alert-danger { background: var(--danger-soft); border-color: var(--danger-solid); color: var(--danger-text); }

/* Onay kutusu: tüm satır dokunma alanı */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap-min); cursor: pointer; color: var(--text-dim); font-size: var(--fs-sm); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary-solid); }

/* Açılır bölüm (<details>): JS gerektirmez; kapalı/açık için iki ayrı yazı */
.disclosure { margin: var(--sp-4) 0; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: rgba(255, 255, 255, .015); }
.disclosure > summary {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap-min); padding: 0 var(--sp-4); cursor: pointer; list-style: none;
  color: var(--text-dim); font-size: var(--fs-sm); font-weight: 600; border-radius: var(--radius);
  transition: color .15s, background-color .15s;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .when-open { display: none; }
.disclosure[open] > summary .when-open { display: inline; }
.disclosure[open] > summary .when-closed { display: none; }
.disclosure[open] > summary { border-bottom: 1px dashed var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; }
.disclosure--primary > summary { color: var(--primary-text); }
.disclosure__body { padding: var(--sp-4); }
@media (hover: hover) { .disclosure > summary:hover { color: var(--text); background: rgba(255, 255, 255, .04); } }

/* Küçük kısayol düğmesi */
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  background: rgba(255, 255, 255, .04); color: var(--text); border: 1px solid var(--border-strong); border-radius: 999px;
  font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; transition: border-color .15s, background-color .15s;
}
@media (hover: hover) { .chip:hover { border-color: var(--primary); background: var(--primary-soft); } }

/* Seçim kutusu */
select.form-control {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select.form-control option { background: var(--surface-3); color: var(--text); }
.form-control[readonly] { color: var(--text-dim); }
.form-control--plate { font-family: var(--font-plate); font-weight: 800; letter-spacing: .08em; color: var(--success-text) !important; }

/* Çerçeveli kırmızı düğme (silme gibi ağır eylemler için daha sakin) */
.btn-outline-danger { background: transparent; background-image: none; color: var(--danger-text); border-color: rgba(220, 38, 38, .6); box-shadow: none; }
@media (hover: hover) { .btn-outline-danger:hover { background: var(--danger-soft); border-color: var(--danger-solid); filter: none; } }

/* Sayı rozeti */
.count-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-size: var(--fs-sm); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 90, 90, .22); }

/* Ortak form bileşenleri (Faz 5: musteri_duzenle ile paylaşılır; index.css'teki kopya Faz 7'de kaldırılacak) */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 var(--sp-4); }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.combo { position: relative; }
.combo__list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 6px; max-height: 240px; overflow-y: auto; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); animation: pop-in .18s var(--ease); }
.combo__list[hidden] { display: none; }
.combo__item { padding: 12px 14px; min-height: var(--tap-min); display: flex; align-items: center; cursor: pointer; color: var(--text); border-bottom: 1px solid rgba(255,255,255,.05); }
.combo__item:last-child { border-bottom: 0; }
@media (hover: hover) { .combo__item:hover { background: var(--primary-soft); } }
#yeniMarkaAlani { margin-top: var(--sp-2); }
#yeniMarkaAlani[hidden] { display: none; }
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.list-head h2 { margin: 0; font-size: var(--fs-lg); }

/* SweetAlert, açık modalın (alt panel) önünde görünsün */
.swal2-container { z-index: 1300 !important; }
.swal2-popup { font-family: var(--font); border: 1px solid var(--border-strong) !important; border-radius: var(--radius-xl) !important; box-shadow: var(--shadow-pop) !important; }
.swal2-styled { border-radius: var(--radius) !important; font-weight: 600 !important; }

/* Sayfa başlığının sağındaki arama kutusu (Dükkandakiler, Son İşlemler, Borç Takip için ortak) */
.page-title__main { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-width: 0; }
.page-search { position: relative; flex: 1 1 260px; max-width: 340px; margin: 0; margin-left: auto; }
.page-search > i:first-child { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.page-search .form-control { padding-left: 40px; border-radius: 999px; }
.page-search--form .form-control { padding-right: 44px; }
.page-search--form input[type="search"]::-webkit-search-cancel-button { display: none; }
.page-search__clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--text-dim); text-decoration: none; }
@media (hover: hover) { .page-search__clear:hover { color: var(--text); background: var(--primary-soft); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 768px) { .page-search { flex-basis: 100%; max-width: none; margin-left: 0; } }
