/* =====================================================
   ScienceToday — Dark Theme
   ===================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #0d1117;
    --bg2:        #161b22;
    --bg3:        #1c2330;
    --border:     #30363d;
    --accent:     #58a6ff;
    --accent2:    #3fb950;
    --accent3:    #d29922;
    --text:       #e6edf3;
    --text-muted: #8b949e;
    --danger:     #f85149;
    --radius:     10px;
    --shadow:     0 4px 24px rgba(0,0,0,0.5);
    --transition: 0.2s ease;
    --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

body.consent-open {
    padding-bottom: 210px;
}

body.consent-closed {
    padding-bottom: 68px;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a5d3ff; text-decoration: underline; }

img { display: block; max-width: 100%; height: auto; }

/* --- Navbar --- */
.navbar {
    background: rgba(18, 25, 37, 0.9);
    border-bottom: 1px solid rgba(88, 166, 255, 0.2);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    backdrop-filter: blur(10px);
}
.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f0f6ff;
    letter-spacing: -0.4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}
.navbar-brand span { color: #8ec4ff; }
.navbar-brand:hover { text-decoration: none; color: var(--text); }
.navbar-links {
    display: flex;
    gap: 0.5rem;
   /* align-items: center;*/
}
.navbar-links a {
    color: #c5d4e8;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.42rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: all var(--transition);
}
.navbar-links a:hover,
.navbar-links a.active {
    color: #f5faff;
    border-color: rgba(88, 166, 255, 0.55);
    background: rgba(88, 166, 255, 0.2);
    text-decoration: none;
}

.navbar-links a.admin-panel-launch {
    border-color: rgba(63, 185, 80, 0.45);
    background: rgba(63, 185, 80, 0.12);
    color: #b8f3c3;
}

.navbar-links a.admin-panel-launch:hover {
    border-color: rgba(63, 185, 80, 0.68);
    background: rgba(63, 185, 80, 0.2);
    color: #d8ffe0;
}

body:not(.admin-panel) .navbar {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

body:not(.admin-panel) .navbar .logo-orb {
    background: linear-gradient(140deg, rgba(88, 166, 255, 0.32), rgba(63, 185, 80, 0.22));
    border: 1px solid rgba(88, 166, 255, 0.4);
}

body.admin-panel {
    padding-left: 282px;
}

body.admin-panel .navbar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 282px;
    height: auto;
    padding: 1.05rem 0.9rem;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.85rem;
    background:
        radial-gradient(circle at top left, rgba(88, 166, 255, 0.14), transparent 46%),
        linear-gradient(180deg, #0e1829 0%, #0d1117 58%);
    overflow-y: auto;
}

body.admin-panel .navbar-brand {
    padding: 0.8rem 0.85rem;
    border: 1px solid rgba(88, 166, 255, 0.28);
    border-radius: 12px;
    background: rgba(88, 166, 255, 0.08);
    font-size: 1.02rem;
}

body.admin-panel .navbar-links {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
}

body.admin-panel .navbar-links a {
    display: flex;
    align-items: center;
    gap: 0.58rem;
    padding: 0.62rem 0.72rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: rgba(13, 17, 23, 0.44);
    color: #d2dbe7;
    border-bottom-color: transparent;
}

body.admin-panel .navbar-links a:hover,
body.admin-panel .navbar-links a.active {
    border-color: rgba(88, 166, 255, 0.52);
    background: rgba(88, 166, 255, 0.16);
    color: #f2f8ff;
    text-decoration: none;
}

body.admin-panel .nav-link-icon {
    width: 1.2rem;
    display: inline-flex;
    justify-content: center;
    font-size: 1rem;
}

body.admin-panel .admin-main {
    min-height: 100vh;
}

body.admin-panel .page,
body.admin-panel .page-sm {
    padding-top: 2rem;
}

.admin-lang-form {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.15rem 0.55rem;
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: 999px;
    background: rgba(88, 166, 255, 0.08);
}

.admin-lang-label {
    margin: 0;
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ac8ff;
}

.admin-lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    border: 1px solid rgba(88, 166, 255, 0.35);
    background: rgba(88, 166, 255, 0.14);
    font-size: 1rem;
    line-height: 1;
}

.admin-lang-select {
    width: auto;
    min-width: 118px;
    font-size: 0.8rem;
    padding: 0.26rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(88, 166, 255, 0.38);
    background: rgba(13, 17, 23, 0.95);
}

.admin-lang-select:focus {
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

body.admin-panel .admin-lang-form {
    width: 100%;
    margin: 0.25rem 0;
    justify-content: space-between;
    background: rgba(16, 33, 57, 0.58);
    border-color: rgba(88, 166, 255, 0.4);
}

body.admin-panel .admin-lang-select {
    flex: 1;
    min-width: 0;
}

body.admin-panel .admin-lang-flag {
    flex-shrink: 0;
}

/* --- Page wrapper --- */
.page { max-width: 1300px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.page-sm { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.5rem; }

/* --- Hero banner --- */
.hero {
    background: linear-gradient(135deg, #0d1f3c 0%, #0d1117 60%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(88,166,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.hero p  { color: var(--text-muted); font-size: 1rem; }

/* --- Card --- */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: border-color var(--transition);
}
.card:hover { border-color: #484f58; }

/* --- Form elements --- */
.form-group { margin-bottom: 1.25rem; }
.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 0 0 1rem;
}
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
input[type=text],
input[type=password],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
input[type=text]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 100px; }
input[type=file] {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg3);
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-muted);
}
.field-hint {
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.ai-option-card {
    display: block;
    position: relative;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(28,35,48,0.9), rgba(22,27,34,0.95));
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.ai-option-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.ai-option-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-option-card:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
}

.ai-option-label {
    display: block;
    color: var(--text);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.ai-provider-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-provider-icon {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(88,166,255,0.14);
    border: 1px solid rgba(88,166,255,0.25);
    font-size: 0.9rem;
    flex-shrink: 0;
}
.ai-provider-icon svg {
    width: 1rem;
    height: 1rem;
}

/* Per-provider brand accent colors */
.ai-icon-openai    { background: rgba(116,210,127,0.13); border-color: rgba(116,210,127,0.32); color: #74d27f; }
.ai-icon-xai       { background: rgba(230,230,230,0.10); border-color: rgba(230,230,230,0.22); color: #d8d8d8; }
.ai-icon-deepseek  { background: rgba(32,163,234,0.13);  border-color: rgba(32,163,234,0.32);  color: #20a3ea; }
.ai-icon-google    { background: rgba(66,133,244,0.13);   border-color: rgba(66,133,244,0.32);   color: #4285f4; }
.ai-icon-anthropic { background: rgba(205,128,76,0.13);  border-color: rgba(205,128,76,0.32);  color: #d4804c; }

.ai-option-description {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.image-mode-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg3);
    color: var(--text-muted);
    cursor: pointer;
}

.mode-pill input {
    accent-color: var(--accent);
}

.logo-brand .logo-orb {
    display: inline-flex;
   width: 45px;
    height: 45px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(88,166,255,0.15);
}

.home-search {
    margin-bottom: 1rem;
}

.hero-logo {
    padding-top: 2.4rem;
}

.hero-logo-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.9rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    background: rgba(88,166,255,0.16);
    border: 1px solid rgba(88,166,255,0.35);
}

.category-menu-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}

.category-chip:hover,
.category-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-with-icon {
    justify-content: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
}

.btn-icon svg {
    width: 1rem;
    height: 1rem;
}
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-primary:hover { background: #a5d3ff; color: #0d1117; text-decoration: none; }
.btn-success { background: var(--accent2); color: #0d1117; }
.btn-success:hover { background: #7ee787; color: #0d1117; text-decoration: none; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }

/* --- Post Cards Grid (archive) --- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}
.post-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: var(--text);
    position: relative;
}
.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(88,166,255,0.12);
    text-decoration: none;
    color: var(--text);
}

.post-card-shell {
    min-height: 100%;
}

.post-card-cover-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.post-card-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: var(--bg3);
}
.post-card-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--bg3), #0d1f3c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--border);
}
.post-card-body { padding: 1.1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; position: relative; z-index: 2; }
.post-card-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}
.post-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
}
.post-card-excerpt {
    color: #c6d2de;
    font-size: 0.92rem;
    line-height: 1.6;
}
.post-card-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: auto; }
.post-card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.post-card-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    position: relative;
    z-index: 3;
}

.post-card-cta {
    margin-left: auto;
    box-shadow: 0 12px 24px rgba(88, 166, 255, 0.18);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(13, 17, 23, 0.65);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    font: inherit;
}

.icon-btn:hover,
.icon-btn.is-active {
    border-color: rgba(210, 153, 34, 0.55);
    background: rgba(210, 153, 34, 0.12);
    color: #ffd77a;
}

/* --- Tag pills --- */
.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(88,166,255,0.1);
    border: 1px solid rgba(88,166,255,0.25);
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 500;
    transition: background var(--transition);
}
.tag:hover { background: rgba(88,166,255,0.2); text-decoration: none; }
.tag-green {
    background: rgba(63,185,80,0.1);
    border-color: rgba(63,185,80,0.25);
    color: var(--accent2);
}

/* --- Search bar --- */
.search-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}
.search-bar input { flex: 1; }

.search-input-wrap {
    position: relative;
    flex: 1;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    background: rgba(22, 27, 34, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 30;
}

.search-suggestion-item {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.8rem 0.95rem;
    color: var(--text);
    border-bottom: 1px solid rgba(48, 54, 61, 0.7);
    text-decoration: none;
}

.search-suggestion-item:last-child {
    border-bottom: 0;
}

.search-suggestion-item:hover {
    background: rgba(88, 166, 255, 0.08);
    text-decoration: none;
}

.search-suggestion-type {
    min-width: 68px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 700;
}

.search-suggestion-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.search-suggestion-copy strong {
    font-size: 0.92rem;
}

.search-suggestion-copy small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* --- Article view --- */
.article-hero {
    width: 100%;
    max-height: 550px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}
.article-header { margin-bottom: 1.5rem; }
.article-header h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.article-meta .badge {
    padding: 0.25rem 0.7rem;
    background: rgba(88,166,255,0.15);
    border-radius: 20px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.8rem;
}
.article-excerpt {
    color: #cdd9e5;
    font-size: 1rem;
    line-height: 1.7;
    max-width: 62ch;
}
.article-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #cdd9e5;
}
.article-body p  { margin-bottom: 1.1em; }
.article-body h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 0.6rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.article-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 1.5rem 0 0.4rem;
}
.article-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.article-tags .label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; margin-right: 0.25rem; align-self: center; }

/* --- Action bar (view_post) --- */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    align-items: center;
}
.action-bar-spacer { flex: 1; }

/* --- Spinner / Loading --- */
.spinner {
    display: none;
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Alert --- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.alert-info    { background: rgba(88,166,255,0.1); border: 1px solid rgba(88,166,255,0.3); color: var(--accent); }
.alert-danger  { background: rgba(248,81,73,0.1);  border: 1px solid rgba(248,81,73,0.3);  color: var(--danger); }
.alert-success { background: rgba(63,185,80,0.1);  border: 1px solid rgba(63,185,80,0.3);  color: var(--accent2); }

/* --- Pagination --- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    margin-top: 2rem;
}
.pagination a,
.pagination strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}
.pagination a:hover   { border-color: var(--accent); color: var(--accent); background: rgba(88,166,255,0.08); }
.pagination strong    { background: var(--accent); border-color: var(--accent); color: #0d1117; }

.pagination-wide {
    width: auto !important;
    padding: 0 0.9rem;
}

/* --- Stats row --- */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.stat-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    min-width: 130px;
    text-align: center;
}
.stat-box .num { font-size: 1.75rem; font-weight: 800; color: var(--accent); }
.stat-box .lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* --- Ad slot (public pages) --- */
.ad-slot {
    margin: 1.5rem 0;
    overflow: hidden;
}

/* --- Ad slot cards (admin_ads settings page) --- */
.ad-slot-block {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 0.9rem;
}
.ad-slot-block-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.ad-slot-block-fields {
    display: flex;
    gap: 0.85rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.ad-slot-block-fields .form-group { flex-shrink: 0; }

code {
    font-family: 'Consolas', 'Fira Code', monospace;
    font-size: 0.85em;
    background: rgba(88,166,255,0.08);
    border: 1px solid rgba(88,166,255,0.18);
    border-radius: 4px;
    padding: 0.1em 0.38em;
    color: var(--accent);
}

.admin-card,
.legal-card {
    max-width: 100%;
}

.legal-card h2 {
    margin-top: 1.25rem;
    margin-bottom: 0.45rem;
}

.legal-card p {
    color: #cdd9e5;
}

.admin-title,
.section-title {
    margin-bottom: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.admin-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.admin-actions form {
    margin: 0;
}

.zoomable-image {
    cursor: zoom-in;
}

.zoom-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.zoom-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.zoom-content {
    position: relative;
    z-index: 2;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-content img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}

.zoom-close {
    position: absolute;
    top: -42px;
    right: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.zoom-loading {
    color: #fff;
    font-weight: 600;
}

.share-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
}

.share-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.52rem 0.95rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
    white-space: nowrap;
}
.share-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.share-btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

/* X / Twitter */
.share-btn-x {
    border-color: rgba(255,255,255,0.15);
    color: #e7e9ea;
}
.share-btn-x:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.35);
    color: #fff;
}

/* Facebook */
.share-btn-facebook {
    border-color: rgba(24,119,242,0.35);
    color: #7ab3f7;
}
.share-btn-facebook:hover {
    background: rgba(24,119,242,0.15);
    border-color: rgba(24,119,242,0.6);
    color: #a8ceff;
}

/* LinkedIn */
.share-btn-linkedin {
    border-color: rgba(10,102,194,0.35);
    color: #6aaee8;
}
.share-btn-linkedin:hover {
    background: rgba(10,102,194,0.15);
    border-color: rgba(10,102,194,0.6);
    color: #9ecef8;
}

/* Telegram */
.share-btn-telegram {
    border-color: rgba(38,169,224,0.35);
    color: #6dc9f0;
}
.share-btn-telegram:hover {
    background: rgba(38,169,224,0.15);
    border-color: rgba(38,169,224,0.6);
    color: #a3dff7;
}

/* Print */
.share-btn-print {
    border-color: rgba(139,148,158,0.35);
    color: var(--text-muted);
}
.share-btn-print:hover {
    background: rgba(139,148,158,0.12);
    border-color: rgba(139,148,158,0.55);
    color: var(--text);
}

/* Copy Link */
.share-btn-copy {
    border-color: rgba(88,166,255,0.35);
    color: var(--accent);
    background: rgba(88,166,255,0.06);
}
.share-btn-copy:hover {
    background: rgba(88,166,255,0.16);
    border-color: rgba(88,166,255,0.6);
    color: #a5d3ff;
}

.related-posts-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.section-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.related-post-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg2);
}

