/* ============================================
   LAO VOICES - Blog Platform
   Editorial typography-first design
   ============================================ */

:root {
    --primary: #e11d48;
    --primary-dark: #be123c;
    --primary-light: #f43f5e;
    --primary-rgb: 225, 29, 72;
    --accent: #f59e0b;

    --bg: #ffffff;
    --bg-alt: #fafaf9;
    --bg-warm: #fef7ed;
    --bg-card: #ffffff;
    --text: #1c1917;
    --text-muted: #78716c;
    --text-light: #a8a29e;
    --border: #e7e5e4;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.1);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius: 12px;
    --radius-lg: 18px;
    --transition: all 0.2s ease;

    --font: 'Noto Sans Lao Looped', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Lora', Georgia, serif;

    --font-display: 'Noto Sans Lao Looped', 'Playfair Display', Georgia, sans-serif;

    --nav-h: 64px;
    --content-width: 720px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; transition: var(--transition); }
ul { list-style: none; }
img { max-width: 100%; display: block; }

input, textarea, select {
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    width: 100%;
    transition: var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

label { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; color: var(--text-muted); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--content-width); margin: 0 auto; padding: 0 24px; }

/* ============ NAVBAR ============ */
.navbar {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    height: var(--nav-h);
}

.nav-container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    height: 100%;
    gap: 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.brand-emoji { font-size: 1.6rem; }

.brand-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text);
    font-weight: 800;
}

.nav-search-wrapper {
    max-width: 380px;
    justify-self: center;
    width: 100%;
}

.nav-search {
    position: relative;
    background: var(--bg-alt);
    border-radius: 30px;
    padding: 8px 16px 8px 40px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-search:focus-within {
    background: white;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.nav-search i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nav-search input {
    border: none;
    padding: 4px 0;
    background: transparent;
    font-size: 0.9rem;
    box-shadow: none !important;
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-alt);
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

@media (max-width: 800px) {
    .nav-search-wrapper { display: none; }
    .nav-container { grid-template-columns: auto 1fr auto; }
    .menu-toggle { display: flex; }
    .nav-actions.mobile-hidden { display: none; }
}

.user-menu-wrap { position: relative; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: 30px;
    background: var(--bg-alt);
    transition: var(--transition);
    cursor: pointer;
}

.user-btn:hover { background: rgba(var(--primary-rgb), 0.08); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-avatar-name { font-weight: 600; font-size: 0.9rem; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 240px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: var(--transition);
    z-index: 200;
}

.user-menu-wrap.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text);
}

.user-dropdown a:hover { background: var(--bg-alt); color: var(--primary); }
.user-dropdown a.danger:hover { background: rgba(239,68,68,0.1); color: var(--danger); }

.user-dropdown-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.user-dropdown-header .name { font-weight: 700; }
.user-dropdown-header .username { font-size: 0.8rem; color: var(--text-muted); }

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.3);
}

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ APP LOADER ============ */
.app-loader {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.loader-emoji { font-size: 4rem; animation: bounce 1s infinite; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.page { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ HERO ============ */
.hero-section {
    padding: 60px 0 40px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(ellipse at top right, rgba(225,29,72,0.06), transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(245,158,11,0.06), transparent 50%);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 12px;
}

.hero-title .accent { color: var(--primary); font-style: italic; }

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

/* ============ CATEGORY PILLS ============ */
.category-pills {
    display: flex;
    gap: 8px;
    padding: 24px 0;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: center;
    flex-wrap: wrap;
}

.category-pills::-webkit-scrollbar { display: none; }

.category-pill {
    padding: 8px 20px;
    background: var(--bg-alt);
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid transparent;
    white-space: nowrap;
}

.category-pill:hover { background: var(--bg-warm); }
.category-pill.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

/* ============ FEATURED POST ============ */
.featured-section {
    padding: 40px 0 20px;
}

.featured-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    align-items: center;
    background: var(--bg-alt);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 40px;
    cursor: pointer;
    transition: var(--transition);
}

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

@media (max-width: 800px) {
    .featured-hero { grid-template-columns: 1fr; padding: 24px; gap: 24px; }
}

.featured-cover {
    aspect-ratio: 16/10;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.featured-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), transparent 60%);
}

