/* =====================================================================
   GoRest Yönetim — MODERN ARAYÜZ KATMANI
   app.css'ten SONRA yüklenir; panel genelinde tek bir görünüm sağlar.

   NEDEN AYRI DOSYA: app.css sayfa sayfa büyüdü; etiketler bir yerde <span>, başka yerde <label>, bir sayfada
   .input sınıflı, ötekinde çıplak <input>/<select> kullanıyor ve Bootstrap'in varsayılanları araya giriyordu.
   Sonuç: kayan etiketler, farklı yükseklikte kutular, stilsiz açılır listeler. Burada ÖĞE düzeyinde kurallar
   (sıfır özgüllük, :where) çıplak kontrolleri de kapsar; sınıflı kurallar yine üstün gelir.
   ===================================================================== */

:root {
    --bg:          #f6f7f9;
    --surface:     #ffffff;
    --surface-2:   #f0f2f5;
    --border:      #e2e5ea;
    --border-strong: #cfd4db;
    --text:        #181b21;
    --text-muted:  #5d6572;
    --text-faint:  #6b7380;

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;

    --shadow:    0 1px 2px rgba(16,18,22,.05), 0 2px 8px rgba(16,18,22,.04);
    --shadow-lg: 0 8px 28px rgba(16,18,22,.12);
    --ring:      0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);

    --control-h: 42px;
}

html, body {
    font-family: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Başlıklar ---------- */

h1 { font-size: 1.65rem; font-weight: 650; letter-spacing: -.02em; margin: 0 0 22px; }
h2 { font-size: 1.1rem;  font-weight: 650; letter-spacing: -.01em; margin: 0 0 14px; }
h3 { font-size: 1rem;    font-weight: 650; margin: 0 0 12px; }
h4 { font-size: .92rem;  font-weight: 650; margin: 0 0 10px; }

.panel h2, .panel h3, .card h2, .card h3 {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -.01em;
}

p { margin-top: 0; }

/* ---------- Kartlar ve paneller ---------- */

.card, .panel {
    padding: 22px;
    border-radius: var(--r-lg);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

/* Tablo içeren panel dar kalırsa yatay kaydırılır; sütunlar ezilip alt alta yığılmasın. */
.panel:has(> table), .panel:has(> .grid), .panel:has(> .table-wrap) { overflow-x: auto; }

/* ---------- Form kontrolleri: ÇIPLAK ve SINIFLI aynı görünüm ---------- */

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="button"], [type="submit"]),
       select, textarea) {
    width: 100%;
    min-height: var(--control-h);
    padding: 0 13px;
    font: inherit;
    font-size: .93rem;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

:where(textarea) { padding: 10px 13px; min-height: 96px; line-height: 1.5; resize: vertical; }

.input { min-height: var(--control-h); padding: 0 13px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: .93rem; }
textarea.input { padding: 10px 13px; min-height: 96px; }

:where(input, select, textarea)::placeholder { color: #98a0ac; opacity: 1; }

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), select, textarea):hover { border-color: #b9c0ca; }

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), select, textarea):focus,
.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}

:where(input, select, textarea):disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }

/* Açılır liste: tarayıcının kendi oku yerine tek tip ok. */
:where(select), select.input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    cursor: pointer;
    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='%235d6572' stroke-width='2.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;
    background-size: 16px;
}

/* Sayı kutusunda tarayıcı okları kalabalık yapıyor. */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

:where(input[type="checkbox"], input[type="radio"]) {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
    vertical-align: middle;
}

:where(input[type="range"]) { accent-color: var(--brand); width: 100%; }

/* ---------- Alan düzeni: etiket her yerde aynı ---------- */

.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.field > label,
.field > span:first-child {
    display: block;
    margin: 0 0 6px;
    color: var(--text);
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.3;
}

.field small, .field .hint { margin-top: 6px; color: var(--text-muted); font-size: .8rem; line-height: 1.4; }

/* İki sütunlu satır: alanlar aynı yüksekliğe gerilir, kutular HEP aynı hizada başlar
   (uzun etiket iki satıra inse de yandaki kutu kaymaz). */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: stretch; }
.row-2 > .field > label { flex: 1 0 auto; display: flex; align-items: flex-end; }

@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } .row-2 > .field > label { flex: 0 0 auto; } }

/* Kutunun yanında birim (₺, %, dk) */
.unit { color: var(--text-muted); font-size: .9rem; font-weight: 500; white-space: nowrap; }

/* Tablo hücresindeki kontroller satırı bozmasın */
td > input:not([type="checkbox"], [type="radio"]), td > select { min-height: 38px; }
td.kind { display: flex; align-items: center; gap: 8px; }
td.kind select { width: 118px; flex: 0 0 auto; }
td.kind input { width: 120px; flex: 0 0 auto; }
:where(.num) { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Düğmeler ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 0 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .93rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}

