/**
 * MCN Digital & Çorap Kampanyası - Unified Admin Theme & Dark Mode
 * Version: 2.0.0
 */

/* ==========================================================================
   1. CSS Custom Properties / Design Tokens
   ========================================================================== */
:root {
    --adm-bg: #f8fafc;
    --adm-surface: #ffffff;
    --adm-surface-muted: #f1f5f9;
    --adm-surface-card: #ffffff;
    --adm-border: #e2e8f0;
    --adm-border-subtle: #edf2f7;
    --adm-text: #0f172a;
    --adm-text-muted: #64748b;
    --adm-text-subtle: #94a3b8;
    --adm-primary: #2563eb;
    --adm-primary-hover: #1d4ed8;
    --adm-primary-light: #eff6ff;
    --adm-success: #16a34a;
    --adm-success-light: #f0fdf4;
    --adm-warning: #d97706;
    --adm-warning-light: #fffbeb;
    --adm-danger: #dc2626;
    --adm-danger-light: #fef2f2;
    --adm-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --adm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --adm-radius: 12px;
    --adm-radius-sm: 8px;
    --adm-radius-lg: 16px;
    --adm-table-hover: #f8fafc;
    --adm-input-bg: #ffffff;
    --adm-input-border: #cbd5e1;
}

[data-bs-theme="dark"] {
    --adm-bg: #0b0f19;
    --adm-surface: #111827;
    --adm-surface-muted: #1e293b;
    --adm-surface-card: #151d2e;
    --adm-border: #1f293d;
    --adm-border-subtle: #1e293b;
    --adm-text: #f8fafc;
    --adm-text-muted: #94a3b8;
    --adm-text-subtle: #64748b;
    --adm-primary: #3b82f6;
    --adm-primary-hover: #60a5fa;
    --adm-primary-light: rgba(59, 130, 246, 0.15);
    --adm-success: #22c55e;
    --adm-success-light: rgba(34, 197, 94, 0.15);
    --adm-warning: #f59e0b;
    --adm-warning-light: rgba(245, 158, 11, 0.15);
    --adm-danger: #ef4444;
    --adm-danger-light: rgba(239, 68, 68, 0.15);
    --adm-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.2);
    --adm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --adm-table-hover: #1e293b;
    --adm-input-bg: #111827;
    --adm-input-border: #334155;
}

/* ==========================================================================
   2. Base Body & Typography
   ========================================================================== */