.featured-content .category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.featured-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.featured-excerpt {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

/* ============ POST GRID ============ */
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-top: 40px;
}

.section-heading h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}

.post-card {
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.post-card:hover .post-title { color: var(--primary); }
.post-card:hover .post-cover { transform: scale(1.02); box-shadow: var(--shadow-md); }

.post-cover {
    aspect-ratio: 16/10;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.post-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), transparent 60%);
}

.post-featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,0.95);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-tag-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.post-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--transition);
}

.post-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 14px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.post-meta-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.post-meta-author:hover { color: var(--primary); }

.avatar-mini {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    background: var(--primary);
    flex-shrink: 0;
}

.post-meta-dot {
    color: var(--text-light);
    font-size: 0.4rem;
}

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

/* ============ POST DETAIL ============ */
.post-detail {
    padding: 40px 0 80px;
}

.post-detail-header {
    text-align: center;
    max-width: 780px;
    margin: 0 auto 40px;
    padding: 0 24px;
}

.post-detail-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.post-detail-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -1px;
    margin-bottom: 20px;
}

.post-detail-excerpt {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 28px;
}

.post-detail-author {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 8px 8px;
    background: var(--bg-alt);
    border-radius: 30px;
    text-align: left;
}

.avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
}

.author-info-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 0.85rem;
}

.author-info-name { font-weight: 700; color: var(--text); }
.author-info-date { color: var(--text-muted); font-size: 0.75rem; }

.post-detail-cover {
    max-width: 900px;
    margin: 0 auto 40px;
    aspect-ratio: 21/9;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.post-detail-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.2), transparent 60%);
}

/* Post actions bar */
.post-actions-bar {
    max-width: var(--content-width);
    margin: 0 auto 30px;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.post-actions-left, .post-actions-right {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-btn-round {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
}

.action-btn-round:hover { background: var(--bg-alt); color: var(--text); }
.action-btn-round.liked { color: var(--primary); }
.action-btn-round.liked:hover { background: rgba(var(--primary-rgb), 0.1); }
.action-btn-round.bookmarked { color: var(--accent); }

/* Post content (markdown rendered) */
.post-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 24px;
    font-family: 'Noto Sans Lao Looped', sans-serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--text);
}

.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
    font-family: 'Noto Sans Lao Looped', sans-serif;
    font-weight: 700;
    margin: 2em 0 0.5em;
    line-height: 1.4;
    letter-spacing: 0;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }
.post-content h4 { font-size: 1.1rem; }

.post-content p { margin-bottom: 1.5em; }

.post-content strong { color: var(--text); font-weight: 700; }
.post-content em { font-style: italic; color: var(--text); }

.post-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.post-content ul, .post-content ol {
    margin: 0 0 1.5em 1.5em;
}

.post-content li { margin-bottom: 0.5em; padding-left: 0.5em; }
.post-content ul li { list-style: disc; }
.post-content ol li { list-style: decimal; }

.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 8px 24px;
    margin: 24px 0;
    background: var(--bg-warm);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--text);
}

.post-content code {
    background: var(--bg-alt);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.post-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: 1em;
}

.post-content img { border-radius: 12px; margin: 24px auto; }

.post-content hr {
    border: none;
    border-top: 2px dashed var(--border);
    margin: 40px auto;
    max-width: 100px;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-family: var(--font);
    font-size: 0.95rem;
}

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

.post-content th {
    background: var(--bg-alt);
    font-weight: 700;
}

