/* ── KESO Admin Shell ─────────────────────────────────────────────────── */
:root {
    --keso-primary:    #2563eb;
    --keso-sidebar-w:  240px;
    --keso-bg:         #f1f5f9;
    --keso-sidebar-bg: #1e293b;
    --keso-sidebar-fg: #94a3b8;
    --keso-active-fg:  #ffffff;

    /* Semantik token'lar — dark modda bunlar override edilir */
    --keso-card-bg:      #ffffff;
    --keso-card-border:  #e8edf5;
    --keso-topbar-bg:    #ffffff;
    --keso-topbar-bd:    #e2e8f0;
    --keso-th-bg:        #f8fafc;
    --keso-th-color:     #94a3b8;
    --keso-th-border:    #f1f5f9;
    --keso-input-bg:     #ffffff;
    --keso-text:         #1e293b;
    --keso-text-muted:   #64748b;
    --keso-tint-amber:   #fffbeb;
    --keso-tint-rose:    #fff1f2;
    --keso-tint-orange:  #fff7ed;
    --keso-tint-green:   #f0fdf4;
    --keso-tint-blue:    #eff6ff;
    --keso-tint-purple:  #f5f3ff;
    --keso-row-pinned:   #fffbeb;
    --keso-row-hover:    #f8fafc;
    --keso-shadow:       rgba(0,0,0,.05);
    --keso-dd-shadow:    rgba(0,0,0,.09);
}

