/* ===== CSS Variables ===== */
:root {
    --bg: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --text: #1f2328;
    --text-secondary: #656d76;
    --text-muted: #8c959f;
    --border: #d0d7de;
    --border-light: #e6edf3;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --accent-light: #ddf4ff;
    --success: #1a7f37;
    --danger: #cf222e;
    --warning: #9a6700;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(31,35,40,0.04), 0 1px 2px rgba(31,35,40,0.04);
    --shadow-lg: 0 8px 24px rgba(31,35,40,0.08);
    --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    --max-width: 1100px;
    --header-height: 56px;
    --code-bg: #f6f8fa;
    --code-border: #d0d7de;
    --code-text: #1f2328;
    --code-copy-bg: #ffffff;
    --code-copy-border: #d0d7de;
    --code-copy-color: #656d76;
    --code-copy-hover-bg: #f3f4f6;
    --code-copy-hover-border: #d0d7de;
}

/* ===== DARK THEME (solid dark, no diagonal) ===== */
[data-theme="dark"] {
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text: #e6edf3;
    --text-secondary: #848d97;
    --text-muted: #6e7681;
    --border: #30363d;
    --border-light: #21262d;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --accent-light: rgba(88,166,255,0.1);
    --success: #3fb950;
    --danger: #f85149;
    --warning: #d29922;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --code-bg: #161b22;
    --code-border: #30363d;
    --code-text: #e6edf3;
    --code-copy-bg: #21262d;
    --code-copy-border: #30363d;
    --code-copy-color: #848d97;
    --code-copy-hover-bg: #30363d;
    --code-copy-hover-border: #484f58;
}

[data-theme="dark"] body {
    background: #0d1117;
    color: var(--text);
}

[data-theme="dark"] .site-header {
    background: rgba(13,17,23,0.85);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
}

[data-theme="dark"] .logo {
    color: #fff;
}
[data-theme="dark"] .logo:hover {
    color: #fff;
}

[data-theme="dark"] .admin-link {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
}
[data-theme="dark"] .admin-link:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .site-footer {
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
}

[data-theme="dark"] .footer-links a {
    color: var(--text-muted);
}
[data-theme="dark"] .footer-links a:hover {
    color: var(--text-secondary);
}

[data-theme="dark"] .pagination a {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border-light);
}
[data-theme="dark"] .pagination a:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}
[data-theme="dark"] .pagination span {
    background: var(--text-secondary);
    color: #fff;
    border-color: var(--text-secondary);
}

[data-theme="dark"] .empty-state h3 {
    color: var(--text-secondary);
}
[data-theme="dark"] .empty-state p {
    color: var(--text-muted);
}

[data-theme="dark"] .btn-primary {
    background: #e6edf3;
    color: #0d1117;
}
[data-theme="dark"] .btn-primary:hover {
    background: #c9d1d9;
}
[data-theme="dark"] .pagination span {
    background: #e6edf3;
    color: #0d1117;
    border-color: #e6edf3;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-y: scroll; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    font-weight: 400;
}

