/* ============================================================
   OpsDashboard teması — modern admin görünümü
   (açık sidebar + açık içerik + parlak mavi primary,
    nötr gri skala ve ince kenarlıklarla)
   ============================================================ */

:root {
    /* Marka / primary */
    --brand: #2970ff;
    --brand-hover: #155eef;
    --brand-active: #004eeb;

    /* Nötr gri skala */
    --gray-25: #fcfcfd;
    --gray-50: #f9fafb;
    --gray-100: #f2f4f7;
    --gray-200: #eaecf0;
    --gray-300: #d0d5dd;
    --gray-400: #98a2b3;
    --gray-500: #667085;
    --gray-600: #475467;
    --gray-700: #344054;
    --gray-800: #1d2939;
    --gray-900: #101828;

    /* Durum renkleri (yumuşak eyris tonları) */
    --ok: #12b76a;
    --ok-strong: #067647;
    --ok-soft: #ecfdf3;
    --ok-border: #abefc6;
    --warn: #f79009;
    --warn-strong: #b54708;
    --warn-soft: #fffaeb;
    --warn-border: #fedf89;
    --err: #f04438;
    --err-strong: #b42318;
    --err-soft: #fef3f2;
    --err-border: #fecdca;
    --info: #2e90fa;
    --info-strong: #175cd3;
    --info-soft: #eff8ff;
    --info-border: #b2ddff;

    /* Bootstrap değişken override'ları (5.3) */
    --bs-primary: #2970ff;
    --bs-primary-rgb: 41, 112, 255;
    --bs-link-color: #2970ff;
    --bs-link-color-rgb: 41, 112, 255;
    --bs-link-hover-color: #155eef;
    --bs-secondary-rgb: 102, 112, 133;
    --bs-success: #12b76a;
    --bs-success-rgb: 18, 183, 105;
    --bs-danger: #f04438;
    --bs-danger-rgb: 240, 68, 56;
    --bs-warning: #f79009;
    --bs-warning-rgb: 247, 144, 9;
    --bs-info: #2e90fa;
    --bs-info-rgb: 46, 144, 250;

    --bs-body-bg: #f7f8fa;
    --bs-body-color: #475467;
    --bs-body-color-rgb: 71, 84, 103;
    --bs-border-color: #eaecf0;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;

    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: 0.9375rem;

    /* Layout ölçüleri */
    --sidebar-width: 264px;
    --topbar-height: 60px;
    --sidebar-bg: #faf9f7;
}

html { font-size: 15px; }
html, body { height: 100%; }

body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, h6 { color: var(--gray-900); }

/* ---------- Kabuk / grid ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--gray-200);
    color: var(--gray-500);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    height: var(--topbar-height);
    padding: 0 1.25rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--gray-900);
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.sidebar-brand:hover { color: var(--gray-900); }

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    background: var(--brand);
    box-shadow: 0 2px 6px rgba(41, 112, 255, 0.3);
}

.sidebar-scroll {
    overflow-y: auto;
    padding: 0.85rem 0.75rem 1rem;
    flex: 1 1 auto;
}

.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

.sidebar-heading {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    margin-top: 0.85rem;
    list-style: none;
}
.sidebar-heading:first-child { margin-top: 0; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--gray-500);
    padding: 0.55rem 0.8rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.3;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar .nav-link .nav-ico {
    width: 1.35rem;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background-color: var(--gray-100);
    color: var(--gray-800);
}

.sidebar .nav-link.active {
    background-color: #fff;
    color: var(--brand);
    box-shadow: inset 3px 0 0 var(--brand), 0 1px 2px rgba(16, 24, 40, 0.06);
}

.sidebar .nav-link .nav-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--gray-400);
}

.sidebar .nav-link.disabled { color: var(--gray-400); opacity: 0.65; }

.sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1rem;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--gray-500);
    font-size: 1.15rem;
    line-height: 1;
}
.btn-icon:hover { background: var(--gray-100); }

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--bs-border-color);
    background: #fff;
    border-radius: 999px;
    padding: 0.25rem 0.85rem 0.25rem 0.35rem;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.875rem;
}
.user-btn:hover { background: var(--gray-50); }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ---------- İçerik ---------- */
.content-area {
    flex: 1 1 auto;
    padding: 1.5rem;
    min-width: 0;
}

/* ---------- Kartlar ---------- */
.card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 600;
    color: var(--gray-800);
    padding: 0.85rem 1.1rem;
}
.card-footer { background: var(--gray-25); border-top: 1px solid var(--gray-100); }

.env-card { transition: box-shadow 0.15s ease, transform 0.15s ease; }
.env-card:hover {
    box-shadow: 0 12px 24px -6px rgba(16, 24, 40, 0.1);
    transform: translateY(-2px);
}

