/* ============================================================
   INKWELL BLOG — COMPLETE DESIGN SYSTEM
   CSS Custom Properties, Reset, Typography, Components,
   Dark Mode, Skeleton Loaders, Responsive Layout
   ============================================================ */

/* ---------- Theme Variables ---------- */
:root {
    --bg-primary: #b6c4c5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f6;
    --bg-input: #f1f4f9;
    --text-primary: #0f172a;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: #eef2ff;
    --accent-glow: rgba(99, 102, 241, 0.13);
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #10b981;
    --success-soft: #d1fae5;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --info: #3b82f6;
    --info-soft: #dbeafe;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.10);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
    --nav-h: 68px;
    --max-w: 1200px;
    --skel-base: #e5e7eb;
    --skel-shine: #f9fafb;
    --nav-bg: rgba(255, 255, 255, 0.82);
    --hero-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --card-hover-y: -6px;
    --quill-bg: #ffffff;
    --quill-text: #0f172a;
    --quill-border: #e5e7eb;
    --code-bg: #1b2540;
    --code-text: #e8ecf4;
}

[data-theme="dark"] {
    --bg-primary: #0c1222;
    --bg-secondary: #141c2e;
    --bg-tertiary: #1b2540;
    --bg-input: #1b2540;
    --text-primary: #e8ecf4;
    --text-secondary: #8e9bba;
    --text-tertiary: #4e5e80;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.12);
    --accent-glow: rgba(129, 140, 248, 0.18);
    --border: #1f2d47;
    --border-light: #172035;
    --success-soft: rgba(16, 185, 129, 0.14);
    --warning-soft: rgba(245, 158, 11, 0.14);
    --danger-soft: rgba(239, 68, 68, 0.14);
    --info-soft: rgba(59, 130, 246, 0.14);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.40);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.45);
    --skel-base: #1b2540;
    --skel-shine: #243352;
    --nav-bg: rgba(12, 18, 34, 0.82);
    --hero-grad: linear-gradient(135deg, #4338ca 0%, #7c3aed 50%, #be185d 100%);
    --card-hover-y: -4px;
    --quill-bg: #141c2e;
    --quill-text: #e8ecf4;
    --quill-border: #1f2d47;
    --code-bg: #1b2540;
    --code-text: #e8ecf4;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    overflow-x: hidden
}

img {
    max-width: 100%;
    display: block
}

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

a:hover {
    color: var(--accent-hover)
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit
}

ul,
ol {
    list-style: none
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px
}

::-webkit-scrollbar-track {
    background: var(--bg-primary)
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary)
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.25;
    font-weight: 700;
    color: var(--text-primary)
}

h1 {
    font-size: clamp(2rem, 5vw, 3.2rem)
}

h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem)
}

h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem)
}

p {
    color: var(--text-secondary)
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px
}

.page-padding {
    padding-top: calc(var(--nav-h) + 32px);
    padding-bottom: 64px;
    min-height: 80vh
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: var(--nav-bg);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: background var(--transition), border-color var(--transition)
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity var(--transition)
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent)
}

.nav-brand:hover {
    opacity: .8;
    color: var(--text-primary)
}

.nav-brand svg {
    width: 28px;
    height: 28px;
    color: var(--accent)
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px
}

.nav-links a,
.nav-links button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap
}

.nav-links a:hover,
.nav-links button:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.nav-links a.active {
    background: var(--accent-soft);
    color: var(--accent)
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    color: var(--text-secondary)
}

.theme-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.theme-toggle svg {
    width: 28px;
    height: 28px
}

.dropdown {
    position: relative
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer
}

.dropdown-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.dropdown-toggle svg {
    width: 16px;
    height: 16px;
    margin-left: 4px;
    transition: transform var(--transition)
}

.dropdown-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg)
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition);
    z-index: 1001;
    max-height: 400px;
    overflow-y: auto
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px)
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: .875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition)
}

.dropdown-menu a:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary)
}

.mobile-menu-btn svg {
    width: 22px;
    height: 22px
}

