:root {
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-soft: #eef2ff;
    --sidebar-bg: #0f172a;
    --sidebar-bg-active: rgba(99, 102, 241, .18);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #818cf8;
    --bg: #f5f6fb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, .04), 0 10px 15px rgba(15, 23, 42, .06);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

a {
    color: var(--brand);
}

/* ---------- App shell (sidebar + topbar) ---------- */

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .25s ease;
}

.sidebar.show {
    transform: translateX(0);
}

@media (min-width: 768px) {
    .sidebar {
        transform: none;
    }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 1030;
}

.sidebar-backdrop.show {
    display: block;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .5rem 1.25rem;
    color: #fff;
}

.sidebar-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), var(--sidebar-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: none;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    flex: 1;
}

.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    padding: .25rem .4rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    flex: none;
}

.sidebar-collapse-btn:hover {
    background: rgba(148, 163, 184, .12);
    color: #fff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    overflow-y: auto;
    flex: 1;
}

.sidebar-group-baslik {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    padding: .9rem .75rem .3rem;
    white-space: nowrap;
}

.sidebar-group-baslik:first-child {
    padding-top: .1rem;
}

/* ---------- Sidebar daraltilmis (ikon-only / "hamburger") mod ----------
   Sadece masaustu genisliginde (>=768px) anlamli - mobilde sidebar zaten
   acilip-kapanan bir overlay (bkz. .sidebar.show), daraltma orada karismasin. */
@media (min-width: 768px) {
    .app-shell.sidebar-collapsed .sidebar {
        width: 76px;
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .app-shell.sidebar-collapsed .sidebar-brand-text,
    .app-shell.sidebar-collapsed .sidebar-group-baslik,
    .app-shell.sidebar-collapsed .sidebar-footer,
    .app-shell.sidebar-collapsed .sidebar-nav a span {
        display: none;
    }

    .app-shell.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .app-shell.sidebar-collapsed .sidebar-nav a {
        justify-content: center;
        padding: .65rem;
    }

    .app-shell.sidebar-collapsed .app-main {
        margin-left: 76px;
    }
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.sidebar-nav a i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    flex: none;
}

.sidebar-nav a:hover {
    background: rgba(148, 163, 184, .08);
    color: #e2e8f0;
}

.sidebar-nav a.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-accent);
}

.sidebar-footer {
    color: #475569;
    font-size: .72rem;
    padding: .75rem .5rem 0;
    border-top: 1px solid rgba(148, 163, 184, .15);
    margin-top: .5rem;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .85rem 1.5rem;
}

.topbar-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex: none;
}

.topbar-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--sidebar-accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: none;
}

.topbar-brand-text {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.topbar-search-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 420px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .45rem .9rem;
}

.topbar-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 1050;
}

.topbar-search-results.show {
    display: block;
}

.topbar-search-results a {
    display: block;
    padding: .55rem .9rem;
    color: var(--text);
    text-decoration: none;
    font-size: .875rem;
}

.topbar-search-results a:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.topbar-search-bos {
    padding: .55rem .9rem;
    color: var(--text-muted);
    font-size: .85rem;
}

.topbar-search i {
    color: var(--text-muted);
    flex: none;
}

.topbar-search input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 0;
    font-size: .875rem;
    color: var(--text);
}

.topbar-search input::-webkit-search-cancel-button {
    cursor: pointer;
}

.topbar-spacer {
    flex: 1;
}

@media (max-width: 575.98px) {
    .topbar-brand-text {
        display: none;
    }
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: .875rem;
}

.user-role {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: .45rem .8rem;
    font-size: .85rem;
    font-weight: 600;
}

.btn-logout:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.content {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
}

@media (min-width: 768px) {
    .content {
        padding: 2rem;
    }
}

@media (max-width: 767.98px) {
    .app-main {
        margin-left: 0;
    }
}

/* ---------- Unauthenticated (login / 2FA) ---------- */

.auth-body {
    background: radial-gradient(circle at top, #eef2ff 0%, var(--bg) 55%);
}

.auth-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-footer {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: .8rem;
}

.login-card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto 1rem;
}

/* ---------- Component refinements ---------- */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card .card-title {
    font-weight: 700;
}

.table-responsive {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: .8rem 1rem;
}

/* .table-sm (yogun veri gridleri - erisim listeleri modallari) Bootstrap'in
   kompakt dolgusunu korusun, yukaridaki genel kuralin altina ezilmesin. */
.table-sm > :not(caption) > * > * {
    padding: .45rem .6rem;
    font-size: .8125rem;
}

.table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table td, .table th {
    vertical-align: middle;
    border-color: var(--border);
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .875rem;
}

.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-outline-primary {
    color: var(--brand);
    border-color: var(--brand);
}

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

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

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem var(--brand-soft);
}

.badge {
    font-weight: 600;
    letter-spacing: .01em;
    border-radius: 999px;
    padding: .4em .7em;
}

.badge-online {
    background-color: #16a34a;
}

.badge-offline {
    background-color: #dc2626;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    border-left-width: 4px;
}

.alert-danger {
    border-left-color: #dc2626;
}

.alert-success {
    border-left-color: #16a34a;
}

.alert-warning {
    border-left-color: #d97706;
}

.secret-box {
    font-family: "Courier New", monospace;
    word-break: break-all;
    background: #0f172a;
    color: #e2e8f0;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
}

.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.th-sortable:hover {
    background-color: rgba(0, 0, 0, .03);
}

.th-filtre input {
    font-weight: normal;
}

.modal-content {
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow-md);
}

/* Sutun sayisi fazla olan veri gridleri (erisim listeleri) icin - modal-xl'den
   daha genis, ekrana daha cok sutun sigsin diye. */
.modal-genis {
    max-width: min(1600px, 95vw);
}

/* Genis/yatay kaydirilan tablolarda ilk kolonu (ornegin Program Adi / Oracle
   User) solda sabit tutar, saga kaydirinca hangi satirda oldugunuzu
   kaybetmeyesiniz diye. */
.tablo-sabit-ilk-kolon th:first-child,
.tablo-sabit-ilk-kolon td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 4px -2px rgba(15, 23, 42, .12);
}

.tablo-sabit-ilk-kolon td:first-child {
    background-color: var(--surface);
}

.tablo-sabit-ilk-kolon thead th:first-child {
    z-index: 3;
    background-color: #f8fafc;
}