a { color: var(--text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-secondary); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ===== Layout ===== */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    height: var(--header-height);
    transition: background 0.3s;
}
.header-inner {
    max-width: var(--max-width); margin: 0 auto;
    height: 100%; padding: 0 40px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 8px;
    font-family: 'Montserrat', sans-serif;
}
.logo:hover { text-decoration: none; color: var(--text); }
.logo svg { width: 24px; height: 24px; fill: var(--text-secondary); }
.site-logo-img {
    width: 28px; height: 28px; object-fit: contain; border-radius: 4px;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
    background: transparent; border: none;
    cursor: pointer;
    color: var(--text-secondary); font-size: 0.875rem;
    display: flex; align-items: center; gap: 6px;
    transition: color 0.2s;
    padding: 4px;
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.theme-toggle:hover { color: var(--text); }

.admin-link {
    background: var(--bg-secondary); color: var(--text);
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500;
    border: 1px solid var(--border);
}
.admin-link:hover { background: var(--bg-tertiary); text-decoration: none; }

.container {
    max-width: var(--max-width); margin: 0 auto; padding: 40px 40px;
}

.site-footer {
    border-top: 1px solid var(--border-light);
    padding: 40px 40px; text-align: center;
    color: var(--text-muted); font-size: 0.875rem;
}

/* ===== Hero ===== */
.hero {
    padding: 100px 0 60px;
    text-align: left;
}

.hero h1 {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 520px;
    line-height: 1.7;
}

/* ===== Post List ===== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-item {
    padding: 40px 0;
    border-bottom: 1px solid var(--border-light);
}

.post-item:last-child {
    border-bottom: none;
}

.post-item-link {
    color: var(--text);
    text-decoration: none;
    display: block;
}

.post-item-link:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

.post-item-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
}

.post-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    font-weight: 600;
}

.post-item-excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 700px;
}

/* ===== Single Post ===== */
.post-header { margin-bottom: 24px; }
.post-header h1 {
    font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em;
    line-height: 1.3; margin-bottom: 8px;
    font-family: 'Montserrat', sans-serif;
}
.post-meta {
    display: flex; align-items: center; gap: 12px;
    color: var(--text-muted); font-size: 0.875rem;
}
.post-content { font-size: 1rem; line-height: 1.8; }
.post-content > * { margin-bottom: 20px; }
.post-content > *:last-child { margin-bottom: 0; }

.post-back-link {
    margin-top: 40px; padding-top: 24px;
    border-top: 1px solid var(--border-light);
}
.post-back-link a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}
.post-back-link a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* Content blocks */
.content-text p { margin-bottom: 16px; }
.content-text p:last-child { margin-bottom: 0; }
.content-text h2, .content-text h3, .content-text h4 { margin: 32px 0 16px; }
.content-text ul, .content-text ol { margin: 16px 0; padding-left: 24px; }
.content-text blockquote {
    border-left: 4px solid var(--text-secondary);
    padding-left: 16px; margin: 24px 0;
    color: var(--text-secondary); font-style: italic;
}
.content-text code {
    background: var(--bg-tertiary); padding: 2px 6px;
    border-radius: 4px; font-family: var(--font-mono);
    font-size: 0.875em; color: var(--danger);
}
.content-text pre {
    background: var(--bg-tertiary); padding: 16px;
    border-radius: var(--radius-sm); overflow-x: auto;
    font-family: var(--font-mono); font-size: 0.875rem;
}

.content-image {
    margin: 24px 0; border-radius: var(--radius); overflow: hidden;
}
.content-image img {
    width: 100%; border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.content-image figcaption {
    text-align: center; color: var(--text-muted);
    font-size: 0.875rem; margin-top: 8px;
}

/* ===== CODE BLOCK WINDOW ===== */
.content-code {
    margin: 24px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--code-bg);
}
.code-header {
    display: none;
}
.code-lang { display: none;
    font-size: 0.8125rem;
    color: var(--code-lang-color);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    font-weight: 500;
}
.copy-btn {
    display: none !important;
}
.content-code pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: var(--code-bg);
}
.content-code code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.content-quote {
    border-left: 3px solid var(--border);
    padding: 4px 16px;
    margin: 24px 0;
    color: var(--text);
    font-weight: 600;
    font-style: normal;
}

/* ——— Light Mode Code Block ——— */
:root {
    --code-bg: #f6f8fa;
    --code-header-bg: #f3f4f6;
    --code-border: #d0d7de;
    --code-accent: #0969da;
    --code-lang-color: #656d76;
    --code-text: #24292f;
    --code-comment: #6e7781;
    --code-punctuation: #24292f;
    --code-property: #0550ae;
    --code-string: #0a3069;
    --code-operator: #cf222e;
    --code-keyword: #8250df;
    --code-function: #8250df;
    --code-variable: #953800;
    --code-builtin: #0550ae;
    --code-number: #0550ae;
    --code-tag: #0550ae;
    --code-attr-name: #0a3069;
    --code-regex: #953800;
    --code-entity: #cf222e;
    --code-class-name: #8250df;
}