@media(max-width:768px) {
    .dropdown {
        width: 100%
    }

    .dropdown-toggle {
        width: 100%;
        justify-content: space-between
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: var(--bg-tertiary);
        max-height: 0;
        overflow: hidden;
        padding: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: max-height .3s ease, padding .3s ease
    }

    .dropdown-menu.show {
        max-height: 400px;
        transform: none;
        padding: 8px 0
    }

    .dropdown-menu a {
        padding: 12px 24px
    }
}

@media(max-width:768px) {
    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        transform: translateY(-120%);
        opacity: 0;
        transition: all .3s ease;
        pointer-events: none
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto
    }

    .nav-links a,
    .nav-links button {
        width: 100%;
        text-align: left;
        padding: 12px 16px
    }

    .mobile-menu-btn {
        display: flex
    }
}

/* ---------- Hero ---------- */
.hero {
    background: var(--hero-grad);
    padding: 100px 24px 80px;
    margin-top: var(--nav-h);
    text-align: center;
    position: relative;
    overflow: hidden
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")
}

.hero h1 {
    font-family: var(--font-display);
    color: #fff;
    font-size: clamp(2.5rem, 6vw, 4.2rem);
    margin-bottom: 16px;
    position: relative
}

.hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(1rem, 2vw, 1.25rem);
    max-width: 600px;
    margin: 0 auto 32px;
    position: relative
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition);
    position: relative;
    backdrop-filter: blur(8px)
}

.hero-cta:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    transform: translateY(-2px)
}

/* ---------- Section Titles ---------- */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px
}

.section-title h2 {
    font-size: 1.5rem
}

.section-title .filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

/* ---------- Search ---------- */
.search-box {
    position: relative;
    max-width: 400px;
    width: 100%
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: .875rem;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow)
}

.search-box input::placeholder {
    color: var(--text-tertiary)
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    pointer-events: none
}

.search-box .search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    pointer-events: auto;
    border: none;
    padding: 0
}

.search-box .search-clear:hover {
    background: var(--danger-soft);
    color: var(--danger)
}

.search-box .search-clear svg {
    position: static;
    transform: none;
    width: 14px;
    height: 14px;
    pointer-events: none
}

.search-box input:not(.has-value)~.search-clear,
.search-box input:not([value*=""])~.search-clear {
    display: none
}

.search-box input.has-value~.search-clear {
    display: flex
}

/* ---------- Password Input with Toggle ---------- */
.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center
}

.password-input-wrap .form-input {
    padding-right: 40px;
    width: 100%
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    background: none;
    border: none;
    padding: 0;
    transition: color var(--transition)
}

.password-toggle:hover {
    color: var(--text-secondary)
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    pointer-events: none
}

/* ---------- Category Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    gap: 10px 16px
}

.badge-tech {
    background: var(--info-soft);
    color: var(--info)
}

.badge-design {
    background: #fce7f3;
    color: #be185d
}

[data-theme="dark"] .badge-design {
    background: rgba(190, 24, 93, 0.14);
    color: #f9a8d4
}

.badge-lifestyle {
    background: var(--success-soft);
    color: var(--success)
}

.badge-business {
    background: var(--warning-soft);
    color: var(--warning)
}

.badge-general {
    background: var(--bg-tertiary);
    color: var(--text-secondary)
}

.badge-status {
    padding: 4px 10px;
    font-size: .7rem
}

.badge-published {
    background: var(--success-soft);
    color: var(--success)
}

.badge-draft {
    background: var(--warning-soft);
    color: var(--warning)
}

/* ---------- Post Grid ---------- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px
}

@media(max-width:480px) {
    .post-grid {
        grid-template-columns: 1fr
    }
}

/* ---------- Featured Post ---------- */
.featured-post {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
    border: 1px solid var(--border-light);
    margin-bottom: 40px
}

.featured-post:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px)
}

.featured-post .fp-image {
    height: 100%;
    min-height: 320px;
    background-size: cover;
    background-position: center;
    position: relative
}

.featured-post .fp-image::after {
    content: 'FEATURED';
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--accent);
    color: #fff;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em
}

.featured-post .fp-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px
}

.featured-post .fp-content h2 {
    font-size: 1.75rem;
    line-height: 1.3
}

.featured-post .fp-content h2 a {
    color: var(--text-primary);
    text-decoration: none
}