/* ── Dark mode token override ─────────────────────────────────────────── */
[data-bs-theme="dark"] {
    --keso-bg:           #0f172a;
    --keso-card-bg:      #1e293b;
    --keso-card-border:  #334155;
    --keso-topbar-bg:    #1e293b;
    --keso-topbar-bd:    #334155;
    --keso-th-bg:        #0f172a;
    --keso-th-color:     #475569;
    --keso-th-border:    #334155;
    --keso-input-bg:     #0f172a;
    --keso-text:         #e2e8f0;
    --keso-text-muted:   #94a3b8;
    --keso-tint-amber:   rgba(245,158,11,.12);
    --keso-tint-rose:    rgba(251,113,133,.12);
    --keso-tint-orange:  rgba(251,146,60,.12);
    --keso-tint-green:   rgba(34,197,94,.10);
    --keso-tint-blue:    rgba(59,130,246,.12);
    --keso-tint-purple:  rgba(139,92,246,.12);
    --keso-row-pinned:   rgba(245,158,11,.08);
    --keso-row-hover:    rgba(255,255,255,.03);
    --keso-shadow:       rgba(0,0,0,.25);
    --keso-dd-shadow:    rgba(0,0,0,.4);
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--keso-bg);
    font-family: 'Segoe UI', sans-serif;
    transition: background .2s;
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.admin-sidebar {
    width: var(--keso-sidebar-w);
    background: var(--keso-sidebar-bg);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand { border-bottom: 1px solid #334155; }

.admin-sidebar .nav-link {
    color: var(--keso-sidebar-fg);
    border-radius: 6px;
    padding: .45rem .75rem;
    font-size: .875rem;
    transition: background .15s, color .15s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255,255,255,.08);
    color: var(--keso-active-fg);
}

.nav-section-label {
    display: block;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: .25rem .75rem;
}

.sidebar-footer { border-top: 1px solid #334155; }

.powered-by { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.powered-by-brand  { font-size: .8rem;  font-weight: 700; color: #94a3b8; letter-spacing: .08em; }
.powered-by-label  { font-size: .6rem;  font-weight: 600; color: #475569; letter-spacing: .03em; }

/* ── Tema Pills ───────────────────────────────────────────────────────── */
.tema-baslik {
    font-size: .65rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: #475569; margin-bottom: 6px;
}
.tema-pills { display: flex; gap: 4px; margin-bottom: 2px; }
.tema-pill {
    flex: 1; display: flex; align-items: center; justify-content: center;
    height: 30px; border: 1px solid #334155; border-radius: 6px;
    background: transparent; color: #64748b; font-size: .8rem;
    cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.tema-pill:hover { background: rgba(255,255,255,.08); color: #94a3b8; }
.tema-pill.aktif { background: var(--keso-primary); border-color: var(--keso-primary); color: #fff; }

/* ── Main area ────────────────────────────────────────────────────────── */
.admin-main { margin-left: var(--keso-sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.admin-topbar {
    background: var(--keso-topbar-bg);
    border-bottom: 1px solid var(--keso-topbar-bd);
    min-height: 52px;
    transition: background .2s, border-color .2s;
}

.admin-content { flex: 1; }

/* ── Card / table containers ─────────────────────────────────────────── */
.stat-card,
.keso-card,
.dash-stat,
.mini-stat,
.s-card,
.table-card {
    background: var(--keso-card-bg) !important;
    border-color: var(--keso-card-border) !important;
    transition: background .2s, border-color .2s;
}

.stat-card  { border-radius: 12px; border: 1px solid var(--keso-card-border); padding: 1.25rem; box-shadow: 0 1px 3px var(--keso-shadow); }
.table-card { border-radius: 14px; border: 1px solid var(--keso-card-border); overflow: hidden; box-shadow: 0 1px 4px var(--keso-shadow); }

.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table { --bs-table-hover-bg: var(--keso-row-hover); }

.table thead th {
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--keso-th-color) !important;
    background: var(--keso-th-bg) !important;
    border-bottom: 1px solid var(--keso-th-border) !important;
}

/* Pinned rows (duyurular, haberler) */
.d-table tbody tr.pinned td,
.h-table tbody tr.mansete td { background: var(--keso-row-pinned) !important; }

/* ── Dropdown (firma arama kutusu vb.) ───────────────────────────────── */
.firma-dd {
    background: var(--keso-card-bg) !important;
    border-color: var(--keso-card-border) !important;
    box-shadow: 0 8px 24px var(--keso-dd-shadow);
}

/* ── Önizleme barı (kampanya formu) ──────────────────────────────────── */
.pre-bar,
.pre-card { background: var(--keso-card-bg) !important; }
.pre-bar  { border-bottom-color: var(--keso-card-border) !important; }

/* ── Tab butonları ────────────────────────────────────────────────────── */
.keso-tab-btn:hover  { background: var(--keso-card-bg) !important; }
.keso-tab-btn.active { background: var(--keso-card-bg) !important; }

/* ── Çakışma uyarı kutusu ─────────────────────────────────────────────── */
.cakisma-box { background: var(--keso-tint-orange) !important; }

[data-bs-theme="dark"] .cakisma-box {
    background: rgba(251,146,60,.12) !important;
    border-color: rgba(251,146,60,.3) !important;
    color: #fca87a !important;
}

/* ── İkon tint arka planları (inline style'ları CSS ile geç) ─────────── */
/* Bu class'lar inline style ile set edilen renkleri override eder       */
[data-bs-theme="dark"] .dash-stat-icon,
[data-bs-theme="dark"] .mini-stat-icon,
[data-bs-theme="dark"] .dash-hero-icon,
[data-bs-theme="dark"] .header-icon,
[data-bs-theme="dark"] .hicon,
[data-bs-theme="dark"] .s-icon {
    background: rgba(255,255,255,.08) !important;
}

/* ── Activity pills ───────────────────────────────────────────────────── */
[data-bs-theme="dark"] .activity-pill {
    background: rgba(255,255,255,.06) !important;
    border-color: rgba(255,255,255,.12) !important;
}

/* ── Rank numaraları ──────────────────────────────────────────────────── */
[data-bs-theme="dark"] .rank-num {
    background: rgba(255,255,255,.08) !important;
    color: var(--keso-text-muted) !important;
}

/* ── input-group-text — bg ve border override (rengi Bootstrap'e bırak) ── */
[data-bs-theme="dark"] .input-group-text {
    background: var(--keso-card-bg) !important;
    border-color: var(--keso-card-border) !important;
}

/* ── Bootstrap text renkleri ─────────────────────────────────────────── */
[data-bs-theme="dark"] .text-muted { color: var(--keso-text-muted) !important; }
[data-bs-theme="dark"] .text-dark  { color: var(--keso-text) !important; }

/* ── Bootstrap bg-light, bg-white ────────────────────────────────────── */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light { background-color: var(--keso-card-bg) !important; }

/* ── Bootstrap border ────────────────────────────────────────────────── */
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end { border-color: var(--keso-card-border) !important; }

/* ── Bootstrap btn-outline-secondary ─────────────────────────────────── */
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color:        #94a3b8;
    --bs-btn-border-color: #475569;
    --bs-btn-hover-bg:     #334155;
    --bs-btn-hover-color:  #e2e8f0;
}

/* ── Bootstrap btn-xs ────────────────────────────────────────────────── */
.btn-xs { padding: .125rem .35rem; font-size: .75rem; border-radius: .2rem; line-height: 1.4; }

/* ── Login sayfası ────────────────────────────────────────────────────── */
[data-bs-theme="dark"] .login-card {
    background: var(--keso-card-bg) !important;
    border-color: var(--keso-card-border) !important;
}

/* ── Inline style override: sabit renk içeren style="" attribute'ları ─────
   Razor sayfalarında hardcoded hex renk kullanan inline style'ları,
   [style*="..."] attribute substring selector ile override ederiz.
   Bu sayede hiçbir .razor dosyasına dokunmadan dark mode çalışır.
   ─────────────────────────────────────────────────────────────────────── */

/* Koyu metin renkleri → dark modda açık renk */
[data-bs-theme="dark"] *[style*="color:#1e293b"],
[data-bs-theme="dark"] *[style*="color: #1e293b"] {
    color: var(--keso-text) !important;
}
[data-bs-theme="dark"] *[style*="color:#475569"],
[data-bs-theme="dark"] *[style*="color: #475569"] {
    color: var(--keso-text-muted) !important;
}
[data-bs-theme="dark"] *[style*="color:#64748b"],
[data-bs-theme="dark"] *[style*="color: #64748b"] {
    color: var(--keso-text-muted) !important;
}
[data-bs-theme="dark"] *[style*="color:#334155"],
[data-bs-theme="dark"] *[style*="color: #334155"] {
    color: #64748b !important;
}

/* Açık tint arka planlar → dark modda koyu yarı-saydam tint */
[data-bs-theme="dark"] *[style*="background:#eff6ff"] { background: rgba(59,130,246,.15)  !important; }
[data-bs-theme="dark"] *[style*="background:#f0fdf4"] { background: rgba(34,197,94,.12)   !important; }
[data-bs-theme="dark"] *[style*="background:#f5f3ff"] { background: rgba(139,92,246,.15)  !important; }
[data-bs-theme="dark"] *[style*="background:#f0fdfa"] { background: rgba(20,184,166,.12)  !important; }
[data-bs-theme="dark"] *[style*="background:#fffbeb"] { background: rgba(245,158,11,.12)  !important; }
[data-bs-theme="dark"] *[style*="background:#fff7ed"] { background: rgba(251,146,60,.12)  !important; }
[data-bs-theme="dark"] *[style*="background:#fff1f2"] { background: rgba(251,113,133,.12) !important; }
[data-bs-theme="dark"] *[style*="background:#f8fafc"] { background: #1e293b              !important; }
[data-bs-theme="dark"] *[style*="background:#f1f5f9"] { background: #1e293b              !important; }

/* Açık border renkleri → dark modda koyu border */
[data-bs-theme="dark"] *[style*="border:1px solid #e2e8f0"],
[data-bs-theme="dark"] *[style*="border: 1px solid #e2e8f0"] {
    border-color: var(--keso-card-border) !important;
}
[data-bs-theme="dark"] *[style*="border:1px solid #e8edf5"],
[data-bs-theme="dark"] *[style*="border: 1px solid #e8edf5"] {
    border-color: var(--keso-card-border) !important;
}
[data-bs-theme="dark"] *[style*="border:1px solid #fde68a"] { border-color: rgba(245,158,11,.3)  !important; }
[data-bs-theme="dark"] *[style*="border:1px solid #fed7aa"] { border-color: rgba(251,146,60,.3)  !important; }
[data-bs-theme="dark"] *[style*="border:1px solid #fecdd3"] { border-color: rgba(251,113,133,.3) !important; }

/* Açık arka plan ile tablo satırları */
[data-bs-theme="dark"] *[style*="background:#fffbeb; border:1px solid #fde68a"],
[data-bs-theme="dark"] *[style*="background:#fff7ed; border:1px solid #fed7aa"],
[data-bs-theme="dark"] *[style*="background:#fff1f2; border:1px solid #fecdd3"] {
    border-color: rgba(255,255,255,.15) !important;
}

/* Inline background:#fff (tekil) */
[data-bs-theme="dark"] *[style="background:#fff"] { background: var(--keso-card-bg) !important; }

/* Semantik koyu renkler → dark modda açık varyantları */
[data-bs-theme="dark"] *[style*="color:#1d4ed8"] { color: #60a5fa !important; }
[data-bs-theme="dark"] *[style*="color:#2563eb"] { color: #60a5fa !important; }
[data-bs-theme="dark"] *[style*="color:#92400e"] { color: #fbbf24 !important; }
[data-bs-theme="dark"] *[style*="color:#9a3412"] { color: #fb923c !important; }
[data-bs-theme="dark"] *[style*="color:#7c3aed"] { color: #a78bfa !important; }
[data-bs-theme="dark"] *[style*="color:#0d9488"] { color: #2dd4bf !important; }
[data-bs-theme="dark"] *[style*="color:#047857"] { color: #34d399 !important; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1050;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
}

/* ── Sidebar overlay (mobile) ─────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
}
.sidebar-overlay.show { display: block; }