body {
    background-color: var(--adm-bg) !important;
    color: var(--adm-text) !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: -0.01em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   3. Bootstrap 5 Dark Overrides
   ========================================================================== */
[data-bs-theme="dark"] body {
    background-color: #0b0f19 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .stats-kpi,
[data-bs-theme="dark"] .amount-kpi-card,
[data-bs-theme="dark"] .amount-panel,
[data-bs-theme="dark"] .filter-card,
[data-bs-theme="dark"] .bg-white {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
    background-color: #111827 !important;
    border-color: #1f293d !important;
    color: #f1f5f9 !important;
}

/* Tablolar */
[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #cbd5e1 !important;
    --bs-table-border-color: #1f293d !important;
    color: #cbd5e1 !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .table thead,
[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] thead.table-light,
[data-bs-theme="dark"] thead.table-light th {
    background-color: #111827 !important;
    color: #94a3b8 !important;
    border-bottom: 2px solid #1f293d !important;
    border-top: none !important;
}

[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    border-color: #1f293d !important;
    background-color: transparent !important;
    color: inherit !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover td,
[data-bs-theme="dark"] .table-hover tbody tr:hover th {
    background-color: #1a2333 !important;
}

[data-bs-theme="dark"] .table-light {
    background-color: #111827 !important;
    color: #94a3b8 !important;
}

/* Form Elemanları */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] textarea {
    background-color: #111827 !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #151d2e !important;
    border-color: #3b82f6 !important;
    color: #f8fafc !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

/* Akordeon & Modallar */
[data-bs-theme="dark"] .accordion-item {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .accordion-button {
    background-color: #111827 !important;
    color: #f8fafc !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #1a2333 !important;
    color: #60a5fa !important;
    box-shadow: inset 0 -1px 0 #1f293d !important;
}

[data-bs-theme="dark"] .accordion-body {
    background-color: #151d2e !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    background-color: #111827 !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Text & Renk Yardımcıları */
[data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] small.text-muted,
[data-bs-theme="dark"] .muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #111827 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] hr {
    border-color: #1f293d !important;
    opacity: 0.8;
}

/* Sayfalama */
[data-bs-theme="dark"] .page-link {
    background-color: #111827 !important;
    border-color: #1f293d !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #0b0f19 !important;
    border-color: #1f293d !important;
    color: #64748b !important;
}

/* ==========================================================================
   4. Unified Topbar & Header Components
   ========================================================================== */
.page-shell {
    max-width: 1720px;
    margin: 0 auto;
}

.topbar,
header.top,
header.topbar {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 14px 20px;
    box-shadow: var(--adm-shadow);
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] header.top,
[data-bs-theme="dark"] header.topbar {
    background: #111827 !important;
    border-color: #1f293d !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

.title-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

[data-bs-theme="dark"] .title-mark {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.badge-stat {
    font-size: 0.88rem;
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: default;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: var(--adm-text);
}

[data-bs-theme="dark"] .badge-stat {
    background: #111827 !important;
    border-color: #1f293d !important;
    color: #e2e8f0 !important;
}

/* ==========================================================================
   5. Custom Non-Bootstrap Pages Dark Overrides
   (canli-takip, ziyaretci-raporu, ziyaretci-gecmisi, color-management, etc.)
   ========================================================================== */
[data-bs-theme="dark"] .app,
[data-bs-theme="dark"] .shell,
[data-bs-theme="dark"] .wrap,
[data-bs-theme="dark"] .page,
[data-bs-theme="dark"] main {
    background-color: transparent !important;
    color: #cbd5e1 !important;
}

/* Sidebar & Menüler */
[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] aside {
    background: #111827 !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .sidebar a,
[data-bs-theme="dark"] .nav a {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .sidebar a:hover,
[data-bs-theme="dark"] .sidebar a.active,
[data-bs-theme="dark"] .nav a:hover,
[data-bs-theme="dark"] .nav a.active {
    background: #1e293b !important;
    color: #60a5fa !important;
}

/* Canlı Takip & Kart Blokları */
[data-bs-theme="dark"] .stream-box,
[data-bs-theme="dark"] .live-feed,
[data-bs-theme="dark"] .item-row,
[data-bs-theme="dark"] .order-box,
[data-bs-theme="dark"] .cart-box,
[data-bs-theme="dark"] .feed-item,
[data-bs-theme="dark"] .hero,
[data-bs-theme="dark"] .funnel-step,
[data-bs-theme="dark"] .main-panel,
[data-bs-theme="dark"] .table-box,
[data-bs-theme="dark"] .box {
    background: #151d2e !important;
    border-color: #1f293d !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .live-dot {
    box-shadow: 0 0 10px #22c55e;
}

/* Buton Düzenlemeleri */
.btn-theme-toggle {
    transition: all 0.2s ease;
    border-radius: var(--adm-radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .btn-outline-dark {
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   6. Streamlined Admin UI Enhancements
   ========================================================================== */
.admin-compact-header {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 12px 18px;
    box-shadow: var(--adm-shadow);
}
.kpi-compact-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    padding: 12px 16px;
    box-shadow: var(--adm-shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-compact-card:hover {
    box-shadow: var(--adm-shadow-md);
}
.kpi-compact-val {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--adm-text);
}
.kpi-compact-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--adm-text-muted);
}
.kpi-compact-sub {
    font-size: 0.78rem;
    color: var(--adm-text-muted);
    margin-top: 4px;
}
.status-tabs-container {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 9999px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--adm-text-muted);
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    white-space: nowrap;
    transition: all 0.15s ease;
}
.status-pill:hover {
    color: var(--adm-primary);
    border-color: var(--adm-primary);
    background: var(--adm-surface-muted);
}
.status-pill.active {
    background: var(--adm-primary) !important;
    border-color: var(--adm-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.status-pill-count {
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.08);
    font-weight: 700;
}
.status-pill.active .status-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}
.status-pill.status-pill-abandoned.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
}
[data-bs-theme="dark"] .status-pill {
    background: #151d2e !important;
    border-color: #1f293d !important;
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .status-pill:hover {
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
    background: #1e293b !important;
}
[data-bs-theme="dark"] .status-pill-count {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}
[data-bs-theme="dark"] .kpi-compact-card {
    background: #151d2e !important;
    border-color: #1f293d !important;
}
[data-bs-theme="dark"] .kpi-compact-val {
    color: #f8fafc !important;
}
[data-bs-theme="dark"] .admin-compact-header {
    background: #111827 !important;
    border-color: #1f293d !important;
}
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}
[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}
[data-bs-theme="dark"] .dropdown-divider {
    border-color: #1f293d !important;
}

/* Mobil Ekran Kosesi Hizli Yenileme Butonu (FAB) */
.mobile-refresh-btn {
    position: fixed;
    bottom: 22px;
    left: 18px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1040;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.mobile-refresh-btn:active {
    transform: scale(0.90);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.mobile-refresh-btn .refresh-icon {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-refresh-btn.spinning .refresh-icon {
    transform: rotate(360deg);
}
[data-bs-theme="dark"] .mobile-refresh-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   7. Panel Drawers, Filter Bars, Tables & Modern Components
   (kar-zarar-panel, color-management, review-admin, kargo-panel extensions)
   ========================================================================== */
[data-bs-theme="dark"] .settings-drawer,
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .modern-card-table,
[data-bs-theme="dark"] .modern-card-table .bg-white,
[data-bs-theme="dark"] .panel-drawer {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .settings-drawer {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .settings-drawer .text-dark,
[data-bs-theme="dark"] .filter-bar .text-dark,
[data-bs-theme="dark"] .modern-card-table .text-dark,
[data-bs-theme="dark"] .topbar .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .settings-drawer .bg-light,
[data-bs-theme="dark"] .modern-card-table .bg-light {
    background-color: #1a2333 !important;
    color: #e2e8f0 !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .modern-card-table table th {
    background-color: #111827 !important;
    color: #94a3b8 !important;
    border-bottom-color: #1f293d !important;
}

[data-bs-theme="dark"] .modern-card-table table td {
    border-bottom-color: #1f293d !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .modern-card-table table tr:hover td {
    background-color: #1a2333 !important;
}

[data-bs-theme="dark"] .modern-card-table table tr.table-light td {
    background-color: #111827 !important;
    color: #f8fafc !important;
    border-color: #1f293d !important;
}

/* Tabs & Preset Pills */
[data-bs-theme="dark"] .custom-pills {
    background: #111827 !important;
    border: 1px solid #1f293d !important;
}

[data-bs-theme="dark"] .custom-pills .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .custom-pills .nav-link:hover {
    color: #38bdf8 !important;
}

[data-bs-theme="dark"] .custom-pills .nav-link.active {
    background: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .date-preset-pill.btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .date-preset-pill.btn-outline-secondary:hover {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #38bdf8 !important;
}

[data-bs-theme="dark"] .date-preset-pill.btn-primary {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .metric-group-title {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .metric-group-title::after {
    background: #1f293d !important;
}

[data-bs-theme="dark"] .loading-box {
    background: #151d2e !important;
    color: #f8fafc !important;
    border: 1px solid #1f293d !important;
}

/* Color Management & Review Admin Dark Extensions */
[data-bs-theme="dark"] .add-panel {
    background-color: #151d2e !important;
    border-color: #1f293d !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .upload {
    background-color: #111827 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .actions {
    background-color: rgba(21, 29, 46, 0.94) !important;
    border-color: #1f293d !important;
}

[data-bs-theme="dark"] .add-check {
    background-color: #111827 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .tabs a.on {
    background-color: #168447 !important;
    color: #ffffff !important;
    border-color: #168447 !important;
}

/* Floating Action Bar at Top */
#floatingBar {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
}

[data-bs-theme="dark"] #floatingBar {
    background: rgba(17, 24, 39, 0.96) !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65) !important;
}