.featured-post .fp-content h2 a:hover {
    color: var(--accent)
}

.featured-post .fp-content p {
    color: var(--text-secondary);
    font-size: .95rem;
    line-height: 1.7
}

.featured-post .fp-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: .8rem;
    color: var(--text-tertiary)
}

.featured-post .fp-meta svg {
    width: 14px;
    height: 14px
}

.featured-post .fp-meta span {
    display: flex;
    align-items: center;
    gap: 5px
}

@media(max-width:768px) {
    .featured-post {
        grid-template-columns: 1fr
    }

    .featured-post .fp-image {
        min-height: 220px
    }

    .featured-post .fp-content {
        padding: 24px
    }
}

/* ---------- Post Card ---------- */
.post-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(var(--card-hover-y))
}

.post-card .card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative
}

.post-card .card-image .badge {
    position: absolute;
    top: 14px;
    left: 14px
}

.post-card .card-body {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.post-card .card-body h3 {
    font-size: 1.15rem;
    line-height: 1.35
}

.post-card .card-body h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition)
}

.post-card .card-body h3 a:hover {
    color: var(--accent)
}

.post-card .card-body .excerpt {
    color: var(--text-secondary);
    font-size: .88rem;
    line-height: 1.65;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis
}

.post-card .card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .78rem;
    color: var(--text-tertiary);
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-top: auto
}

.post-card .card-meta svg {
    width: 13px;
    height: 13px
}

.post-card .card-meta span {
    display: flex;
    align-items: center;
    gap: 4px
}

/* ---------- Post Reading View ---------- */
.post-view {
    max-width: 780px;
    margin: 0 auto;
    padding-top: calc(var(--nav-h) + 48px);
    padding-bottom: 80px
}

.post-view .post-header {
    text-align: center;
    margin-bottom: 48px
}

.post-view .post-header .badge {
    margin-bottom: 16px
}

.post-view .post-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 20px;
    line-height: 1.2
}

.post-view .post-header .post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: var(--text-tertiary);
    font-size: .85rem
}

.post-view .post-header .post-meta svg {
    width: 15px;
    height: 15px
}

.post-view .post-header .post-meta span {
    display: flex;
    align-items: center;
    gap: 5px
}

.post-view .post-cover {
    width: 100%;
    height: auto;
    max-height: 460px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 48px
}

.post-view .post-body {
    font-size: 1.08rem;
    line-height: 1.85;
    color: var(--text-secondary)
}

.post-view .post-body h1,
.post-view .post-body h2,
.post-view .post-body h3 {
    margin: 36px 0 16px;
    color: var(--text-primary)
}

.post-view .post-body p {
    margin-bottom: 20px
}

.post-view .post-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-secondary)
}

.code-block-wrapper {
    position: relative;
    margin: 24px 0;
}

.post-view .post-body pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 20px;
    padding-top: 40px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: .88rem;
    margin: 0;
    border: 1px solid var(--border)
}

.code-hdr {
    position: absolute;
    top: 1px;
    right: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(45, 45, 45, 0.95);
    padding: 2px 4px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: var(--radius-md);
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.code-lang {
    color: #b58900;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.copy-code-btn {
    background: transparent;
    color: #8e9bba;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.82rem;
    font-family: var(--font-sans);
}

.copy-code-btn:hover {
    color: #ffffff;
    background: transparent;
}

.post-view .post-body code {
    font-family: var(--font-mono);
    background: #b3b4b6; /* added by me*/
    color: #000000;  /* added by me*/
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .88em
}

.post-view .post-body pre code {
    background: none;
    padding: 0
}

.post-view .post-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 24px 0
}

.post-view .post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px
}

.post-view .post-body ul,
.post-view .post-body ol {
    margin: 16px 0 16px 28px
}

.post-view .post-body li {
    margin-bottom: 8px
}

.post-view .post-body ul li {
    list-style: disc
}

.post-view .post-body ol li {
    list-style: decimal
}

/* ---------- Post Body — Table Styles (GFM markdown tables) ---------- */
.post-view .post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
}

.post-view .post-body thead {
    background: var(--bg-tertiary);
}