/* ---------- Butonlar ---------- */
.btn { border-radius: 0.5rem; font-weight: 500; }

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-hover);
    --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-active-bg: var(--brand-active);
    --bs-btn-active-border-color: var(--brand-active);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.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);
}

/* Form odak rengi markaya uysun */
.form-control:focus,
.form-select:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 0.25rem rgba(41, 112, 255, 0.15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { --bs-breadcrumb-divider-color: var(--gray-400); margin-bottom: 0; }
.breadcrumb-item a { color: var(--gray-500); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--brand); }
.breadcrumb-item.active { color: var(--gray-700); }

/* ---------- Tablolar ---------- */
.table > thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom-color: var(--bs-border-color);
}

/* ---------- Rozetler ---------- */
.badge { font-weight: 600; border-radius: 999px; }
.badge.text-bg-secondary {
    background: var(--gray-100) !important;
    color: var(--gray-600) !important;
}

/* ---------- Şema diff renkleri (yumuşak tonlar) ---------- */
/* Satır arka planı: Bootstrap'ın kendi --bs-table-bg mekanizması ile hafif tint */
tr.diff-add { --bs-table-bg: rgba(18, 183, 105, 0.06); }
tr.diff-del { --bs-table-bg: rgba(46, 144, 250, 0.06); }
tr.diff-chg { --bs-table-bg: rgba(247, 144, 9, 0.07); }

tr.diff-add > *:first-child { box-shadow: inset 3px 0 0 rgba(18, 183, 105, 0.5); }
tr.diff-del > *:first-child { box-shadow: inset 3px 0 0 rgba(46, 144, 250, 0.5); }
tr.diff-chg > *:first-child { box-shadow: inset 3px 0 0 rgba(247, 144, 9, 0.55); }

/* Lejant / durum rozetleri: okunabilir yumuşak renk */
.badge.diff-add { background: var(--ok-soft); color: var(--ok-strong); border: 1px solid var(--ok-border); }
.badge.diff-del { background: var(--info-soft); color: var(--info-strong); border: 1px solid var(--info-border); }
.badge.diff-chg { background: var(--warn-soft); color: var(--warn-strong); border: 1px solid var(--warn-border); }

/* Ok (caret) — yalnızca bu hücre accordion'u açar */
.toggle-cell { cursor: pointer; width: 2rem; user-select: none; }
.toggle-caret {
    display: inline-block;
    color: var(--gray-400);
    transition: transform 0.15s ease;
}
.toggle-cell:hover .toggle-caret { color: var(--brand); }
.toggle-cell[aria-expanded="true"] .toggle-caret { transform: rotate(90deg); }

/* Kolon ayrıntı bloğu: açık, sakin */
.col-detail { background: var(--gray-50); }
.col-detail .table { --bs-table-bg: transparent; margin-bottom: 0; }
.col-detail thead th {
    background: var(--gray-100);
    color: var(--gray-500);
    border-bottom-color: var(--gray-200);
}
.col-detail .table > tbody > tr > td { border-color: var(--gray-100); }

/* ---------- Bağlantı ucu paneli (Şema / Veri karşılaştırma) ---------- */
.endpoint-panel {
    height: 100%;
    padding: 1rem 1.1rem 1.15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: #fff;
}
/* SOL = kaynak (mavi), SAĞ = hedef (amber, "dikkatli" ton) */
.endpoint-panel--left {
    border-top: 3px solid var(--brand);
    background: linear-gradient(180deg, rgba(41, 112, 255, 0.045), rgba(41, 112, 255, 0) 130px);
}
.endpoint-panel--right {
    border-top: 3px solid var(--warn);
    background: linear-gradient(180deg, rgba(247, 144, 9, 0.05), rgba(247, 144, 9, 0) 130px);
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.endpoint-role {
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}
.endpoint-panel--left .endpoint-role { background: #eff4ff; color: var(--brand-hover); }
.endpoint-panel--right .endpoint-role { background: var(--warn-soft); color: var(--warn-strong); }

/* Alan etiketleri: daha koyu ve okunur */
.endpoint-panel .form-label { color: var(--gray-600); font-weight: 600; }

/* Kayıtlı bağlantı seçici — göze çarpan vurgulu kutu */
.conn-picker-wrap {
    padding: 0.5rem 0.65rem 0.6rem;
    margin-bottom: 0.85rem;
    border-radius: 0.5rem;
    border: 1px dashed #b2ccff;
    background: #eff4ff;
}
.endpoint-panel--right .conn-picker-wrap { border-color: var(--warn-border); background: var(--warn-soft); }
.conn-picker-wrap .form-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
    color: var(--gray-700);
    font-weight: 700;
}
.conn-picker-wrap .conn-picker { border-color: var(--gray-300); font-weight: 500; }

/* ---------- Sağlık kontrolü listesi ---------- */
.health-list { border-top: 1px solid var(--bs-border-color); }

.health-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--gray-100);
}
.health-item:last-child { border-bottom: 0; }
.health-item:hover { background: var(--gray-25); }