.btn:hover:not(:disabled) { background: var(--surface-2); border-color: #b9c0ca; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 1px 2px rgba(200, 54, 44, .35);
}
.btn.primary:hover:not(:disabled) { background: #b02f26; border-color: #b02f26; }

.btn.danger { background: #fff; border-color: #f0c5c1; color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: #e8a8a2; }

.btn.small { min-height: 32px; padding: 0 12px; border-radius: 8px; font-size: .82rem; }
.btn.wide { width: 100%; }

.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Tablolar ---------- */

.grid, table.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 18px;
    font-size: .9rem;
}

.grid th {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.grid th:first-child { border-top-left-radius: 10px; }
.grid th:last-child  { border-top-right-radius: 10px; }

.grid td { padding: 12px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.grid tbody tr:hover td { background: #fafbfc; }
.grid tr.row-active td { background: var(--brand-soft); }
.grid tr:last-child td { border-bottom: none; }

.grid td.actions { display: table-cell; margin: 0; text-align: right; white-space: nowrap; }
.grid td.actions .btn + .btn { margin-left: 6px; }

/* ---------- Sekmeler ve segmentler ---------- */

.tabs { gap: 2px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.tab { min-height: 36px; padding: 0 16px; font-weight: 600; transition: background-color .15s, color .15s; }
.tab.active { box-shadow: var(--shadow); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); overflow: visible; }
.seg-btn { min-height: 34px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-weight: 600; transition: background-color .15s, color .15s; }
.seg-btn + .seg-btn { border-left: 0; }
.seg-btn:hover:not(.on) { background: rgba(0,0,0,.04); }
.seg-btn.on { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(200, 54, 44, .35); }

/* ---------- Uyarılar ---------- */

.alert {
    padding: 14px 18px;
    border-radius: var(--r-md);
    line-height: 1.5;
}

/* ---------- Yan menü ---------- */

.sidebar { border-right-color: var(--border); }

.nav .item { min-height: 42px; padding: 0 12px; border-radius: 10px; font-weight: 550; transition: background-color .15s, color .15s; }
.nav .item.active { font-weight: 650; box-shadow: inset 3px 0 0 var(--brand); }

.signout button { min-height: 40px; border-radius: 10px; font-weight: 600; }

/* ---------- Küçük ayrıntılar ---------- */

hr { border-top-color: var(--border); }

.muted { color: var(--text-muted); }

.content { padding: 32px 36px; }
@media (max-width: 800px) { .content { padding: 16px; } }

/* Kaydırma çubukları sakin */
* { scrollbar-width: thin; scrollbar-color: #c7ccd4 transparent; }

/* Odak halkası tek tip */
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* Teslimat sayfası: sol sütun form için yeterince geniş olsun */
.split { grid-template-columns: minmax(400px, 460px) 1fr; gap: 22px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* --- İnce ayarlar (önizleme sonrası) --- */

/* Bootstrap'in <mark> görünümü .mark sınıflı markada sarı zemin veriyordu. */
.mark, .brand .mark { background: none; padding: 0; color: var(--brand); }

/* Alan içinde sütun düzeni segment/sekmeyi tam genişliğe germesin. */
.field > .seg, .field > .tabs, .field > .btn { align-self: flex-start; }

/* Tablo sıkı: satırlar sarmasın, dar panelde yatay kayar; ad sütunu sarabilir. */
.grid th, .grid td { padding: 10px 9px; }
.grid td { white-space: nowrap; }
.grid td:first-child { white-space: normal; min-width: 90px; }

.split { grid-template-columns: minmax(440px, 520px) 1fr; }

/* Tablo içindeki sayı/ metin kutusu satırı doldurup uçmasın. */
.grid td > input:not([type="checkbox"], [type="radio"]) { max-width: 200px; }

/* İşlem düğmeleri dar tabloda alt alta: yatay kaydırma çubuğu çıkmasın. */
.grid td.actions { white-space: normal; width: 1%; }
.grid td.actions .btn { display: flex; width: 100%; min-width: 84px; }
.grid td.actions .btn + .btn { margin: 6px 0 0; }

/* Etiket içindeki ikincil yazı ("(isteğe bağlı)") app.css'in .field span kuralıyla bloğa dönüp alta düşüyordu. */
.field > span:first-child span,
.field > label span { display: inline; margin: 0; font-weight: 400; font-size: inherit; color: var(--text-muted); }

/* Kampanya formundaki iki sütun (.split-2): .row-2 ile aynı hizalama. */
.split-2 { gap: 0 16px; align-items: stretch; }
.split-2 > .field > span:first-child { flex: 1 0 auto; display: flex; align-items: flex-end; }

/* Menü: fiyat kutusu hücrede tablo satırını şişirmesin; anahtarlar ortada. */
.menu-grid td > input.input.price { min-height: 34px; }
.menu-grid td:has(> .switch) { text-align: center; }
