/* =========================================================
   Barkod — tema
   ========================================================= */
:root {
    --brand: #1f4fd8;
    --brand-600: #1a43b8;
    --brand-50: #eef3ff;
    --brand-100: #dbe5ff;
    --accent: #ffc83d;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e5e8ef;
    --bg: #f4f6fb;
    --card: #ffffff;
    --success: #15803d;
    --success-50: #e9f8ef;
    --danger: #dc2626;
    --danger-50: #fdecec;
    --warning: #b45309;
    --warning-50: #fff5e0;
    --info: #0369a1;
    --info-50: #e6f4fb;
    --radius: 12px;
    --sidebar-w: 252px;
    --topbar-h: 64px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 6px 24px rgba(15, 23, 42, .08);

    --bs-primary: var(--brand);
    --bs-primary-rgb: 31, 79, 216;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 31, 79, 216;
    --bs-link-hover-color: var(--brand-600);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-border-radius: 10px;
}

html, body {
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
}

h1:focus { outline: none; }

a { text-decoration: none; }

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-600);
    --bs-btn-active-border-color: var(--brand-600);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
}

.btn-light {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: #f1f4fa;
    --bs-btn-hover-border-color: #d7dce6;
}

.btn { font-weight: 500; }

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-control, .form-select {
    border-color: var(--line);
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #8aa6f2;
    box-shadow: 0 0 0 .2rem rgba(31, 79, 216, .15);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-label { font-weight: 500; color: var(--ink-2); font-size: .9rem; }
.form-label.required::after { content: " *"; color: var(--danger); }

.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { border-color: var(--danger) !important; }
.validation-message { color: var(--danger); font-size: .85rem; }

/* ---------- Kabuk ---------- */
.nav-toggle-input { position: absolute; opacity: 0; pointer-events: none; }

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    overflow-y: auto;
    z-index: 1040;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    /* Not: backdrop-filter/transform kullanılmaz; içindeki açılır pencereleri bara hapseder. */
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-content { padding: 26px 28px 40px; flex: 1; }

.app-backdrop { display: none; }

.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    color: var(--ink);
}

.sidebar-brand-text { font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-section {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    font-weight: 600;
    padding: 16px 10px 6px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--ink-2);
    font-weight: 500;
    font-size: .93rem;
}

.nav-item-link i { font-size: 1.05rem; color: #7b8799; width: 20px; text-align: center; }
.nav-item-link:hover { background: #f3f5fa; color: var(--ink); }
.nav-item-link.active { background: var(--brand-50); color: var(--brand); }
.nav-item-link.active i { color: var(--brand); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 12px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    color: var(--ink-2);
    font-size: .88rem;
    font-weight: 500;
}

@media (min-width: 992px) {
    /* Masaüstünde menü yan yana durur; üst bardaki pencerelerin altında kalmaması için katman açmaz. */
    .app-sidebar { z-index: auto; }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }

    .nav-toggle-input:checked + .app-shell .app-sidebar { transform: translateX(0); }

    .nav-toggle-input:checked + .app-shell .app-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .35);
        z-index: 1035;
    }

    .app-topbar { padding: 0 14px; }
    .app-content { padding: 18px 14px 32px; }
}

/* ---------- Sayfa başlığı ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-subtitle { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Kartlar / tablolar ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
    font-weight: 600;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-body { padding: 18px; }

.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }

.form-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 28px 0 14px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.card-body > .form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }

.table > thead th {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    padding: 10px 14px;
}

.table > tbody td { padding: 11px 14px; vertical-align: middle; border-color: #eef1f6; }
.table > tfoot td { padding: 11px 14px; font-weight: 600; background: #f8fafc; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7f9fd; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.row-muted td { color: #94a3b8; }
.row-muted td .text-decoration-line { text-decoration: line-through; }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }
.filter-bar .grow { flex: 1; min-width: 220px; }

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--ink-2); }

/* ---------- İstatistik kutuları ---------- */
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--brand-50); color: var(--brand); }
.stat-icon.green { background: var(--success-50); color: var(--success); }
.stat-icon.amber { background: var(--warning-50); color: var(--warning); }
.stat-icon.red { background: var(--danger-50); color: var(--danger); }
.stat-icon.cyan { background: var(--info-50); color: var(--info); }