/* ——— Dark Mode Code Block ——— */
[data-theme="dark"] {
    --code-bg: #282c34;
    --code-header-bg: #21252b;
    --code-border: #3e4451;
    --code-accent: #61afef;
    --code-lang-color: #abb2bf;
    --code-text: #abb2bf;
    --code-comment: #5c6370;
    --code-punctuation: #abb2bf;
    --code-property: #d19a66;
    --code-string: #98c379;
    --code-operator: #56b6c2;
    --code-keyword: #c678dd;
    --code-function: #61afef;
    --code-variable: #e06c75;
    --code-builtin: #e5c07b;
    --code-number: #d19a66;
    --code-tag: #d19a66;
    --code-attr-name: #98c379;
    --code-regex: #e06c75;
    --code-entity: #56b6c2;
    --code-class-name: #61afef;
}

/* ——— Prism.js Base ——— */
code[class*="language-"],
pre[class*="language-"] {
    color: var(--code-text);
    background: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.6;
    tab-size: 4;
    hyphens: none;
}
pre[class*="language-"] {
    background: var(--code-bg);
}

/* ——— Tokens ——— */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: var(--code-comment);
    font-style: italic;
}
.token.punctuation {
    color: var(--code-punctuation);
}
.token.namespace {
    opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: var(--code-property);
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: var(--code-string);
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: var(--code-operator);
}
.token.atrule,
.token.attr-value,
.token.keyword {
    color: var(--code-keyword);
}
.token.function,
.token.class-name {
    color: var(--code-function);
}
.token.regex,
.token.important,
.token.variable {
    color: var(--code-variable);
}
.token.important,
.token.bold {
    font-weight: bold;
}
.token.italic {
    font-style: italic;
}
.token.entity {
    cursor: help;
}

/* PHP specific */
.language-php .token.variable {
    color: var(--code-variable);
}
.language-php .token.builtin {
    color: var(--code-builtin);
}
.language-php .token.constant {
    color: var(--code-number);
}

/* JS / TS specific */
.language-javascript .token.keyword,
.language-typescript .token.keyword {
    color: var(--code-keyword);
}
.language-javascript .token.function,
.language-typescript .token.function {
    color: var(--code-function);
}
.language-javascript .token.string,
.language-typescript .token.string {
    color: var(--code-string);
}
.language-javascript .token.number,
.language-typescript .token.number {
    color: var(--code-number);
}

/* CSS specific */
.language-css .token.property {
    color: var(--code-variable);
}
.language-css .token.selector {
    color: var(--code-builtin);
}
.language-css .token.function {
    color: var(--code-operator);
}

/* ===== Comments ===== */
.comments-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}
.comments-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 24px;
    font-family: 'Montserrat', sans-serif;
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}
.comment-item {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.comment-avatar {
    flex-shrink: 0;
}
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.comment-author {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.comment-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.comment-body {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text);
    margin-left: 46px;
    position: relative;
    transition: border-color 0.2s;
}
.comment-body:hover {
    border-color: var(--border);
}
.comment-body strong, .comment-body b {
    font-weight: 700;
}
.comment-body p {
    margin-bottom: 12px;
}
.comment-body p:last-child {
    margin-bottom: 0;
}
.comment-body h1, .comment-body h2, .comment-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
}
.comment-body ul, .comment-body ol {
    margin: 8px 0;
    padding-left: 20px;
}
.comment-body li {
    margin-bottom: 4px;
}
.comment-body code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.875em;
}
.comment-body pre {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin: 12px 0;
}

