/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
    --primary:        #4f46e5;
    --primary-hover:  #4338ca;
    --accent:         #06b6d4;
    --bg:             #f1f5f9;
    --bg-card:        #ffffff;
    --bg-sidebar:     #1e293b;
    --text:           #1e293b;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --sidebar-text:   #94a3b8;
    --sidebar-active: #e2e8f0;
    --sidebar-width:  260px;
    --topbar-height:  64px;
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --radius:         10px;
    --radius-sm:      6px;
}

[data-theme="dark"] {
    --bg:           #0f172a;
    --bg-card:      #1e293b;
    --text:         #e2e8f0;
    --text-muted:   #94a3b8;
    --border:       #334155;
    --bg-sidebar:   #0f172a;
    --shadow:       0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --shadow-md:    0 4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: background .2s, color .2s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .3s ease;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo img { height: 36px; }
.sidebar-logo span {
    display: block;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: -.3px;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-title {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
    font-size: 13.5px;
}
.sidebar-link:hover, .sidebar-link.active {
    background: rgba(255,255,255,.06);
    color: #fff;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.sidebar-username { color: #e2e8f0; font-size: 13px; font-weight: 500; }
.sidebar-role { font-size: 11px; color: var(--sidebar-text); }

/* ── Main Content ──────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s;
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow);
}
.topbar-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ── Page Content ──────────────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ── Stat Cards ────────────────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}
.stat-card-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 20px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary-custom:hover { opacity: .9; color: #fff; }
.btn-primary-custom:active { transform: scale(.98); }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrapper table { min-width: 480px; }

/* DataTables Bootstrap5 dark-mode uyumu */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--text-muted); font-size: 13px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-muted) !important;
    border-radius: var(--radius-sm) !important;
    border: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
}
table.dataTable thead th { border-bottom: 2px solid var(--border) !important; }
table.dataTable tbody tr { background: transparent; }
table.dataTable tbody tr:hover td { background: rgba(79,70,229,.06) !important; }
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after { opacity: .5; }

