/* ======================================================================
   SEMPATICA FASHION - Ana stil dosyası
   Mobil öncelikli, responsive yönetim paneli
   ====================================================================== */

:root {
    --sf-bg: #f4f5f7;
    --sf-sidebar: #0f172a;
    --sf-sidebar-2: #111c33;
    --sf-sidebar-hover: #1e293b;
    --sf-accent: #d6336c;      /* marka rengi (ölçülü kullanılır) */
    --sf-accent-2: #b02a5b;
    --sf-topbar: #0f172a;
    --sf-border: #e5e7eb;
    --sf-muted: #6b7280;
    --sf-card-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { -webkit-tap-highlight-color: transparent; }

body {
    background: var(--sf-bg);
    padding-top: 56px;
    font-size: 15px;
    color: #1f2937;
    -webkit-text-size-adjust: 100%;
}

/* ---------------------------- Üst menü ---------------------------- */
.topbar {
    height: 56px;
    background: var(--sf-topbar);
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04);
    z-index: 1040;
}
.brand-mark {
    background: var(--sf-accent);
    color: #fff;
    font-weight: 800;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 14px; letter-spacing: .5px;
}
.brand-text { font-size: 1rem; letter-spacing: .3px; color: #fff; }
.brand-text span { color: #f472b6; }
.text-accent { color: #f472b6; }
.brand-logo-chip { background: #fff; border-radius: 8px; padding: 3px 7px; display: inline-flex; align-items: center; height: 36px; }
.brand-logo-chip img { max-height: 28px; max-width: 130px; object-fit: contain; display: block; }
.navbar-brand { color: #fff !important; }

/* ---------------------------- Yerleşim --------------------------- */
.app-shell { display: flex; align-items: flex-start; }
.content {
    flex: 1 1 auto;
    min-width: 0;                 /* tabloların taşmasını engeller */
    padding: 1rem;
    width: 100%;
}
@media (min-width: 992px) {
    .content { padding: 1.5rem 1.75rem; }
}

/* ---------------------------- Kenar menü ------------------------- */
.sidebar {
    --bs-offcanvas-width: 264px;
    background: var(--sf-sidebar);
    color: #cbd5e1;
}
.sidebar .offcanvas-body { background: var(--sf-sidebar); }
@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        width: 248px;
        flex: 0 0 248px;
        overflow-y: auto;
    }
}
.sidebar-nav { display: flex; flex-direction: column; padding: .75rem .5rem; gap: 2px; }
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .85rem;
    color: #cbd5e1; text-decoration: none;
    border-radius: 9px; font-size: .95rem; font-weight: 500;
    transition: background .12s, color .12s;
    min-height: 44px;
}
.sidebar-link i { font-size: 1.1rem; width: 22px; text-align: center; flex: 0 0 22px; }
.sidebar-link:hover { background: var(--sf-sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sf-accent); color: #fff; box-shadow: 0 2px 8px rgba(214, 51, 108, .35); }
.sidebar-link-accent { border: 1px dashed rgba(244, 114, 182, .5); }
.sidebar-link-accent.active { border-color: transparent; }
.sidebar-sep { height: 1px; background: rgba(255,255,255,.08); margin: .6rem .5rem; }

/* ---------------------------- Başlıklar -------------------------- */
.page-head {
    display: flex; flex-wrap: wrap; gap: .75rem;
    align-items: center; justify-content: space-between;
    margin-bottom: 1.1rem;
}
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; color: #111827; }
.page-title i { color: var(--sf-accent); }
.page-sub { color: var(--sf-muted); font-size: .9rem; margin: .15rem 0 0; }

/* ---------------------------- Kartlar ---------------------------- */
.card { border: 1px solid var(--sf-border); border-radius: 12px; box-shadow: var(--sf-card-shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--sf-border); font-weight: 600; border-radius: 12px 12px 0 0 !important; }

/* İstatistik kartları (dashboard, depo/mağaza) */
.stat-card {
    border: 1px solid var(--sf-border); border-radius: 14px; background: #fff;
    padding: 1rem 1.1rem; box-shadow: var(--sf-card-shadow); height: 100%;
}
.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: #111827; }
.stat-card .stat-label { color: var(--sf-muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.si-green { background: #dcfce7; color: #16a34a; }
.si-red { background: #fee2e2; color: #dc2626; }
.si-blue { background: #dbeafe; color: #2563eb; }
.si-orange { background: #ffedd5; color: #ea580c; }
.si-purple { background: #ede9fe; color: #7c3aed; }
.si-gray { background: #f1f5f9; color: #475569; }

/* ---------------------------- Rozetler --------------------------- */
.badge-tam { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-kirik { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-soft { font-weight: 600; padding: .35em .6em; border-radius: 6px; font-size: .78rem; }
.text-borc { color: #dc2626; font-weight: 700; }
.text-alacak { color: #16a34a; font-weight: 700; }
.text-sifir { color: #64748b; font-weight: 700; }

/* ---------------------------- Butonlar --------------------------- */
.btn { border-radius: 9px; font-weight: 500; }
.btn-brand { background: var(--sf-accent); border-color: var(--sf-accent); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--sf-accent-2); border-color: var(--sf-accent-2); color: #fff; }
.btn-outline-brand { border-color: var(--sf-accent); color: var(--sf-accent); }
.btn-outline-brand:hover, .btn-outline-brand:focus { background: var(--sf-accent); border-color: var(--sf-accent); color: #fff; }
.btn-lg-touch { min-height: 48px; }
@media (max-width: 991.98px) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 38px; }
}

/* ---------------------------- Formlar ---------------------------- */
.form-control, .form-select { border-radius: 9px; }
.form-control:focus, .form-select:focus { border-color: var(--sf-accent); box-shadow: 0 0 0 .2rem rgba(214, 51, 108, .12); }
/* iOS zoom engelleme: mobilde input font >= 16px */
@media (max-width: 767.98px) {
    .form-control, .form-select { font-size: 16px; }
}
.form-label { font-weight: 600; font-size: .88rem; color: #374151; margin-bottom: .3rem; }
.required::after { content: " *"; color: #dc2626; }

/* ---------------------------- Tablolar --------------------------- */
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; color: #64748b; background: #f8fafc; white-space: nowrap; }
.table-hover tbody tr:hover { background: #fafafa; }
.data-card { overflow: hidden; }

/* Responsive tablo -> kart (küçük ekran) */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr {
        margin-bottom: .75rem; border: 1px solid var(--sf-border);
        border-radius: 11px; padding: .35rem .8rem; background: #fff; box-shadow: var(--sf-card-shadow);
    }
    .table-cards td {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        border: 0; padding: .45rem 0; text-align: right; border-bottom: 1px dashed #f1f5f9;
    }
    .table-cards tr td:last-child { border-bottom: 0; }
    .table-cards td::before {
        content: attr(data-label); font-weight: 600; color: #6b7280;
        text-align: left; flex: 0 0 auto; font-size: .82rem;
    }
    .table-cards td.cell-actions { justify-content: flex-end; }
    .table-cards td.cell-actions::before { content: ""; }
    .table-cards td.cell-main { font-weight: 700; font-size: 1.02rem; }
}

/* Yatay kaydırılabilir tablo */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------------------------- Satış ekranı ----------------------- */
.sale-line-card { border: 1px solid var(--sf-border); border-radius: 12px; background: #fff; padding: .85rem; box-shadow: var(--sf-card-shadow); }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--sf-border); border-radius: 10px; overflow: hidden; }
.qty-stepper button { width: 44px; height: 44px; border: 0; background: #f8fafc; font-size: 1.3rem; line-height: 1; color: #111827; }
.qty-stepper button:active { background: #eef2f7; }
.qty-stepper input { width: 56px; height: 44px; border: 0; text-align: center; font-weight: 700; font-size: 1.05rem; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sale-sticky-bar {
    position: sticky; bottom: 0; z-index: 1030;
    background: #fff; border-top: 2px solid var(--sf-accent);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
    padding: .75rem 1rem; margin: 1rem -1rem -1rem;
}
@media (min-width: 992px) {
    .sale-sticky-bar { border-radius: 12px; border: 1px solid var(--sf-border); border-top: 3px solid var(--sf-accent); margin: 1rem 0 0; position: sticky; bottom: 1rem; }
}

/* Arama sonuç açılır listesi */
.search-results {
    position: absolute; z-index: 1055; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid var(--sf-border); border-radius: 0 0 11px 11px;
    max-height: 320px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.search-results .result-item { padding: .7rem .85rem; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.search-results .result-item:hover, .search-results .result-item.active { background: #fdf2f8; }
.search-results .result-item:last-child { border-bottom: 0; }
.search-box-wrap { position: relative; }

/* Ürün fotoğrafı */
.product-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--sf-border); background: #fff; }
.product-thumb-lg { width: 100%; max-width: 260px; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--sf-border); }

/* Boş durum */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--sf-muted); }
.empty-state i { font-size: 2.6rem; opacity: .4; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e293b); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 2rem 1.75rem; }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand .brand-mark { width: 54px; height: 54px; font-size: 1.3rem; border-radius: 12px; }

.app-footer { border-top: 1px solid var(--sf-border); margin-top: 2rem; }

/* Ekstre satırı */
.ledger-row-debit { border-left: 3px solid #f87171; }
.ledger-row-credit { border-left: 3px solid #34d399; }

/* Yardımcılar */
.cursor-pointer { cursor: pointer; }
.fw-800 { font-weight: 800; }
.min-w-0 { min-width: 0; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ======================================================================
   GÖRÜNÜM İYİLEŞTİRMELERİ — kayma önleme + hizalama (profesyonel görünüm)
   ====================================================================== */

/* 1) Sayfalar arası yatay kaymanın ANA sebebi: bazı sayfalarda dikey kaydırma
      çubuğu çıkıp bazılarında çıkmayınca içerik sağa-sola oynar. Kaydırma
      çubuğu için yer her zaman rezerve edilir → kayma biter. */
html { scrollbar-gutter: stable; }

/* 2) Hiçbir görsel/tablo taşıp yatay kaymaya yol açmasın */
img, svg { max-width: 100%; }
.app-shell { max-width: 100%; }
.content { max-width: 100%; }

/* 3) Tablo hücreleri dikeyde ortalı (satırlar arası zıplama/kayma biter) */
.table > :not(caption) > * > * { vertical-align: middle; }

/* 4) Para/rakam sütunları hizalı görünsün (tabular rakamlar) */
.stat-value, .text-borc, .text-alacak, .text-sifir,
td.text-end, th.text-end { font-variant-numeric: tabular-nums; }

/* 5) İstatistik kartları bir satırda eşit yükseklikte dursun */
.row > [class*="col"] > .stat-card { height: 100%; }

/* 6) Üst menüdeki marka yazısı küçük ekranda taşıp kaydırmasın */
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }

/* 7) Sayfa başlığı ile butonlar aynı hizada, sarınca düzgün insin */
.page-head { align-items: center; }
.page-head > .d-flex { flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }

/* 8) Sabit alt satış çubuğu içerikle çakışmasın (altta nefes payı) */
@media (max-width: 991.98px) { .content { padding-bottom: 1.25rem; } }