/* Admin comment actions */
.comment-admin-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.comment-item:hover .comment-admin-actions {
    opacity: 1;
}
.comment-admin-actions .btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Comment form */
.comment-form-wrapper {
    margin-top: 8px;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.comment-inputs {
    display: flex;
    gap: 12px;
}
.comment-inputs .editor-input {
    flex: 1;
}
.comment-textarea {
    min-height: 100px;
    resize: vertical;
}
.comment-actions {
    display: flex;
    justify-content: flex-end;
}

/* Edit comment form */
.comment-edit-form {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    display: none;
}
.comment-edit-form.active {
    display: block;
}
.comment-edit-form textarea {
    width: 100%;
    margin-bottom: 12px;
}

/* Logged out comment prompt */
.comment-login-prompt {
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9375rem;
}
.comment-login-prompt a {
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
}

/* ===== Admin ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px; background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    padding: 24px; position: fixed; height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .logo { margin-bottom: 32px; }
.admin-nav { list-style: none; }
.admin-nav li { margin-bottom: 4px; }
.admin-nav a {
    display: block; padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.9375rem;
    transition: all 0.2s;
}
.admin-nav a:hover, .admin-nav a.active {
    background: var(--bg-tertiary); color: var(--text);
    text-decoration: none;
}
.admin-main {
    margin-left: 260px; flex: 1; min-height: 100vh;
}
.admin-header {
    height: var(--header-height); border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; background: var(--bg);
    position: sticky; top: 0; z-index: 50;
}
.admin-page-title { font-size: 1.5rem; font-weight: 700; }
.admin-content { padding: 32px; max-width: 1000px; }

/* Stats cards */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-secondary); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 20px;
}
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-secondary); }
.stat-label { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.data-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-secondary); border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--border-light);
}
.data-table th, .data-table td {
    padding: 12px 16px; text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.data-table th {
    background: var(--bg-tertiary); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); font-weight: 600;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td { font-size: 0.9375rem; }
.data-table .post-title-cell { font-weight: 500; }
.data-table .actions { display: flex; gap: 8px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #1f2328; color: #fff; }
.btn-primary:hover { background: #2f363d; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a40e26; }
.btn-sm { padding: 5px 12px; font-size: 0.8125rem; }

/* ===== Block Editor ===== */
.editor-form { max-width: 900px; }
.editor-field { margin-bottom: 24px; }
.editor-field label {
    display: block; font-size: 0.875rem; font-weight: 600;
    margin-bottom: 8px; color: var(--text-secondary);
}
.editor-input, .editor-textarea, .editor-select {
    width: 100%; padding: 10px 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font-sans); font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-input:focus, .editor-textarea:focus, .editor-select:focus {
    outline: none; border-color: var(--border);
    box-shadow: none;
}
[data-theme="dark"] .editor-input:focus,
[data-theme="dark"] .editor-textarea:focus,
[data-theme="dark"] .editor-select:focus {
    box-shadow: none;
}
.editor-textarea { min-height: 120px; resize: vertical; }

/* Block builder */
.block-builder { display: flex; flex-direction: column; gap: 12px; }
.block-item {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px;
    position: relative;
}
.block-item:hover { border-color: var(--border); }
.block-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.block-type-label {
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text);
    background: var(--bg-tertiary); padding: 2px 8px; border-radius: 4px;
}
.block-actions { display: flex; gap: 4px; }
.block-btn {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); padding: 4px 8px; border-radius: 4px;
    cursor: pointer; font-size: 0.75rem; transition: all 0.2s;
}
.block-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.block-textarea {
    width: 100%; min-height: 80px; padding: 10px;
    background: var(--bg); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font-sans); font-size: 0.9375rem; resize: vertical;
}
.block-textarea:focus { outline: none; border-color: var(--border); }

.block-image-preview {
    max-width: 300px; border-radius: var(--radius-sm); margin-top: 8px;
}

.add-block-bar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.add-block-btn {
    background: var(--bg-tertiary); border: 1px dashed var(--border);
    color: var(--text-secondary); padding: 8px 16px;
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.875rem; transition: all 0.2s;
}
.add-block-btn:hover {
    background: var(--bg-tertiary); color: var(--text);
    border-color: var(--border); border-style: dashed;
}