/* ── Status Badge ─────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    vertical-align: middle;
}
.status-badge-active      { background: rgba(34,197,94,.15);  color: #22c55e; }
.status-badge-pending     { background: rgba(245,158,11,.15); color: #f59e0b; }
.status-badge-moved       { background: rgba(249,115,22,.15); color: #f97316; }
.status-badge-error       { background: rgba(239,68,68,.15);  color: #ef4444; }
.status-badge-deactivated { background: rgba(100,116,139,.15);color: #94a3b8; }

/* Eski dot (geriye dönük uyumluluk) */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-dot.active  { background: #22c55e; }
.status-dot.pending { background: #f59e0b; }
.status-dot.error   { background: #ef4444; }

/* ── Stat Card: tıklanabilir & vurgu varyantları ──────────────────────── */
.stat-card-clickable {
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.stat-card-clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.stat-card-danger .stat-card-value { color: #ef4444; }
.stat-card-warn   .stat-card-value { color: #f59e0b; }
.stat-card-muted  .stat-card-value { color: #94a3b8; }

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge-plus    { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.badge-admin   { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; }
.badge-free    { background: var(--border); color: var(--text-muted); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}
.modal-header { border-bottom: 1px solid var(--border) !important; }
.modal-footer { border-top: 1px solid var(--border) !important; }
.modal-title  { color: var(--text) !important; }
.modal-body   { color: var(--text) !important; }
.btn-close    { filter: var(--btn-close-filter, none); }
[data-theme="dark"] .btn-close { filter: invert(1); }

/* ── Nav Tabs ──────────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--border) !important; }
.nav-tabs .nav-link { color: var(--text-muted) !important; border: none; }
.nav-tabs .nav-link.active { color: var(--primary) !important; border-bottom: 2px solid var(--primary) !important; background: transparent !important; }
.nav-tabs .nav-link:hover { color: var(--primary) !important; }

/* ── Plus Lock Overlay ─────────────────────────────────────────────────── */
.plus-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    z-index: 10;
    color: #fff;
    text-align: center;
    padding: 24px;
}
.plus-lock-overlay i { font-size: 36px; color: #f59e0b; margin-bottom: 12px; }
.plus-lock-overlay h5 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.plus-lock-overlay p  { font-size: 13px; color: rgba(255,255,255,.7); margin: 0; }

/* ── Form controls dark mode ───────────────────────────────────────────── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0f172a !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
[data-theme="dark"] input::placeholder { color: var(--text-muted); }
[data-theme="dark"] .input-group-text {
    background-color: #0f172a !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}

/* ── Auth Pages (split layout) ─────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
}
.auth-left {
    width: 45%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e1b4b 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 50px;
    color: #fff;
}
.auth-left-logo { margin-bottom: 32px; }
.auth-left-logo img { height: 44px; }
.auth-left h2 { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.auth-left p  { color: #94a3b8; font-size: 15px; line-height: 1.7; margin-bottom: 32px; }
.auth-feature { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.auth-feature-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(79,70,229,.2);
    display: flex; align-items: center; justify-content: center;
    color: #818cf8;
    font-size: 15px;
    flex-shrink: 0;
}
.auth-feature-text strong { display: block; font-size: 13px; font-weight: 600; }
.auth-feature-text span   { font-size: 12px; color: #94a3b8; }

.auth-right {
    flex: 1;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0,0,0,.07);
    padding: 36px 32px;
}
.auth-card h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; color: #1e293b; }
.auth-card .subtitle { font-size: 13px; color: #64748b; margin-bottom: 28px; }
.btn-auth-submit {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-auth-submit:hover { opacity: .9; }

/* ── Landing Page ──────────────────────────────────────────────────────── */
.landing-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 40%, #1e1b4b 100%);
    color: #fff;
    padding: 100px 0 80px;
    text-align: center;
}
.landing-hero h1 { font-size: 48px; font-weight: 800; margin-bottom: 16px; line-height: 1.1; }
.landing-hero p  { font-size: 18px; color: #94a3b8; max-width: 560px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    padding: 13px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px;
    transition: opacity .15s;
}
.btn-hero-primary:hover { opacity: .9; color: #fff; }
.btn-hero-secondary {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    padding: 13px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px;
    transition: background .15s;
}
.btn-hero-secondary:hover { background: rgba(255,255,255,.15); color: #fff; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 60px 0;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}
.feature-card h5 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.feature-card p  { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; }

.steps-section { padding: 60px 0; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 32px; margin-top: 32px; }
.step-item { text-align: center; }
.step-number {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.step-item h5 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.step-item p  { font-size: 13px; color: var(--text-muted); margin: 0; }

.stats-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 40px 0;
    text-align: center;
}
.stats-bar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.stat-item-number { font-size: 36px; font-weight: 800; color: #fff; }
.stat-item-label  { font-size: 13px; color: rgba(255,255,255,.8); margin-top: 4px; }

.cta-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    margin: 60px 0;
}
.cta-section h2 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.cta-section p  { color: var(--text-muted); font-size: 15px; margin-bottom: 28px; }

.landing-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 48px 0 24px;
}
.landing-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}
.landing-footer h6 { color: #e2e8f0; font-weight: 600; margin-bottom: 12px; }
.landing-footer a { color: #94a3b8; font-size: 13px; display: block; margin-bottom: 8px; }
.landing-footer a:hover { color: #e2e8f0; }
.landing-footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 20px;
    font-size: 12px;
    text-align: center;
}

/* ── Hamburger (mobile) ────────────────────────────────────────────────── */
.btn-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    align-items: center;
}

/* ── Table dark mode (Bootstrap 5 override) ────────────────────────────── */
[data-theme="dark"] .table {
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255,255,255,.02);
    --bs-table-hover-bg: rgba(79,70,229,.07);
    --bs-table-hover-color: var(--text);
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--bg-card);
    color: var(--text);
    border-bottom-color: var(--border);
    box-shadow: none;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(79,70,229,.07);
    color: var(--text);
}
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table thead td {
    background-color: #0f172a;
    color: var(--text-muted);
    border-bottom-color: var(--border);
}

/* ── DataTables dark mode ──────────────────────────────────────────────── */
[data-theme="dark"] .dataTables_wrapper,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter label,
[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate { color: var(--text-muted); }
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: #0f172a;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 4px;
    padding: 3px 6px;
}
[data-theme="dark"] .dataTables_paginate .paginate_button {
    color: var(--text-muted) !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
}
[data-theme="dark"] .dataTables_paginate .paginate_button:hover {
    background: rgba(79,70,229,.15) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

/* ── Impersonation Banner ───────────────────────────────────────────────── */
.impersonate-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1c1400;
    text-align: center;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
body.impersonating .sidebar {
    top: 38px;
    height: calc(100vh - 38px);
}
body.impersonating .main-content {
    padding-top: 38px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .btn-hamburger { display: flex; }
}

@media (max-width: 768px) {
    .auth-left { display: none; }
    .auth-right { padding: 24px 16px; }
    .landing-hero h1 { font-size: 32px; }
    .landing-footer-grid { grid-template-columns: 1fr; gap: 24px; }
    /* Tablo: NS sütunlarını gizle */
    .col-ns { display: none !important; }
    /* Logs: mesaj ve ip sütunlarını gizle */
    .col-log-msg { display: none !important; }
    .col-log-ip  { display: none !important; }
}

@media (max-width: 576px) {
    /* Buton label metinlerini gizle, sadece ikon kalsın */
    .btn-lbl { display: none !important; }
    /* Aksiyon butonlarını daha küçük yap */
    #domainsTable .btn { padding: 3px 6px; font-size: 12px; }
    /* Tablo font küçültme */
    .table-wrapper td, .table-wrapper th { font-size: 12px; padding: 6px 8px; }
}