.post-view .post-body th {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.post-view .post-body th:last-child {
    border-right: none;
}

.post-view .post-body td {
    padding: 11px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    line-height: 1.6;
}

.post-view .post-body td:last-child {
    border-right: none;
}

.post-view .post-body tr:last-child td {
    border-bottom: none;
}

.post-view .post-body tbody tr:hover td {
    background: var(--accent-soft);
}

.post-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    gap: 16px
}

.post-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    max-width: 48%
}

.post-nav a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft)
}

.post-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0
}

.post-nav-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

/* ---------- Admin Layout ---------- */
.admin-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0;
    min-height: calc(100vh - var(--nav-h))
}

.admin-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 28px 0;
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h))
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none
}

.admin-sidebar a:hover {
    background: var(--accent-soft);
    color: var(--accent)
}

.admin-sidebar a.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600
}

.admin-sidebar a svg {
    width: 18px;
    height: 18px
}

.admin-sidebar .sidebar-section {
    padding: 0 24px;
    margin-bottom: 12px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-tertiary)
}

.sidebar-collapse-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-tertiary)
}

.sidebar-collapse-toggle:hover {
    color: var(--accent)
}

.sidebar-collapse-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 3
}

.collapse-icon.hidden {
    display: none
}

.sidebar-collapse-text {
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap
}

.admin-sidebar.collapsed .sidebar-collapse-text,
.admin-sidebar.collapsed .sidebar-section,
.admin-sidebar.collapsed .sidebar-label {
    display: none
}

.admin-sidebar.collapsed .sidebar-section-collapsed {
    display: none
}

.admin-sidebar.collapsed .sidebar-icon {
    margin: 0 auto
}

.admin-sidebar.collapsed a {
    padding: 11px 0;
    justify-content: center;
    border-left: none;
    border-right: 3px solid transparent;
    cursor: pointer
}

.admin-sidebar.collapsed a.active {
    border-right-color: var(--accent)
}

.admin-sidebar.collapsed .sidebar-collapse-toggle {
    padding: 8px 0;
    justify-content: center;
    cursor: pointer
}

.admin-sidebar.collapsed .sidebar-label,
.admin-sidebar.collapsed .sidebar-collapse-text,
.admin-sidebar.collapsed .sidebar-section,
.admin-sidebar.collapsed .sidebar-section-collapsed {
    display: none
}

.admin-sidebar.collapsed {
    padding: 28px 0;
    width: 64px;
    flex-shrink: 0
}

.admin-content {
    padding: 32px;
    overflow-y: auto
}

/* Post Hero with Background Image */
.post-hero-bg {
    position: relative;
    min-height: 70vh;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    padding: 100px 24px 60px;
    margin: calc(-1 * var(--nav-h)) calc(-50vw + 50%);
    padding-top: calc(var(--nav-h) + 60px);
    width: 100vw;
    left: 0;
    right: 0
}

.post-hero-bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(1px)
}

.post-hero-bg-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    color: #fff;
    width: 100%
}

.post-back-link-bg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: color 0.2s ease;
    white-space: nowrap
}

.post-back-link-bg:hover {
    color: #fff
}

.post-back-link-bg svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0
}

.post-title-bg {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin: 12px 0 20px;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4)
}

.post-meta-bg {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px 24px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85)
}

.post-meta-bg span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap
}

.post-meta-bg svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0
}

.post-body-wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px
}

/* Go to Top Floating Button */
.go-to-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none
}

.go-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0)
}

.go-to-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl)
}

/* Admin Sidebar Mobile Toggle */
.admin-sidebar-toggle-inline {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition)
}

.admin-sidebar-toggle-inline:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent)
}

.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease
}

.admin-sidebar-overlay.visible {
    display: block;
    opacity: 1
}