/* ===== Login ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-secondary);
}
.login-box {
    background: var(--bg); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-box h1 { text-align: center; margin-bottom: 24px; }
.login-box .logo { justify-content: center; margin-bottom: 8px; }

/* ===== Messages ===== */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 0.9375rem;
}
.alert-success { background: rgba(26,127,55,0.1); color: var(--success); border: 1px solid rgba(26,127,55,0.2); }
.alert-error { background: rgba(207,34,46,0.1); color: var(--danger); border: 1px solid rgba(207,34,46,0.2); }

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; gap: 8px; margin-top: 40px;
}
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-light); font-size: 0.875rem;
}
.pagination a { background: var(--bg-secondary); color: var(--text); }
.pagination a:hover { background: var(--bg-tertiary); border-color: var(--border); text-decoration: none; }
.pagination span { background: #1f2328; color: #fff; border-color: #1f2328; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); }

/* ===== Logo preview in admin ===== */
.logo-preview {
    max-width: 120px;
    max-height: 60px;
    border-radius: 4px;
    margin-top: 8px;
    border: 1px solid var(--border-light);
}

/* ===== Mobile Admin Menu ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    margin-right: 8px;
}
.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}
.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
}
.admin-sidebar-overlay.active {
    display: block;
}
.admin-sidebar.mobile-open {
    display: block !important;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
}

/* ===== Footer Links ===== */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}
.footer-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
}
.footer-links a:hover {
    color: var(--text-secondary);
}

/* ===== Tags Cloud ===== */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0;
}
.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9375rem;
    transition: all 0.2s;
}
.tag-cloud-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text);
    text-decoration: none;
}
.tag-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ===== Related Posts ===== */
.related-posts {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}
.related-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    font-family: 'Montserrat', sans-serif;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.related-card {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    color: var(--text);
    transition: all 0.2s;
}
.related-card:hover {
    border-color: var(--text-secondary);
    text-decoration: none;
}
.related-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: var(--bg-tertiary);
}
.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.related-body {
    padding: 14px;
}
.related-body h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.35;
}
.related-body span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Newsletter ===== */
.newsletter-section {
    margin-top: 48px;
    padding: 48px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}
.newsletter-box {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}
.newsletter-box h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.newsletter-box p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 20px;
}
.newsletter-form {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.newsletter-input {
    flex: 1;
    max-width: 280px;
    padding: 10px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
}
.newsletter-input:focus {
    outline: none;
    border-color: var(--border);
}
.newsletter-message {
    margin-top: 12px;
    font-size: 0.875rem;
    min-height: 20px;
}
.newsletter-message.success { color: var(--success); }
.newsletter-message.error { color: var(--danger); }

/* ===== Analytics Chart ===== */
.analytics-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow-x: auto;
}
.chart-bar-wrapper {
    flex: 1;
    min-width: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.chart-bar {
    width: 100%;
    background: var(--text-secondary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: opacity 0.2s;
}
.chart-bar:hover {
    opacity: 0.8;
}
.chart-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== Top Posts ===== */
.top-posts-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}
.top-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}
.top-post-item:last-child {
    border-bottom: none;
}
.top-post-item a {
    color: var(--text);
    font-weight: 500;
}
.top-post-item a:hover {
    color: var(--text-secondary);
}
.top-post-item span {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ===== Bulk Actions ===== */
.bulk-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ===== Media Library ===== */
.media-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
}
.media-item:hover {
    border-color: var(--text-secondary);
}
.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; align-items: center; }
    .admin-sidebar {
        display: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .admin-layout { display: block; }
    .admin-main { 
        margin-left: 0; 
        width: 100%; 
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }
    .admin-header { padding: 0 16px; }
    .admin-content { 
        padding: 16px; 
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* ===== Hero / Page titles for mobile ===== */
    .hero {
        padding: 48px 0 32px;
    }
    .hero h1,
    .hero h1[style*="3rem"],
    main h1,
    main h1[style*="3rem"] {
        font-size: 1.75rem !important;
        line-height: 1.15;
        letter-spacing: -0.02em;
    }
    .hero p {
        font-size: 0.9375rem;
        max-width: 100%;
    }

    .post-header h1 { font-size: 1.35rem; }
    .post-item-title { font-size: 1.15rem; }

    .container {
        padding: 20px;
    }
    .header-inner {
        padding: 0 16px;
    }
    .post-item {
        padding: 24px 0;
    }

    /* Stats cards - single column */
    .stats-grid { 
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
        margin-bottom: 24px;
        width: 100%;
    }
    .stat-card { 
        padding: 16px; 
        width: 100%; 
        box-sizing: border-box;
        max-width: 100%;
    }
    .stat-value { font-size: 1.75rem; }

    /* Table - hide Date and Views columns */
    .data-table {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    .data-table th:nth-child(3),
    .data-table td:nth-child(3),
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        display: none;
    }
    .data-table th:nth-child(1),
    .data-table td:nth-child(1) {
        width: 40%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        width: 25%;
    }
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        width: 35%;
    }
    .data-table td { font-size: 0.875rem; }
    .data-table .actions .btn { padding: 4px 10px; font-size: 0.75rem; }

    .comment-inputs { flex-direction: column; }
    .comment-admin-actions { margin-left: 0; margin-top: 8px; }

    /* Admin page title smaller */
    .admin-page-title { font-size: 1.25rem; }

    /* Header actions smaller */
    .header-actions .btn {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }

    /* Content image fit on mobile */
    .content-image { 
        margin: 16px 0;
        border-radius: var(--radius-sm);
        max-width: 100%;
        overflow: hidden;
    }
    .content-image img { 
        border-radius: var(--radius-sm);
        max-width: 100%;
        height: auto;
    }

    /* Theme toggle: hide text on small screens, show only icon */
    .theme-toggle {
        font-size: 0;
        gap: 0;
        padding: 6px;
    }
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }

    /* ===== Footer mobile ===== */
    .site-footer {
        padding: 28px 20px;
    }
    .footer-links {
        gap: 14px;
        margin-bottom: 8px;
    }
    .footer-links a {
        font-size: 0.8125rem;
    }
    .site-footer p {
        font-size: 0.75rem;
    }

    /* ===== Tags cloud mobile ===== */
    .tags-cloud {
        gap: 8px;
        padding: 12px 0;
    }
    .tag-cloud-item {
        padding: 6px 12px;
        font-size: 0.875rem;
    }
    .tag-count {
        font-size: 0.6875rem;
        padding: 1px 6px;
    }

    /* ===== RSS / Sitemap badge mobile ===== */
    .hero span[style*="border-radius:100px"] {
        font-size: 0.8125rem !important;
        padding: 5px 12px !important;
    }
}