/* Post tags */
.post-tags {
    max-width: var(--content-width);
    margin: 40px auto 0;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    padding: 4px 12px;
    background: var(--bg-alt);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.tag:hover { background: var(--primary); color: white; }

/* Author bio card */
.author-bio-card {
    max-width: var(--content-width);
    margin: 60px auto 0;
    padding: 32px;
    background: var(--bg-alt);
    border-radius: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

@media (max-width: 600px) {
    .author-bio-card { flex-direction: column; text-align: center; padding: 24px; }
}

.author-bio-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
}

.author-bio-content h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.author-bio-username { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 10px; }
.author-bio-bio { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }

/* ============ COMMENTS ============ */
.comments-section {
    max-width: var(--content-width);
    margin: 60px auto 0;
    padding: 0 24px;
}

.comments-heading {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-form {
    background: var(--bg-alt);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 32px;
}

.comment-form textarea {
    background: white;
    border-radius: 10px;
    min-height: 100px;
    resize: vertical;
    font-family: var(--font);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

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

.comment {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

.comment-body { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 12px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.comment-author strong { font-weight: 700; }
.comment-time { color: var(--text-muted); font-size: 0.8rem; }

.comment-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}

.comment-delete {
    color: var(--danger);
    background: transparent;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    opacity: 0;
    transition: var(--transition);
}

.comment:hover .comment-delete { opacity: 1; }
.comment-delete:hover { background: rgba(239,68,68,0.1); }

/* ============ AUTHOR PAGE ============ */
.author-hero {
    padding: 60px 0;
    text-align: center;
    background:
        radial-gradient(ellipse at center, rgba(225,29,72,0.06), transparent 60%);
    border-bottom: 1px solid var(--border);
}

.author-hero-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.author-hero h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.author-hero-username { color: var(--text-muted); font-size: 1rem; margin-bottom: 16px; }

.author-hero-bio {
    max-width: 500px;
    margin: 0 auto 24px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.author-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.author-stat-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.author-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============ DASHBOARD ============ */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: start;
    padding: 40px 0;
}

@media (max-width: 900px) {
    .dashboard-layout { grid-template-columns: 1fr; gap: 20px; }
}

.dashboard-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
}

.dashboard-nav {
    background: var(--bg-alt);
    border-radius: 14px;
    padding: 12px;
}

.dashboard-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 2px;
    transition: var(--transition);
}

.dashboard-nav a:hover { background: white; color: var(--primary); }
.dashboard-nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

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

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Dashboard stat cards */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.dash-stat {
    padding: 20px;
    background: var(--bg-alt);
    border-radius: 14px;
    transition: var(--transition);
}

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

.dash-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 12px;
}

.dash-stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.dash-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* My post row */
.my-post-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 16px;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: 12px;
    margin-bottom: 10px;
    align-items: center;
    transition: var(--transition);
}