@media(max-width:860px) {
    .admin-layout {
        grid-template-columns: 1fr
    }

    .admin-sidebar {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        bottom: 0;
        width: 260px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: block;
        height: calc(100vh - var(--nav-h));
        box-shadow: var(--shadow-xl)
    }

    .admin-sidebar.open {
        transform: translateX(0)
    }

    /* On mobile, collapsed class shows sidebar normally (not hidden) since hamburger controls visibility */
    .admin-sidebar.collapsed {
        transform: translateX(-100%)
    }

    /* On mobile, reset all collapsed states - sidebar shows full content when opened via hamburger */
    .admin-sidebar.collapsed .sidebar-collapse-text,
    .admin-sidebar.collapsed .sidebar-section,
    .admin-sidebar.collapsed .sidebar-label {
        display: block
    }

    .admin-sidebar.collapsed .sidebar-section-collapsed {
        display: none
    }

    .admin-sidebar.collapsed .sidebar-icon {
        width: 18px;
        height: 18px
    }

    .admin-sidebar.collapsed a {
        display: flex;
        padding: 11px 24px
    }

    .admin-sidebar.collapsed a.active {
        background: var(--accent-soft);
        color: var(--accent);
        border-left-color: var(--accent)
    }

    .admin-sidebar.collapsed .sidebar-collapse-toggle {
        display: flex
    }

    .admin-sidebar-toggle-inline {
        display: flex !important
    }

    .admin-content {
        padding: 24px 16px
    }
}

/* ---------- Stat Cards ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all var(--transition)
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px)
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px
}

.stat-card .stat-icon svg {
    width: 22px;
    height: 22px
}

.stat-card .stat-icon.blue {
    background: var(--info-soft);
    color: var(--info)
}

.stat-card .stat-icon.green {
    background: var(--success-soft);
    color: var(--success)
}

.stat-card .stat-icon.amber {
    background: var(--warning-soft);
    color: var(--warning)
}

.stat-card .stat-icon.purple {
    background: var(--accent-soft);
    color: var(--accent)
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1
}

.stat-card .stat-label {
    font-size: .82rem;
    color: var(--text-tertiary);
    margin-top: 6px
}

/* ---------- Data Table ---------- */
.data-table-wrap {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden
}

.data-table {
    width: 100%;
    border-collapse: collapse
}

.data-table thead {
    background: var(--bg-tertiary)
}

.data-table th {
    padding: 14px 18px;
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border)
}

.data-table td {
    padding: 10px 14px;
    font-size: .81rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle
}

.data-table tr:last-child td {
    border-bottom: none
}

.data-table tr:hover td {
    background: var(--accent-soft)
}

.data-table .td-title {
    font-weight: 600;
    color: var(--text-primary);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.table-actions {
    display: flex;
    gap: 6px
}

.table-actions button {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    color: var(--text-tertiary)
}

.table-actions button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary)
}

.table-actions button.danger:hover {
    background: var(--danger-soft);
    color: var(--danger)
}

.table-actions button svg {
    width: 16px;
    height: 16px
}

@media(max-width:768px) {
    .data-table-wrap {
        overflow: visible;
        border: none;
        background: transparent
    }

    .data-table {
        display: flex;
        flex-direction: column
    }

    .data-table thead {
        display: none
    }

    .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0
    }

    .data-table tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 12px
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
        font-size: .875rem
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-tertiary);
        font-size: .75rem;
        text-transform: uppercase;
        letter-spacing: .04em
    }

    .data-table .td-title {
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: unset
    }

    .table-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-light)
    }

    .table-actions button:first-child {
        flex: 1;
        min-width: 100px;
        width: auto
    }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    outline: none
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-glow)
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md)
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border)
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger)
}

.btn-danger:hover {
    opacity: .9;
    transform: translateY(-1px)
}

.btn-ghost {
    color: var(--text-secondary);
    padding: 8px 14px
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary)
}

.btn-sm {
    padding: 7px 14px;
    font-size: .8rem
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem
}

.btn svg {
    width: 18px;
    height: 18px
}

.btn-sm svg {
    width: 15px;
    height: 15px
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 20px
}

.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 7px
}

.form-group .helper {
    font-size: .75rem;
    color: var(--text-tertiary);
    margin-top: 5px
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-secondary)
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary)
}

.form-textarea {
    resize: vertical;
    min-height: 100px
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px
}

@media(max-width:540px) {
    .form-row {
        grid-template-columns: 1fr
    }
}

.form-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 520px;
    margin: 0 auto
}

.form-card h2 {
    margin-bottom: 8px;
    font-size: 1.5rem
}

.form-card .form-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: .92rem
}