/* Durum noktası — renk .is-* sınıfından gelir */
.health-dot {
    width: 10px;
    height: 10px;
    margin-top: 0.42rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--gray-400);
    box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.18);
}
.health-item.is-up .health-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 183, 105, 0.16); }
.health-item.is-warn .health-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(247, 144, 9, 0.16); }
.health-item.is-down .health-dot { background: var(--err); box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.16); }

.health-main { flex: 1 1 auto; min-width: 0; }

.health-title {
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.health-title .badge { font-size: 0.68rem; }

.health-sub {
    font-size: 0.8rem;
    color: var(--gray-500);
    word-break: break-all;
}
.health-sub a { color: var(--gray-500); text-decoration: none; }
.health-sub a:hover { color: var(--brand); text-decoration: underline; }
.health-sub code { color: var(--gray-600); }

.health-error {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--err-strong);
    background: var(--err-soft);
    border-left: 3px solid rgba(240, 68, 56, 0.5);
    border-radius: 0.25rem;
    padding: 0.3rem 0.5rem;
    word-break: break-word;
}
.health-error.is-muted {
    color: var(--gray-500);
    background: var(--gray-100);
    border-left-color: var(--gray-300);
}

/* Yanıt gövdesinden çıkarılan alanlar / sunucu bilgileri */
.health-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    font-size: 0.75rem;
    line-height: 1.5;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--gray-50);
    max-width: 100%;
}
.chip-k { color: var(--gray-400); font-weight: 500; }
.chip-v { color: var(--gray-700); font-weight: 600; overflow-wrap: anywhere; }

/* Ham yanıt gövdesi — istendiğinde açılır */
.health-raw { margin-top: 0.45rem; }
.health-raw > summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--gray-400);
    width: fit-content;
}
.health-raw > summary:hover { color: var(--brand); }
.health-raw pre {
    margin: 0.35rem 0 0;
    padding: 0.5rem 0.65rem;
    background: var(--gray-50);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    font-size: 0.72rem;
    color: var(--gray-600);
    max-height: 12rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.health-metrics {
    flex-shrink: 0;
    text-align: right;
    min-width: 6.5rem;
}
.health-latency {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    font-variant-numeric: tabular-nums;
    margin-top: 0.3rem;
}
.health-code { font-size: 0.72rem; color: var(--gray-400); }

/* Yenileme sırasında panel soluklaşır */
[data-health-panel] { transition: opacity 0.15s ease; }
.is-refreshing [data-health-panel] { opacity: 0.55; }

@media (max-width: 575.98px) {
    .health-item { flex-wrap: wrap; }
    .health-metrics { text-align: left; margin-left: 1.85rem; }
}

/* ---------- SSL sertifikaları ---------- */
/* Sertifika satırları sağlık listesinin biçimini paylaşır; buradakiler ek parçalar. */
.cert-metrics { min-width: 7.5rem; }

/* Kalan gün — satırın en dikkat çeken bilgisi */
.cert-days {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
    color: var(--gray-700);
}
.cert-days.is-up { color: var(--ok); }
.cert-days.is-warn { color: var(--warn); }
.cert-days.is-down { color: var(--err); }
.cert-days.is-unknown { color: var(--gray-400); }

/* Ömür çubuğu: başlangıç → bitiş arasında bugünün konumu */
.cert-lifetime { margin-top: 0.6rem; max-width: 26rem; }
.cert-bar { height: 6px; background: var(--gray-100); border-radius: 999px; }
.cert-lifetime-dates {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
    font-variant-numeric: tabular-nums;
}

/* Ayrıntı panelindeki konu/veren/parmak izi tablosu */
.cert-detail-list {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.2rem 0.75rem;
    margin: 0.45rem 0 0;
    padding: 0.55rem 0.7rem;
    background: var(--gray-50);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    font-size: 0.75rem;
}
.cert-detail-list dt { color: var(--gray-400); font-weight: 500; }
.cert-detail-list dd { margin: 0; color: var(--gray-700); overflow-wrap: anywhere; }
.cert-detail-list code { color: var(--gray-600); font-size: 0.72rem; }

/* Üstteki özet kutuları */
.cert-stat .card-body { padding: 0.85rem 1rem; }
.cert-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
.cert-stat-label { font-size: 0.78rem; color: var(--gray-500); }

@media (max-width: 575.98px) {
    .cert-metrics { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
    .cert-lifetime { max-width: none; }
}

/* ---------- Mobil ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
    }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
}

/* ---------- Giriş sayfası ---------- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(160deg, #eff4ff 0%, #f7f8fa 45%, #f2f4f7 100%);
}