.stat-label { color: var(--muted); font-size: .83rem; font-weight: 500; }
.stat-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: .8rem; }

/* ---------- Rozetler ---------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 4px;
}

.badge-soft-success { background: var(--success-50); color: var(--success); }
.badge-soft-danger { background: var(--danger-50); color: var(--danger); }
.badge-soft-warning { background: var(--warning-50); color: var(--warning); }
.badge-soft-info { background: var(--info-50); color: var(--info); }
.badge-soft-primary { background: var(--brand-50); color: var(--brand); }
.badge-soft-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Boş durum / yükleniyor ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state h3 { font-size: 1.1rem; color: var(--ink); font-weight: 600; margin: 12px 0 6px; }
.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 16px;
    background: var(--brand-50);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 1.8rem;
}

.loading-block { display: flex; align-items: center; gap: 10px; padding: 28px; color: var(--muted); justify-content: center; }

/* ---------- Bildirimler ---------- */
.toast-stack {
    position: fixed;
    top: 76px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 40px));
}

.app-toast {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    font-size: .92rem;
    animation: toast-in .18s ease-out;
}

.app-toast > i { font-size: 1.1rem; margin-top: 1px; }
.app-toast-success { border-left-color: var(--success); } .app-toast-success > i { color: var(--success); }
.app-toast-error { border-left-color: var(--danger); } .app-toast-error > i { color: var(--danger); }
.app-toast-warning { border-left-color: #f59e0b; } .app-toast-warning > i { color: #f59e0b; }
.app-toast-info { border-left-color: var(--info); } .app-toast-info > i { color: var(--info); }
.app-toast-link { font-weight: 600; font-size: .85rem; }
.btn-close-sm { width: .6em; height: .6em; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Ürün bulucu / seçiciler ---------- */
.product-finder, .party-picker { position: relative; }

.finder-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    z-index: 1050;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
}

.finder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: none;
    text-align: left;
    padding: 9px 10px;
    border-radius: 8px;
}

.finder-item:hover, .finder-item.active { background: var(--brand-50); }
.finder-item-main { display: flex; flex-direction: column; min-width: 0; }
.finder-item-main strong { font-weight: 600; }
.finder-item-side { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.finder-empty { padding: 10px; color: var(--muted); font-size: .9rem; }

.price-check { flex: 1; max-width: 480px; }

/* Birim seçici */
.unit-picker { position: relative; }
.unit-picker-toggle { display: flex; align-items: center; gap: 8px; text-align: left; background-color: #fff; }
.unit-code { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--muted); min-width: 42px; }
.unit-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-picker-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    z-index: 1050;
    padding: 6px;
}
.unit-picker-list { max-height: 280px; overflow-y: auto; margin-top: 6px; }
.unit-option { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 7px; }
.unit-option:hover, .unit-option.active { background: var(--brand-50); }
.unit-option.selected { font-weight: 600; color: var(--brand); }

@media (max-width: 575.98px) {
    .price-check { max-width: none; }
    .price-check .input-group-text { display: none; }
}

.party-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    background: #fbfcff;
}

.party-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.party-avatar-sm { width: 30px; height: 30px; font-size: .8rem; }
.min-w-0 { min-width: 0; }

/* ---------- Barkod ---------- */
.barcode-svg { display: block; height: auto; margin-inline: auto; }

.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); --bs-nav-link-color: var(--ink-2); --bs-nav-link-hover-color: var(--brand); }
.barcode-fallback { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: .1em; }

.scanner-frame {
    position: relative;
    background: #0b1220;
    border-radius: 12px;
    overflow: hidden;
    min-height: 260px;
}

.scanner-view { width: 100%; }
.scanner-view video { width: 100% !important; display: block; }

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.scanner-last { display: flex; gap: 8px; align-items: center; background: var(--success-50); padding: 8px 12px; border-radius: 8px; }