/* ---------- Quill Editor Overrides ---------- */
.ql-toolbar.ql-snow {
    border: 1.5px solid var(--quill-border) !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    background: var(--bg-tertiary) !important
}

.ql-container.ql-snow {
    border: 1.5px solid var(--quill-border) !important;
    border-top: none !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    background: var(--quill-bg) !important;
    font-family: var(--font-sans) !important;
    font-size: 1rem !important;
    min-height: 300px
}

.ql-editor {
    color: var(--quill-text) !important;
    min-height: 500px
}

.ql-editor.ql-blank::before {
    color: var(--text-tertiary) !important;
    font-style: normal !important
}

.ql-snow .ql-stroke {
    stroke: var(--text-secondary) !important
}

.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
    fill: var(--text-secondary) !important
}

.ql-snow .ql-picker-label {
    color: var(--text-secondary) !important
}

.ql-snow .ql-picker-options {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
    border-radius: var(--radius-sm) !important
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto
}

.modal-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    padding: 32px;
    transform: translateY(16px) scale(.97);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    position: relative
}

.modal-overlay.visible .modal-box {
    transform: translateY(0) scale(1)
}

.modal-box h3 {
    font-size: 1.2rem;
    margin-bottom: 10px
}

.modal-box p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-bottom: 24px;
    line-height: 1.6
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--transition)
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary)
}

.modal-close svg {
    width: 18px;
    height: 18px
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: calc(var(--nav-h) + 16px);
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    transform: translateX(120%);
    animation: toastIn .35s cubic-bezier(.4, 0, .2, 1) forwards;
    max-width: 380px
}

.toast.removing {
    animation: toastOut .3s ease forwards
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0
}

.toast.success {
    border-left: 4px solid var(--success)
}

.toast.success svg {
    color: var(--success)
}

.toast.error {
    border-left: 4px solid var(--danger)
}

.toast.error svg {
    color: var(--danger)
}

.toast.warning {
    border-left: 4px solid var(--warning)
}

.toast.warning svg {
    color: var(--warning)
}

.toast.info {
    border-left: 4px solid var(--info)
}

.toast.info svg {
    color: var(--info)
}

@keyframes toastIn {
    to {
        transform: translateX(0)
    }
}

@keyframes toastOut {
    to {
        transform: translateX(120%);
        opacity: 0
    }
}

/* ---------- Skeleton Loader ---------- */
.skeleton {
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--skel-base) 25%, var(--skel-shine) 50%, var(--skel-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite
}

@keyframes shimmer {
    0% {
        background-position: 200% 0
    }

    100% {
        background-position: -200% 0
    }
}

.skel-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light)
}

.skel-card .skel-img {
    height: 200px
}

.skel-card .skel-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px
}

.skel-card .skel-line {
    height: 14px;
    border-radius: 6px
}

.skel-card .skel-line.w60 {
    width: 60%
}

.skel-card .skel-line.w80 {
    width: 80%
}

.skel-card .skel-line.w40 {
    width: 40%
}

.skel-card .skel-title {
    height: 22px;
    width: 85%;
    border-radius: 6px
}

.skel-featured {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: 40px
}

.skel-featured .skel-img {
    min-height: 320px
}

.skel-featured .skel-body {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center
}

@media(max-width:768px) {
    .skel-featured {
        grid-template-columns: 1fr
    }

    .skel-featured .skel-img {
        min-height: 200px
    }
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px
}

.pagination button {
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft)
}

.pagination button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.pagination button:disabled {
    opacity: .4;
    cursor: not-allowed
}

.pagination button svg {
    width: 16px;
    height: 16px
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-tertiary)
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    opacity: .4
}

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

.empty-state p {
    font-size: .9rem;
    margin-bottom: 24px
}

/* ---------- Footer ---------- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 24px;
    text-align: center
}

.footer p {
    font-size: .85rem;
    color: var(--text-tertiary)
}

.footer a {
    color: var(--accent)
}

/* ---------- Setup / Auth Pages ---------- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-h));
    padding: 40px 24px
}

.setup-steps {
    display: flex;
    gap: 8px;
    margin-bottom: 28px
}

.setup-step {
    flex: 1;
    height: 4px;
    border-radius: 99px;
    background: var(--border)
}

.setup-step.done {
    background: var(--accent)
}

/* ---------- Tab bar ---------- */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px
}

