:root {
    --bg: #f1f3f8;
    --sidebar-bg: #12172b;
    --sidebar-bg-2: #171d35;
    --sidebar-text: #9aa3c0;
    --sidebar-active: #4f7dff;
    --card-bg: #ffffff;
    --border: #e6e9f2;
    --border-soft: #eef0f7;
    --text: #1a1f36;
    --text-muted: #6b7288;
    --primary: #4f5bff;
    --primary-dark: #3d47e0;
    --primary-soft: #eef0ff;
    --success: #12a454;
    --success-bg: #e7f9ef;
    --danger: #e0343f;
    --danger-bg: #fdecec;
    --warning: #c6790a;
    --warning-bg: #fef4e2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(20, 24, 45, 0.05);
    --shadow-md: 0 6px 20px rgba(20, 24, 45, 0.06);
    --sidebar-width: 250px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

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

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg));
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 22px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    padding: 0 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}
.sidebar-brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #7b8cff);
    color: #fff;
    flex-shrink: 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 0 12px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    padding: 10px 12px;
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: var(--radius-sm);
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 100px;
    min-width: 16px;
    text-align: center;
}
.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary), #6f7dff);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 91, 255, 0.35);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px 0;
    margin: 14px 12px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { display: flex; align-items: center; gap: 5px; color: #ff9494; font-size: 12px; margin-top: 2px; }

.main-content { flex: 1; padding: 30px 40px 50px; min-width: 0; width: 100%; }

/* ---------- Page header ---------- */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.page-header h1 { font-size: 23px; margin: 0; display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.page-header p { color: var(--text-muted); margin: 6px 0 0; max-width: 640px; line-height: 1.5; }

/* ---------- Cards / grid ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.issue-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(224, 52, 63, 0.25);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 20px;
    text-decoration: none;
}
.issue-banner:hover { text-decoration: none; background: #fde0e1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card-top { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.stat-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: #eef0f7; color: var(--text-muted);
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--warning); }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card-bg); }
table.card-table { border-radius: var(--radius); overflow: hidden; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
th { background: #fafbfe; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfbfe; }
td.actions { text-align: right; white-space: nowrap; }
td.actions a, td.actions button { margin-left: 8px; }

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: #fafbfe;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.checkbox-label input, input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; margin: 0; }

.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex: 1; min-width: 0; }

/* Bu iki kontrol bir <form> icinde oldugundan, genel "form input/select" stillerinin
   sizmasini onlemek icin ID secici ile tum ilgili ozellikleri acikca eziyoruz. */
#site-search, #status-filter {
    display: inline-block;
    width: auto;
    margin: 0;
    font-family: inherit;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 36px;
    color: var(--text-muted);
    flex: 0 1 240px;
    min-width: 0;
}
.search-box .icon { flex-shrink: 0; }
#site-search {
    border: none !important;
    outline: none;
    font-size: 13px;
    width: 100% !important;
    color: var(--text);
    background: transparent !important;
    padding: 0 !important;
    height: 100%;
}
#status-filter {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
    color: var(--text);
    flex-shrink: 0;
}

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 100px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-muted { background: #eef0f5; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}
.btn:hover { text-decoration: none; background: #f5f6fb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,91,255,0.28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c22a34; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.65; cursor: default; }

/* ---------- Forms ---------- */
form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 13px; color: var(--text); }
form input[type=text], form input[type=password], form input[type=url], form input[type=file], form textarea, form select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    background: #fff;
    color: var(--text);
}
form input:focus, form textarea:focus, form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
form textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }

/* ---------- Auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(circle at top, #1b2242, var(--sidebar-bg)); }
.auth-card { background: #fff; border-radius: 16px; padding: 38px 36px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(0,0,0,0.3); }
.auth-card h1 { font-size: 20px; margin: 0 0 2px; }
.auth-sub { color: var(--text-muted); margin: 0 0 20px; font-size: 13.5px; }

/* ---------- Detail / scan result ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.detail-grid .card { margin-bottom: 0; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-muted); }
.kv .v { font-weight: 600; text-align: right; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { background: var(--primary-soft); color: #3a3fb5; padding: 3px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state a { font-weight: 600; }

/* ---------- Zaman cizelgesi ---------- */
.timeline { position: relative; margin-top: 4px; }
.timeline-item { position: relative; display: flex; gap: 16px; padding-bottom: 22px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: -6px;
    width: 2px;
    background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    margin-top: 4px;
}
.timeline-dot.has-change { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.timeline-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline-changes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.timeline-changes li { font-size: 13px; padding: 5px 10px; border-radius: 6px; width: fit-content; }
.timeline-changes li.change-positive { background: var(--success-bg); color: var(--success); }
.timeline-changes li.change-negative { background: var(--danger-bg); color: var(--danger); }
.timeline-changes li.change-neutral { background: var(--primary-soft); color: #3a3fb5; }
.timeline-nochange { margin: 6px 0 0; font-size: 12.5px; }

/* ---------- Hizli Kontrol sonuc kartlari ---------- */
.scan-results { display: flex; flex-direction: column; gap: 12px; }
.scan-result-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.scan-result-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.scan-result-url { font-weight: 700; font-size: 14.5px; word-break: break-all; }
.scan-result-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.scan-result-error {
    margin: 12px 0 0;
    color: var(--danger);
    font-size: 13px;
    background: var(--danger-bg);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
}
.scan-result-meta { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.meta-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; }
.meta-label {
    flex: 0 0 80px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 3px;
}
.scan-result-matches { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.scan-result-matches-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--danger);
    margin-bottom: 8px;
}
.scan-result-matches ul { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }

.muted { color: var(--text-muted); }
.text-right { text-align: right; }

@media (max-width: 1000px) {
    .two-col { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 14px; overflow-x: auto; }
    .sidebar-brand { border: none; padding: 0 14px 0 0; margin: 0; }
    .sidebar-nav { flex-direction: row; padding: 0; }
    .sidebar-nav a span { display: none; }
    .sidebar-user { border: none; padding: 0 0 0 10px; margin: 0 0 0 auto; flex-shrink: 0; }
    .sidebar-user-avatar { display: none; }
    .sidebar-user-name { display: none; }
    .sidebar-logout { color: #fff; background: rgba(255,255,255,0.08); padding: 8px; border-radius: var(--radius-sm); }
    .sidebar-logout span { display: none; }
    .main-content { padding: 20px; }
}