.price-card { text-align: center; }
.price-card-name { font-size: 1.15rem; font-weight: 600; }
.price-card-price { font-size: 2.4rem; font-weight: 700; color: var(--brand); letter-spacing: -.02em; margin: 4px 0 8px; }
.price-card-meta { display: flex; gap: 16px; justify-content: center; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.price-card .barcode-svg { margin: 0 auto; }

/* ---------- Hızlı satış (POS) ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

@media (max-width: 1199.98px) {
    .pos-grid { grid-template-columns: 1fr; }
}

.pos-last {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, var(--brand-50), #fff);
    border: 1px solid var(--brand-100);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 14px;
}

.pos-last-price { font-size: 1.9rem; font-weight: 700; color: var(--brand); margin-left: auto; white-space: nowrap; }

.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.qty-control button { border: 0; background: #f6f8fb; width: 32px; height: 34px; }
.qty-control button:hover { background: var(--brand-50); }
.qty-control input { width: 70px; border: 0; text-align: center; height: 34px; font-variant-numeric: tabular-nums; }
.qty-control input:focus { outline: none; }
.price-input { width: 120px; text-align: right; }

.pay-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pay-option {
    border: 2px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--ink-2);
}

.pay-option i { font-size: 1.5rem; }
.pay-option small { font-weight: 500; color: var(--muted); font-size: .72rem; }
.pay-option.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }

.totals { display: flex; flex-direction: column; gap: 6px; }
.totals-row { display: flex; justify-content: space-between; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.totals-grand { font-size: 1.6rem; font-weight: 700; color: var(--ink); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }

.kbd { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; background: #f1f5f9; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--ink-2); }

/* ---------- Detay sayfaları ---------- */
.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.detail-list dt { color: var(--muted); font-weight: 500; font-size: .9rem; }
.detail-list dd { margin: 0; }

@media (max-width: 575.98px) {
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 8px; }
}

.journal-lines td { padding: 6px 14px !important; font-size: .9rem; }
.journal-credit { padding-left: 36px !important; }

/* ---------- Giriş / kayıt ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; }

.auth-brand {
    background: radial-gradient(1200px 600px at -10% -20%, #3d6ef7 0%, #1739a8 45%, #0f2470 100%);
    color: #fff;
    padding: 40px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: auto -60px -80px auto;
    width: 340px;
    height: 340px;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 6px, transparent 6px 14px, rgba(255,255,255,.08) 14px 17px, transparent 17px 26px);
    border-radius: 40px;
    transform: rotate(-12deg);
}

.auth-logo { display: inline-flex; align-items: center; gap: 12px; color: inherit; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.auth-brand .auth-logo { color: #fff; }
.auth-pitch h2 { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; max-width: 420px; line-height: 1.25; }
.auth-pitch ul { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; font-size: 1.02rem; opacity: .95; }
.auth-pitch li i { color: var(--accent); margin-right: 8px; }
.auth-foot { opacity: .7; position: relative; z-index: 1; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth-card { width: 100%; max-width: 400px; }
.auth-title { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-subtitle { color: var(--muted); margin-bottom: 24px; }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); }
.auth-logo-mobile { display: none; color: var(--ink); margin-bottom: 28px; font-size: 1.4rem; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-logo-mobile { display: inline-flex; }
}

/* ---------- Hata çubuğu ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #fff7e0;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 3000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: var(--danger-50);
    color: var(--danger);
    padding: 1rem;
    border-radius: 10px;
}

.blazor-error-boundary::after { content: "Bir hata oluştu."; }

/* ---------- Yazdırma ---------- */
.print-only { display: none; }

@media print {
    @page { margin: 12mm; }
    body { background: #fff; }
    .app-sidebar, .app-topbar, .no-print, .toast-stack, .page-actions, #blazor-error-ui { display: none !important; }
    .app-content { padding: 0; }
    .card { border: 0; box-shadow: none; }
    .print-only { display: block; }
    .label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm; }
}