.tab-bar button {
    padding: 12px 20px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition)
}

.tab-bar button:hover {
    color: var(--text-primary)
}

.tab-bar button.active {
    color: var(--accent);
    border-bottom-color: var(--accent)
}

/* ---------- Utilities ---------- */
.hidden {
    display: none !important
}

.text-center {
    text-align: center
}

.mb-4 {
    margin-bottom: 16px
}

.mb-8 {
    margin-bottom: 32px
}

.mt-4 {
    margin-top: 16px
}

.flex {
    display: flex
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.gap-2 {
    gap: 8px
}

.gap-4 {
    gap: 16px
}

.flex-wrap {
    flex-wrap: wrap
}

.w-full {
    width: 100%
}

/* ---------- Transition for page changes ---------- */
.page-enter {
    animation: pageIn .3s ease forwards
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(12px)
    }
    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ---------- Quill Find-Replace Toolbar Button ---------- */
.ql-find-replace {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: max-content !important;
    white-space: nowrap !important;
    gap: 6px;
    padding: 0 8px !important;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.ql-find-replace:hover {
    color: var(--primary) !important;
}

.ql-find-replace svg {
    width: 18px !important;
    height: 18px !important;
}

/* ---------- Find and Replace Panel (Inline below toolbar) ---------- */
.find-replace-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    animation: frSlideDown 0.2s ease-out;
}

@keyframes frSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.find-replace-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.find-replace-input {
    flex: 1;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}

.find-replace-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.find-replace-input::placeholder {
    color: var(--text-tertiary);
}

.find-replace-count {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
    min-width: 30px;
    text-align: center;
    white-space: nowrap;
}

.find-replace-panel .btn-sm {
    padding: 0 14px;
    height: 34px;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.btn-icon-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-icon-sm:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-icon-sm svg {
    width: 16px;
    height: 16px;
}

/* ---------- Reactions ---------- */
.post-reactions-container {
    margin-top: 32px; 
    padding-top: 24px; 
    border-top: 1px solid var(--border);
}

.post-reactions-container h4 {
    margin-bottom: 16px;
}

.post-reactions {
    display: flex; gap: 12px; flex-wrap: wrap;
}

.post-reactions button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
}

.post-reaction-like { color: #45ec0f; }
.post-reaction-love { color: orangered; }
.post-reaction-sad { color: yellow; }
.post-reaction-unknown { color: #00bbff; }

.post-reactions button, .comment-reactions button {
    transition: all 0.2s cubic-bezier(.4, 0, .2, 1) !important;
}

.post-reactions button:hover, .comment-reactions button:hover {
    background-color: #011959 !important;
    color: #fff300 !important;
    transform: scale(1.1);
}

/* ---------- Admin Banner ---------- */
.admin-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    position: sticky;
    top: var(--nav-h);
    z-index: 50;
    justify-content: space-between;
}

.admin-banner.draft {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.admin-banner.published {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.admin-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-banner svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.admin-banner strong {
    font-weight: 700;
}

.admin-banner-btn {
    flex-shrink: 0;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

.admin-banner-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

@media (max-width: 768px) {
    .admin-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .admin-banner-btn {
        align-self: flex-end;
    }
}

/* ---------- Editor Mode Toggle ---------- */
.editor-mode-toggle {
    display: flex;
    gap: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 0;
    border: 1px solid var(--border);
    width: fit-content;
}

.editor-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.01em;
}

.editor-mode-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.editor-mode-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .editor-mode-btn.active {
    box-shadow: 0 2px 8px rgba(129, 140, 248, 0.25);
}

.editor-mode-btn svg {
    width: 15px;
    height: 15px;
}

/* ---------- Markdown Editor ---------- */
.markdown-editor-container {
    border: 1.5px solid var(--quill-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow: hidden;
    background: var(--quill-bg);
}

.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--quill-border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.markdown-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 32px;
    height: 30px;
    padding: 0 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.import-md-btn {
    background: var(--accent);
    color: #fff !important;
    padding: 0 12px;
    font-weight: 600;
    border-radius: 6px;
    margin-right: 4px;
}

.import-md-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.import-md-btn svg {
    width: 14px;
    height: 14px;
}

.markdown-toolbar button:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.markdown-toolbar button svg {
    width: 14px;
    height: 14px;
}

/* Monaco Editor Container */
#monaco-editor-container {
    width: 100%;
    height: 500px;
    min-height: 400px;
    background: var(--quill-bg);
    border: none;
    outline: none;
}

/* Override Monaco's default bg/font so it follows site theme */
.monaco-editor,
.monaco-editor-background,
.monaco-editor .inputarea.ime-input {
    background-color: var(--quill-bg) !important;
}

.markdown-help {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--quill-border);
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.markdown-help svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--accent);
}

.markdown-help kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    box-shadow: 0 1px 0 var(--border);
    line-height: 1;
}

/* ---------- Markdown Preview ---------- */
.markdown-preview {
    min-height: 360px;
    max-height: 700px;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--quill-bg);
    border: 1.5px solid var(--quill-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    color: var(--quill-text);
    font-size: 1rem;
    line-height: 1.8;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-preview h1 { font-size: 1.8rem; }
.markdown-preview h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown-preview h3 { font-size: 1.25rem; }

.markdown-preview p {
    margin-bottom: 1em;
    color: var(--quill-text);
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 0.5em 0 1em 1.5em;
    list-style: revert;
}

.markdown-preview li {
    margin-bottom: 0.25em;
}

.markdown-preview blockquote {
    margin: 1em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.markdown-preview code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--accent);
}

.markdown-preview pre {
    margin: 1em 0;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.markdown-preview pre code {
    display: block;
    padding: 16px 20px;
    background: var(--code-bg);
    color: var(--code-text);
    font-size: 0.88rem;
    line-height: 1.6;
    border-radius: var(--radius-sm);
}

.markdown-preview img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 1em 0;
}

.markdown-preview a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown-preview a:hover {
    color: var(--accent-hover);
}

.markdown-preview hr {
    margin: 2em 0;
    border: none;
    border-top: 1px solid var(--border);
}

.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.markdown-preview th,
.markdown-preview td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-preview th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

/* ---------- Editor Wrapper Visibility ---------- */
#editor-richtext-wrapper.hidden,
#editor-markdown-wrapper.hidden,
#editor-preview-wrapper.hidden {
    display: none;
}