.related-post-link {
    display: block;
    color: var(--text);
    text-decoration: none;
}

.related-post-link:hover {
    text-decoration: none;
}

.related-post-image {
    width: 100%;
    height: 148px;
    object-fit: cover;
}

.related-post-body {
    padding: 1rem;
}

.related-post-body h3 {
    font-size: 1rem;
    margin-bottom: 0.55rem;
}

.related-post-body p {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.post-nav-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.favorites-hero {
    margin-bottom: 2rem;
}

.favorites-empty {
    text-align: center;
    display: grid;
    gap: 0.8rem;
}

.favorites-empty .btn {
    justify-self: center;
}

.consent-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1200;
}

.consent-content {
    max-width: 860px;
    margin: 0 auto;
    background: rgba(22, 27, 34, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1rem 0.9rem;
    box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}

.consent-title {
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.consent-content p {
    color: #cdd9e5;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.consent-links {
    display: flex;
    gap: 0.35rem;
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.consent-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.consent-manage-btn {
    position: fixed;
    left: 1rem;
    bottom: 0.85rem;
    z-index: 1190;
    border: 1px solid var(--border);
    background: rgba(22, 27, 34, 0.96);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.5rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.consent-manage-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

/* --- Scroll-to-top button --- */
.scroll-top-btn {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1180;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(88, 166, 255, 0.35);
    background: rgba(18, 25, 37, 0.92);
    color: #8ec4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 18px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}
.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.scroll-top-btn:hover {
    background: rgba(88, 166, 255, 0.18);
    border-color: rgba(88, 166, 255, 0.65);
    color: #c8e4ff;
}
.scroll-top-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* --- Hamburger toggle button (hidden on desktop) --- */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 8px;
    background: rgba(88, 166, 255, 0.08);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}
.navbar-toggle:hover {
    border-color: rgba(88, 166, 255, 0.55);
    background: rgba(88, 166, 255, 0.16);
}
.navbar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #c5d4e8;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.18s ease;
    transform-origin: center;
}
.navbar-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.navbar-toggle.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.navbar-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    html, body { overflow-x: hidden; }

    /* Hamburger visible on mobile */
    body:not(.admin-panel) .navbar-toggle {
        display: flex;
    }

    /* Navbar stays single row with brand + button */
    body:not(.admin-panel) .navbar {
        height: 60px;
        padding: 0 1rem;
        flex-wrap: nowrap;
    }

    /* Mobile dropdown panel */
    body:not(.admin-panel) .navbar-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        z-index: 200;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        background: rgba(13, 19, 29, 0.98);
        border-bottom: 1px solid rgba(88, 166, 255, 0.18);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
        padding: 0 1rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.3s ease;
    }
    body:not(.admin-panel) .navbar-links.nav-open {
        max-height: 400px;
        opacity: 1;
        pointer-events: auto;
        padding: 0.75rem 1rem;
    }
    body:not(.admin-panel) .navbar-links a {
        font-size: 0.9rem;
        font-weight: 600;
        padding: 0.78rem 1rem;
        text-align: left;
        border-radius: 8px;
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Admin panel language switcher */
    .admin-lang-form { padding: 0.15rem 0.4rem; }
    .admin-lang-label { display: none; }
    .admin-lang-select { min-width: 95px; font-size: 0.75rem; }

    /* Typography & layout */
    .hero { padding: 2rem 1.25rem; }
    .hero h1 { font-size: 1.35rem; }
    .hero p { font-size: 0.92rem; }
    .page, .page-sm { padding: 1.5rem 1rem; }

    /* Category chips: horizontal scroll on mobile */
    .category-menu-wrap {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.3rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .category-menu-wrap::-webkit-scrollbar { display: none; }
    .category-chip { flex-shrink: 0; }

    /* Post grids */
    .posts-grid { grid-template-columns: 1fr; }
    .related-posts-grid { grid-template-columns: 1fr; }

    /* Article */
    .article-header h1 { font-size: 1.35rem; }
    .article-body { font-size: 1rem; }
    .article-hero { max-height: 220px; }

    /* Search bar */
    .search-bar { flex-direction: column; gap: 0.55rem; }
    .search-bar .search-input-wrap { width: 100%; }
    .search-bar input[type=text] {
        font-size: 1rem;
        padding: 0.85rem 1rem;
        border-radius: 10px;
    }
    .search-bar .btn {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1rem;
        font-size: 1rem;
        border-radius: 10px;
        min-height: 48px;
    }

    /* Stats */
    .stats-row { flex-direction: column; }

    /* Post card */
    .post-card-actions { flex-direction: column; align-items: stretch; }
    .post-card-cta, .icon-btn { width: 100%; justify-content: center; }

    /* Post navigation */
    .post-nav-row { flex-direction: column; }
    .post-nav-row a { width: 100%; text-align: center; justify-content: center; }

    /* Action bar */
    .action-bar { flex-wrap: wrap; }
    .action-bar .btn { flex: 1 1 100%; justify-content: center; }
    .action-bar-spacer { display: none; }

    /* Section headings */
    .section-heading-row { flex-direction: column; align-items: stretch; }

    /* Consent */
    .consent-actions { justify-content: stretch; }
    .consent-actions .btn { flex: 1; justify-content: center; }
    body.consent-open { padding-bottom: 260px; }

    /* Pagination touch targets */
    .pagination a, .pagination strong { width: 38px; height: 38px; }
}

@media (max-width: 980px) {
    body.admin-panel {
        padding-left: 0;
    }

    body.admin-panel .navbar {
        position: sticky;
        width: 100%;
        max-width: 100%;
        top: 0;
        bottom: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 0.85rem 1rem;
        gap: 0.7rem;
    }

    body.admin-panel .navbar-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.45rem;
    }

    body.admin-panel .navbar-links a {
        flex: 1 1 210px;
    }

    body.admin-panel .admin-lang-form {
        width: auto;
        min-width: 180px;
    }
}