/* ===== Responsive Logo ===== */
.logo-mobile {
    display: inline-block;
    vertical-align: middle;
}
.logo-desktop {
    display: none;
}

/* Desktop logo je večji - prilagodi glede na vsebino */
.logo-desktop.site-logo-img {
    width: auto;
    height: 28px;
    max-width: 140px;
    object-fit: contain;
}

/* Če imamo desktop logo, skrij besedilo (ker je že v sliki) — VELJA ZA VSE ZASLONE */
.has-desktop-logo .logo-text {
    display: none;
}

@media (min-width: 769px) {
    .logo-mobile {
        display: none;
    }
    .logo-desktop {
        display: inline-block;
        vertical-align: middle;
    }
    /* Če ni desktop loga, pokaži mobilnega tudi na desktopu */
    .logo:not(.has-desktop-logo) .logo-mobile {
        display: inline-block;
    }
}

/* ===== MOBILE FIXES ===== */

/* 1. Hamburger menu ikona — boljši prikaz */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    margin-right: 8px;
    flex-shrink: 0;
}
.mobile-menu-toggle svg {
    width: 22px;
    height: 22px;
}

/* 2. Mobile sidebar — lepši in polnejši */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding: 20px;
        background: var(--bg);
        border-right: 1px solid var(--border-light);
    }
    .admin-sidebar.mobile-open {
        display: block !important;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 200;
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }
    .admin-sidebar .logo {
        margin-bottom: 24px;
        font-size: 1rem;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border-light);
    }
    .admin-nav li {
        margin-bottom: 2px;
    }
    .admin-nav a {
        padding: 12px 14px;
        font-size: 0.9375rem;
    }
}

