/* =========================================================
   Juniper IP Anons Paneli - Satcore marka paleti (KOYU TEMA)
   Degerler dogrudan satcore.net :root degiskenlerinden alinmistir:
   --bg-sidebar-*:#1e0c18/#311525/#3f1d3c --gold:#c99762 --cream:#e3c9ae
   Satcore aslinda koyu, mor/plum tonlarinda bir marka (yesil/teal DEGIL).
   Sadece NAVIGASYON (sidebar) ve giris ekrani bu mor/plum degradeyi
   kullanir; panelin geri kalani (icerik, kartlar, tablolar) goz yormayan,
   noturlesmis cok koyu bir zeminde (ayni renk ailesinden, dusuk doygunluk)
   sunulur. Vurgu renkleri (altin/bronz, krem, mor rozet) ayni kalir.
   ========================================================= */

:root {
    /* Sidebar / giris ekrani icin marka degradesi (satcore.net ile birebir) */
    --bg-sidebar-1: #1e0c18;
    --bg-sidebar-2: #311525;
    --bg-sidebar-3: #3f1d3c;

    /* Panelin genelinde kullanilan NOTR KOYU zeminler (mor DEGIL, cok dusuk
       doygunlukta, ayni renk ailesinden bir "dark mode" arka plan) */
    --bg-page: #131019;
    --bg-surface: #191521;
    --bg-card: #1d1826;
    --bg-card-hover: #26202f;

    /* Marka vurgu renkleri (satcore.net ile birebir) */
    --purple: #572947;
    --purple-light: #6d3559;
    --gold: #c99762;
    --gold-600: #b3814e;
    --gold-100: rgba(201, 151, 98, 0.16);
    --gold-a08: rgba(201, 151, 98, 0.08);
    --gold-a30: rgba(201, 151, 98, 0.30);
    --cream: #e3c9ae;

    /* Metin renkleri */
    --text-primary: #efe3d6;
    --text-heading: #e3c9ae;
    --text-secondary: #c3a68d;
    --text-muted: #8d7369;

    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);

    /* Altin/krem vurgu zeminlerinin uzerindeki metin icin (kontrast amacli,
       yine paletin en koyu tonu kullanilir - renk paleti degismez) */
    --text-on-gold: var(--bg-sidebar-1);

    --success: #5fb98c;
    --success-bg: rgba(95, 185, 140, 0.14);
    --danger: #e2685c;
    --danger-bg: rgba(226, 104, 92, 0.14);
    --warning: #d9a34d;
    --warning-bg: rgba(217, 163, 77, 0.14);

    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 16px 40px rgba(10, 4, 8, 0.45);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.5;
}

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

/* ---------- Layout ---------- */

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

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(155deg, var(--bg-sidebar-1) 0%, var(--bg-sidebar-2) 45%, var(--bg-sidebar-3) 100%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 26px 10px;
}

.brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: var(--text-on-gold);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.brand .brand-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.2px;
    color: var(--cream);
}

.brand .brand-sub {
    font-size: 11px;
    color: rgba(239, 227, 214, 0.5);
    margin-top: 1px;
}

.device-context {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px 12px 10px 12px;
    /* margin-top: auto -> sidebar bir flex kolonu; bu, aradaki tüm boş
       alanı üstte biriktirip cihaz/Commit/Compare/Senkronize bloğunu
       gerçekten en alta (telif hakkı satırının hemen üstüne) sabitler. */
    margin: auto 2px 16px 2px;
}

.device-context-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: rgba(239, 227, 214, 0.55);
    margin-bottom: 6px;
}

.device-context select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    font-size: 12.5px;
    padding: 7px 9px;
}

.device-context select:focus {
    border-color: var(--gold);
    box-shadow: none;
}

.device-context-empty {
    font-size: 12px;
    color: rgba(239, 227, 214, 0.6);
}

.device-context-empty a { color: var(--gold); }

.device-context-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.device-context-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 7px 8px;
    font-size: 12px;
}

.device-context-sync {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 6px;
    padding: 7px 8px;
    font-size: 12px;
}

.device-context-discard {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: rgba(226, 104, 92, 0.85);
    font-size: 11px;
    text-align: center;
    margin-top: 8px;
    padding: 4px;
    cursor: pointer;
}
.device-context-discard:hover { color: var(--danger); text-decoration: underline; }

.nav-group {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(239, 227, 214, 0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cream);
}

.nav-link.active {
    background: var(--gold);
    color: var(--text-on-gold);
    font-weight: 700;
}

.nav-icon {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg { display: block; }

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(239, 227, 214, 0.45);
}

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

.topbar {
    height: 64px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--text-heading);
}

/* Mobil navigasyon: topbar'daki hamburger + sidebar arkaplan karartmasi.
   Genis ekranda gizli; @media (max-width: 860px) icinde gorunur olur. */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}
