/* SpinArşiv — kurumsal light theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #f5f4f7;
    --surface: #ffffff;
    --surface-alt: #faf9fb;
    --border: #e4e1e8;
    --border-strong: #d1cdd6;
    --text: #2a2530;
    --text-soft: #5e5867;
    --muted: #8a8395;

    --primary: #4a4e69;
    --primary-hover: #3a3d52;
    --accent: #6d597a;
    --accent-soft: #efe9f2;
    --plum: #502f4c;
    --rose: #723d46;
    --teal: #005f73;

    --danger: #9b3a3a;
    --ok: #2e6c4d;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(74,78,105,0.05);
    --shadow-md: 0 4px 16px rgba(74,78,105,0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 0; }

code, .mono {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-size: 13.5px;
}

/* --- Topbar --- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--plum);
}
.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-block;
    position: relative;
}
.brand-mark::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid #fff;
    border-radius: 3px;
    transform: rotate(45deg);
}
.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
}
.topnav a {
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.topnav a:hover, .topnav a.active { color: var(--primary); border-color: var(--primary); }
.topnav a.muted { color: var(--muted); border: none; }
.topnav a.btn { border: none; padding: 7px 14px; }

/* --- Layout --- */
.layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    position: sticky;
    top: 80px;
    box-shadow: var(--shadow-sm);
}
.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
}
.all-link {
    display: block;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-weight: 500;
    margin-bottom: 6px;
}
.all-link:hover { background: var(--surface-alt); }
.all-link.active { background: var(--accent-soft); color: var(--plum); }

.cat-tree, .cat-admin-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cat-tree ul, .cat-admin-tree ul {
    list-style: none;
    padding-left: 16px;
    margin: 0;
    border-left: 1px dashed var(--border);
    margin-left: 6px;
}
.cat-tree a {
    display: block;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 0.92rem;
    margin: 2px 0;
}
.cat-tree a:hover { background: var(--surface-alt); color: var(--text); }
.cat-tree a.active { background: var(--accent-soft); color: var(--plum); font-weight: 600; }

.content {
    min-width: 0;
}
.content-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.content-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.searchbar {
    display: flex;
    gap: 8px;
}
.searchbar input {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    background: var(--surface);
    min-width: 240px;
}

/* --- Article grid --- */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.article-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text);
    display: block;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}
.article-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}
.card-cat {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.article-card h3 {
    margin: 4px 0 8px;
    font-size: 1.02rem;
    color: var(--text);
    line-height: 1.35;
}
.card-notes {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin: 0 0 10px;
    line-height: 1.45;
}
.card-foot {
    font-size: 0.78rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 8px;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-human { background: #e8f0ec; color: var(--ok); }
.badge-ai { background: #efe9f2; color: var(--plum); }
.badge-mixed { background: #fce8d6; color: var(--rose); }

/* --- Article header (view page) --- */
.article-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.breadcrumb {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.article-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.article-title-row h1 { margin: 0; flex: 1; min-width: 0; }
.article-meta {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin-top: 8px;
}
.notes-box {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}
.notes-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 4px;
}
.notes-body {
    font-size: 0.92rem;
    color: var(--text-soft);
}
.article-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.tab {
    padding: 10px 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-soft);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.tab-panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.tab-panel.active { display: block; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}
.panel-title {
    font-weight: 600;
    color: var(--text);
}
.panel-actions { display: flex; gap: 8px; }

.readonly-area {
    width: 100%;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--text);
    line-height: 1.6;
    resize: vertical;
    min-height: 320px;
}
.readonly-area:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* --- Density table --- */
.density-meta { font-size: 0.85rem; color: var(--text-soft); }
.density-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.density-table th, .density-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.density-table th {
    background: var(--surface-alt);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}
.density-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-wrap {
    width: 100%;
    background: var(--surface-alt);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--plum));
    border-radius: 4px;
}

/* --- Density mode tabs (Tek Varyant / Çoklu Tarama) --- */
.density-modes {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px 20px;
    margin-bottom: 0;
}
.mode-tabs {
    display: inline-flex;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.mode-tab {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-soft);
    transition: all 0.15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.mode-info {
    margin-top: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.density-mode {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 0 20px 20px;
    margin-top: -1px;
}
.density-summary {
    padding: 10px 14px;
    background: var(--surface-alt);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin: 12px 0 16px;
}

.gram-section { margin-top: 22px; }
.gram-section:first-of-type { margin-top: 16px; }
.gram-head {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.scan-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    flex-wrap: wrap;
}
.scan-label {
    font-size: 0.85rem;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}
.scan-label select {
    margin-top: 0;
    width: auto;
    padding: 6px 10px;
}

/* Min/Max aralık çubuğu */
.range-wrap {
    position: relative;
    width: 100%;
    min-width: 120px;
    height: 12px;
    background: var(--surface-alt);
    border-radius: 6px;
    overflow: hidden;
}
.range-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--accent), var(--plum));
    border-radius: 6px;
    opacity: 0.85;
}
.range-marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--text);
    transform: translateX(-1px);
    box-shadow: 0 0 0 1px var(--surface);
}
.density-scan th, .density-scan td { padding: 8px 10px; }

/* --- Forms --- */
.article-form, .stack-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.article-form label, .stack-form label {
    display: block;
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-soft);
}
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row label { flex: 1; min-width: 200px; }
.form-row label.grow { flex: 2; }

input[type=text], input[type=password], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.94rem;
    background: var(--surface);
    color: var(--text);
    margin-top: 5px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; line-height: 1.6; }
textarea.mono { font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover {
    background: var(--surface-alt);
    border-color: var(--accent);
    color: var(--text);
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.92rem;
}
.alert-ok { background: #e8f0ec; color: var(--ok); border-left: 3px solid var(--ok); }
.alert-err { background: #fbecec; color: var(--danger); border-left: 3px solid var(--danger); }

/* --- Empty states --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty-state p { color: var(--text-soft); margin: 0 0 16px; }
.empty-mini { color: var(--muted); font-size: 0.88rem; padding: 8px 0; }

/* --- Categories admin --- */
.two-col {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.cat-admin-tree li { margin: 6px 0; }
.cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    gap: 10px;
    flex-wrap: wrap;
}
.cat-name { font-weight: 500; }
.cat-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form summary {
    cursor: pointer;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    list-style: none;
}
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form[open] summary { background: var(--accent-soft); color: var(--plum); }
.row-form {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.row-form input, .row-form select {
    margin-top: 0;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.inline-del { display: inline; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.muted { color: var(--muted); }

/* --- Install / Login pages --- */
.install-page, .login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #efe9f2, #f5f4f7);
    padding: 24px;
}
.install-box, .login-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.install-box h1, .login-box h1 { margin-bottom: 18px; }
.login-box .brand { margin-bottom: 24px; font-size: 1.2rem; }
.login-box label { display: block; margin-bottom: 14px; font-size: 0.88rem; color: var(--text-soft); font-weight: 500; }
.login-box .btn { width: 100%; padding: 11px; }
code { background: var(--surface-alt); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .two-col { grid-template-columns: 1fr; }
    .topbar-inner { padding: 0 14px; }
    .topnav { gap: 12px; }
    .topnav a:not(.btn) { font-size: 0.85rem; }
    .content-wide, .layout { padding: 14px; }
}
