:root {
    --accent: #4DBF8A;
    --accent-hover: #5CD99D;
    --accent-dark: #438A6A;
    --surface: #232830;
    --base: #131319;
    --border: #393D42;
    --muted: #ABB1B9;
    --text: #FAFAFA;
    --surface-hover: #2a3038;
    --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--base);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Layout ─────────────────────────────────── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.site-header .logo img {
    height: 32px;
}

.site-header .logo span {
    color: var(--accent);
    font-weight: 400;
    opacity: 0.7;
    margin-left: 4px;
}

.site-header nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.site-header nav a {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}

.site-header nav a:hover { color: var(--text); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Homepage ─────────────────────────────────── */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.hero h1 .accent { color: var(--accent); }

.hero p {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

.search-bar {
    max-width: 500px;
    margin: 2rem auto;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

.search-bar input:focus {
    border-color: var(--accent);
}

.search-bar i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    transition: all 0.2s;
    cursor: pointer;
    display: block;
    color: var(--text);
}

.category-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(77, 191, 138, 0.08);
    transform: translateY(-2px);
    color: var(--text);
}

.category-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(77, 191, 138, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--accent);
}

.category-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.category-card .count {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ── Category Page ─────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.4; }

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.articles-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    transition: all 0.15s;
}

.article-link:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    color: var(--text);
}

.article-link .article-icon {
    color: var(--accent);
    font-size: 1rem;
    flex-shrink: 0;
}

.article-link .article-title {
    font-weight: 600;
    font-size: 1rem;
}

.article-link .article-arrow {
    margin-left: auto;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.15s;
}

.article-link:hover .article-arrow { opacity: 1; }

/* ── Article Page ─────────────────────────────── */
.article-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
}

.sidebar h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 1rem;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav a {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: var(--surface);
    color: var(--text);
}

.sidebar-nav a.active {
    background: rgba(77, 191, 138, 0.1);
    color: var(--accent);
}

.article-content {
    min-width: 0;
}

.article-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* Article body styling */
.article-body h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.article-body h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.article-body h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--accent);
}

.article-body p {
    margin-bottom: 1rem;
    color: var(--text);
    opacity: 0.9;
}

.article-body ul, .article-body ol {
    margin: 0.75rem 0 1.25rem 1.5rem;
}

.article-body li {
    margin-bottom: 0.4rem;
    color: var(--text);
    opacity: 0.9;
}

.article-body code {
    background: rgba(77, 191, 138, 0.1);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.article-body pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    font-size: 0.95rem;
}

.article-body th, .article-body td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-body th {
    background: var(--surface);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.article-body td { color: var(--text); opacity: 0.9; }

.article-body strong { color: var(--text); font-weight: 700; }

.article-body a { color: var(--accent); }
.article-body a:hover { color: var(--accent-hover); text-decoration: underline; }

.article-body blockquote {
    border-left: 3px solid var(--accent);
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0 1.5rem;
}

.article-body img {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin: 1rem 0;
}

/* ── Footer ─────────────────────────────────── */
.site-footer {
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ── Admin ─────────────────────────────────── */
.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header .title {
    font-weight: 700;
    font-size: 0.95rem;
}

.admin-header .title .badge {
    background: rgba(77, 191, 138, 0.15);
    color: var(--accent);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: var(--base);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px rgba(77, 191, 138, 0.3);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--base);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 200px;
    font-family: inherit;
    resize: vertical;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 700;
}

.admin-table tr:hover td { background: var(--surface-hover); }
.admin-table td .actions { display: flex; gap: 0.5rem; }

.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(77, 191, 138, 0.1);
    border: 1px solid rgba(77, 191, 138, 0.3);
    color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .site-header { padding: 0 1rem; }
    .container { padding: 1.5rem 1rem; }
    .hero h1 { font-size: 1.8rem; }
    .categories-grid { grid-template-columns: 1fr; }
    .article-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .sidebar { position: static; }
}