.nav-toggle:hover { color: var(--gold); border-color: var(--gold); }
.nav-toggle svg { display: block; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 4, 8, 0.6);
    z-index: 45;
}
.sidebar-backdrop.open { display: block; }

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar .user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold-100);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.content {
    padding: 26px 28px 60px 28px;
    flex: 1;
    background: var(--bg-page);
}

/* ---------- Cards ---------- */

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

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 15.5px;
    margin: 0;
    font-weight: 700;
    color: var(--text-heading);
}

.card-header .hint {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
    max-width: 640px;
}

.card-body { padding: 20px 22px; }

/* IP tablosu: filtrelenmis (gorunen) satirlara toplu prefix-list ekle/cikar bari */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
    flex-wrap: wrap;
    padding: 12px 22px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.bulk-bar-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bulk-bar-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-heading);
}
.bulk-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-heading);
    margin-top: 6px;
}

.stat-card.accent .stat-value { color: var(--gold); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-card-hover);
    color: var(--text-primary);
    white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--purple);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.btn-primary:hover:not(:disabled) { background: var(--purple-light); }

.btn-gold {
    background: var(--gold);
    color: var(--text-on-gold);
}
.btn-gold:hover:not(:disabled) { background: var(--gold-600); }

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #2a1310; }

.btn-sm { padding: 6px 11px; font-size: 12px; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-a08);
}

.form-row { margin-bottom: 16px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.checkbox-list input[type="checkbox"] { width: auto; }

.help-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    font-weight: 700;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }

.mono { font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 12.5px; color: var(--cream); }

/* IP/prefix metni ile yanındaki "x" (tamamen sil) hiçbir zaman ayrı
   satırlara bölünmesin (dar ekranlarda "x" alt satıra düşüp tuhaf
   görünüyordu) - sığmazsa .table-wrap zaten yatay kaydırma sağlıyor. */
.ip-cell-value { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ---------- Badges / Chips ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-teal { background: rgba(87, 41, 71, 0.55); color: var(--cream); border-color: rgba(201, 151, 98, 0.2); }
.badge-gold { background: var(--gold-100); color: var(--gold); border-color: var(--gold-a30); }
.badge-muted { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-success { background: var(--success-bg); color: var(--success); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.chip-remove {
    margin-left: 2px;
    cursor: pointer;
    opacity: 0.65;
    font-weight: 900;
}
.chip-remove:hover { opacity: 1; }

.badge-pending-remove { opacity: 0.55; text-decoration: line-through; border-color: var(--danger); }
.chip-remove.chip-pending-remove { opacity: 1; color: var(--danger); text-decoration: none; }

.row-pending-remove { opacity: 0.55; }
.row-pending-remove .mono { text-decoration: line-through; }

.chip-add { cursor: pointer; border-style: dashed; border-color: rgba(255, 255, 255, 0.25); }
.chip-add:hover { opacity: 1; border-color: var(--gold-a30); }

.badge-pending-add { border-style: dashed; border-color: var(--gold); background: var(--gold-100); color: var(--gold); }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.chip-select-box {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}
.chip-select-box .badge { cursor: pointer; }

/* ---------- Login page ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(155deg, var(--bg-sidebar-1) 0%, var(--bg-sidebar-2) 45%, var(--bg-sidebar-3) 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 34px 32px;
}

.login-card .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--gold);
    color: var(--text-on-gold);
    font-weight: 800;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.login-card h1 {
    font-size: 19px;
    margin: 0 0 4px 0;
    color: var(--text-heading);
}

.login-card p.sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 22px 0;
}

.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; }

/* ---------- Alerts / Toasts ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(226, 104, 92, 0.3); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(95, 185, 140, 0.3); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(217, 163, 77, 0.3); }

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toast-in 0.2s ease;
}

.toast.error { background: #5a2a24; border-color: rgba(226, 104, 92, 0.4); }
.toast.success { background: #24503d; border-color: rgba(95, 185, 140, 0.4); }

@keyframes toast-in {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 4, 8, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { margin: 0; font-size: 15px; color: var(--text-heading); }

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-close:hover { color: var(--cream); }

.modal-body { padding: 20px 22px; overflow-y: auto; }

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 400px; }
.modal-sm .modal-body { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; }

.diff-view {
    background: #0d0b11;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
    max-height: 60vh;
    overflow-y: auto;
}

.diff-add { color: var(--success); }
.diff-remove { color: var(--danger); }

/* ---------- Misc ---------- */

.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-input { max-width: 320px; }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(239, 227, 214, 0.35);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Koyu tema icin ince, dusuk kontrastli scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-light); }

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 264px;
        height: 100vh;
        overflow-y: auto;
        z-index: 50;
        transition: left 0.2s ease;
    }
    .sidebar.open { left: 0; box-shadow: var(--shadow-md); }

    .nav-toggle { display: inline-flex; }

    .topbar { padding: 0 16px; gap: 10px; }
    .topbar h1 {
        flex: 1;
        min-width: 0;
        font-size: 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .user-chip-name { display: none; }

    .content { padding: 18px; }
}