/* 3. Admin header na mobilnikih — boljši razpored */
@media (max-width: 768px) {
    .admin-header {
        flex-wrap: nowrap;
        height: var(--header-height);
        padding: 0 12px;
        gap: 4px;
    }
    .admin-page-title {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        margin-right: 4px;
    }
    .header-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    .header-actions .btn,
    .header-actions .btn-secondary {
        padding: 5px 10px;
        font-size: 0.8125rem;
    }
    .theme-toggle {
        padding: 4px;
    }
    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }
}

/* 4. Editor header popravek */
@media (max-width: 768px) {
    .admin-header:has(p) {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
        padding: 8px 12px;
    }
    .admin-header:has(p) .admin-page-title {
        width: auto;
        flex: 1;
        font-size: 1.15rem;
    }
    .admin-header:has(p) p {
        width: 100%;
        margin: 2px 0 0 0;
        font-size: 0.75rem;
        color: var(--text-muted);
    }
}

/* 5. Analytics grid ena pod drugo */
@media (max-width: 768px) {
    .admin-content > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* 6. Dashboard tabela */
@media (max-width: 768px) {
    .data-table .post-title-cell a {
        white-space: normal;
        word-break: break-word;
        line-height: 1.4;
        display: block;
    }
    .data-table td {
        vertical-align: top;
        padding: 10px 8px;
    }
    .data-table .actions {
        flex-direction: column;
        gap: 4px;
    }
    .data-table .actions .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
        justify-content: center;
        min-width: 0;
    }
}

/* 7. iOS zoom fix */
input, textarea, select {
    font-size: 16px;
}

/* 8. Login box */
@media (max-width: 768px) {
    .login-box {
        margin: 20px;
        padding: 28px 20px;
    }
}


/* ===== Admin Bar ===== */
.admin-bar {
    background: var(--text);
    color: var(--bg);
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 101;
    border-bottom: 1px solid var(--border-light);
}
.admin-bar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 8px 40px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.admin-bar-label {
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-bar-link {
    color: var(--bg);
    opacity: 0.85;
    text-decoration: none;
    transition: opacity 0.2s;
}
.admin-bar-link:hover {
    opacity: 1;
    text-decoration: underline;
}
.admin-bar-meta {
    margin-left: auto;
    opacity: 0.7;
    font-size: 0.75rem;
}
.admin-bar-logout {
    opacity: 0.6;
}
[data-theme="dark"] .admin-bar {
    background: #161b22;
    color: #e6edf3;
    border-bottom-color: #30363d;
}
[data-theme="dark"] .admin-bar-link {
    color: #e6edf3;
}

@media (max-width: 768px) {
    .admin-bar-inner {
        padding: 8px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .admin-bar-meta {
        display: none;
    }
    .admin-bar-label {
        display: none;
    }
}

/* ===== Search Box ===== */
.search-box {
    position: relative;
    margin-bottom: 24px;
    max-width: 480px;
}
.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}
.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--border);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.search-box input::placeholder {
    color: var(--text-muted);
}
.search-count {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ===== Admin Search ===== */
.admin-search-box {
    position: relative;
    margin-bottom: 20px;
    max-width: 360px;
}
.admin-search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.admin-search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.875rem;
}
.admin-search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Reading Time & Updated Badge ===== */
.post-meta-separator {
    color: var(--text-muted);
    opacity: 0.5;
}
.post-updated {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--warning);
    font-size: 0.8125rem;
    font-weight: 600;
}
.post-updated::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
}

/* ===== 404 Page ===== */
.empty-state a {
    color: var(--text);
    font-weight: 600;
    text-decoration: underline;
}
.empty-state a:hover {
    color: var(--text-secondary);
}


/* ===== 404 Page Fixes ===== */
.page-404-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 120px 20px;
    text-align: center;
}
.page-404-wrap h1 {
    font-size: clamp(4.5rem, 12vw, 7rem);
    font-weight: 900;
    margin-bottom: 16px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1;
}
.page-404-wrap p {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: 32px;
    text-align: center;
}
@media (max-width: 768px) {
    .page-404-wrap {
        padding: 80px 20px;
        min-height: 40vh;
    }
    .page-404-wrap h1 {
        font-size: 5rem;
    }
}