@media (max-width: 600px) {
    .my-post-row { grid-template-columns: 60px 1fr; }
    .my-post-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

.my-post-row:hover { transform: translateX(2px); }

.my-post-cover {
    aspect-ratio: 1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.my-post-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.my-post-actions {
    display: flex;
    gap: 4px;
}

.status-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.published { background: rgba(34,197,94,0.15); color: var(--success); }
.status-badge.draft { background: rgba(148,163,184,0.2); color: #64748b; }

/* ============ EDITOR ============ */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 30px 0 60px;
    min-height: calc(100vh - var(--nav-h) - 40px);
}

@media (max-width: 900px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-preview { display: none; }
    .editor-layout.preview-mode .editor-input { display: none; }
    .editor-layout.preview-mode .editor-preview { display: block; }
}

.editor-input {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-title-input {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: white;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.editor-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px;
    gap: 12px;
}

@media (max-width: 600px) {
    .editor-meta-row { grid-template-columns: 1fr; }
}

.editor-content {
    flex: 1;
    min-height: 500px;
    padding: 20px;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.7;
    resize: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
}

.editor-preview {
    padding: 30px;
    background: var(--bg-alt);
    border-radius: 12px;
    overflow-y: auto;
    max-height: calc(100vh - var(--nav-h) - 80px);
}

.editor-preview-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.editor-preview-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.8;
}

.editor-preview-content h1,
.editor-preview-content h2,
.editor-preview-content h3 {
    font-family: var(--font);
    font-weight: 800;
    margin: 1.5em 0 0.5em;
}

.editor-preview-content h1 { font-size: 1.6rem; }
.editor-preview-content h2 { font-size: 1.4rem; }
.editor-preview-content h3 { font-size: 1.2rem; }
.editor-preview-content p { margin-bottom: 1em; }
.editor-preview-content ul, .editor-preview-content ol { margin: 0 0 1em 1.5em; }
.editor-preview-content ul li { list-style: disc; }
.editor-preview-content ol li { list-style: decimal; }
.editor-preview-content code { background: var(--border); padding: 2px 6px; border-radius: 4px; }
.editor-preview-content pre { background: #1e293b; color: white; padding: 16px; border-radius: 8px; overflow-x: auto; }
.editor-preview-content pre code { background: transparent; color: inherit; }
.editor-preview-content blockquote { border-left: 3px solid var(--primary); padding-left: 12px; margin: 12px 0; color: var(--text-muted); }
.editor-preview-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.editor-preview-content th, .editor-preview-content td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; }
.editor-preview-content th { background: var(--border); }

.editor-toolbar {
    position: sticky;
    top: var(--nav-h);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    z-index: 50;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 -24px;
    padding: 12px 24px;
}

.editor-toolbar-left {
    display: flex;
    gap: 6px;
    align-items: center;
}

.editor-md-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--bg-alt);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.editor-md-btn:hover { background: var(--primary); color: white; }

.editor-toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.editor-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-emoji-color {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-alt);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.editor-emoji-input {
    width: 40px;
    padding: 4px;
    text-align: center;
    font-size: 1.4rem;
    border: none;
    background: transparent;
}

.editor-color-input {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active { opacity: 1; visibility: visible; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal.active .modal-dialog { transform: scale(1); }
.modal-dialog.large { max-width: 700px; }

.modal-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
}

.modal-footer:empty { display: none; }

.form-group { margin-bottom: 14px; }

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: calc(var(--nav-h) + 12px);
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast {
    background: var(--text);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.warning { background: #ca8a04; }

@keyframes toastIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ EMPTY / LOADER ============ */
.empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-emoji { font-size: 4rem; margin-bottom: 12px; opacity: 0.5; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-family: var(--font-display); }

.loading-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--primary);
    font-size: 1.4rem;
}

/* ============ FOOTER ============ */
.footer {
    background: var(--bg-alt);
    padding: 50px 0 20px;
    border-top: 1px solid var(--border);
    margin-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

@media (max-width: 800px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 500px) {
    .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 10px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer h4 { color: var(--text); font-size: 0.95rem; margin-bottom: 12px; }

.footer ul li { margin-bottom: 6px; font-size: 0.9rem; }
.footer ul li a { color: var(--text-muted); }
.footer ul li a:hover { color: var(--primary); }

.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============ AUTH PAGE ============ */
.auth-body {
    background: linear-gradient(135deg, #e11d48, #f59e0b);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}

.auth-shape.shape-1 {
    width: 500px; height: 500px;
    background: #e11d48;
    top: -100px; left: -100px;
}

.auth-shape.shape-2 {
    width: 400px; height: 400px;
    background: #f59e0b;
    bottom: -100px; right: -100px;
}

.auth-container { max-width: 440px; width: 100%; position: relative; z-index: 1; }

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 30px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    font-size: 0.85rem;
}

.auth-back:hover { background: rgba(255,255,255,0.3); }

.auth-card {
    background: white;
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}

.auth-header { text-align: center; margin-bottom: 24px; }

.auth-logo {
    font-size: 3.5rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
    display: inline-block;
}

.auth-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 4px;
    font-weight: 800;
}

.auth-header p { color: var(--text-muted); font-size: 0.9rem; }

.auth-tabs {
    display: flex;
    background: var(--bg-alt);
    padding: 4px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border-radius: 25px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.password-wrapper { position: relative; }

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px;
    color: var(--text-muted);
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-auth:hover:not(:disabled) { background: var(--primary-dark); }

.btn-auth .btn-loading { display: none; }
.btn-auth.loading .btn-text { display: none; }
.btn-auth.loading .btn-loading { display: inline; }

.alert {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.alert.active { display: block; }
.alert.success { background: rgba(34,197,94,0.15); color: #16a34a; }
.alert.error { background: rgba(239,68,68,0.15); color: #dc2626; }

.auth-demo {
    text-align: center;
    margin-top: 16px;
    padding: 12px;
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: 10px;
    color: var(--primary);
    font-size: 0.8rem;
    line-height: 1.6;
}