/* Connect mode toggle to editor visually */
#editor-richtext-wrapper .ql-toolbar.ql-snow {
    border-radius: 0 !important;
    border-top: none !important;
}

/* ---------- Cover Image Upload UI ---------- */
.cover-image-input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    overflow: hidden;
}

.cover-input-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.cover-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.cover-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.cover-tab.active {
    color: var(--accent);
    background: var(--bg-primary);
    border-bottom: 2px solid var(--accent);
}

.cover-tab svg {
    width: 16px;
    height: 16px;
}

#cover-url-panel,
#cover-upload-panel {
    padding: 16px;
}

.cover-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.cover-upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.cover-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    color: var(--text-secondary);
}

.cover-upload-content svg {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
}

.cover-upload-content span {
    font-weight: 500;
    color: var(--text-primary);
}

.cover-upload-content small {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

#cover-preview-container {
    padding: 0 16px 16px 16px;
}

.cover-preview {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.cover-preview img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.cover-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all var(--transition);
}

.cover-preview-remove:hover {
    background: var(--danger);
    transform: scale(1.1);
}

.cover-preview-remove svg {
    width: 14px;
    height: 14px;
}

#editor-richtext-wrapper .ql-container.ql-snow {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

.editor-mode-toggle {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: none;
}

/* ---------- Responsive Markdown Editor ---------- */
@media (max-width: 768px) {
    .editor-mode-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .editor-mode-btn span {
        display: none;
    }

    .editor-mode-btn svg {
        width: 18px;
        height: 18px;
    }

    .markdown-toolbar {
        padding: 6px 8px;
    }

    .markdown-toolbar button {
        min-width: 28px;
        height: 26px;
        padding: 0 6px;
        font-size: 0.75rem;
    }

    #monaco-editor-container {
        height: 600px;
        min-height: 320px;
    }

    .markdown-preview {
        min-height: 260px;
        padding: 18px 20px;
    }
}
