:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-dark: #0f172a;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow:0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); font-size: 1rem; line-height: 1.6; color: var(--text-primary); background: var(--bg-primary); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; font-weight: 500; border-radius: var(--radius); transition: var(--transition); cursor: pointer; border: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--text-secondary); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

.badge { display: inline-block; padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 600; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-secondary { background: var(--bg-primary); color: var(--text-secondary); }

.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

.meta-separator { color: var(--text-muted); margin: 0 0.5rem; }

/* ==================== ADMIN COMMON (layout, tables, forms) ==================== */
.admin-content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.admin-content-header h1 { font-size: 1.75rem; font-weight: 700; }

.admin-card { background: var(--bg-secondary); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.admin-card .card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.admin-card .card-body { padding: 1.5rem; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--bg-primary); }
.admin-table td.actions { text-align: right; white-space: nowrap; }

.child-row td { background: var(--bg-primary); }

.filter-form { }
.filter-row { display: flex; gap: 0.75rem; align-items: end; flex-wrap: wrap; }

.form-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  font-size: 0.9rem;
  width: 100%;
  color: #1e293b !important;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.form-input::placeholder { color: #94a3b8; }

.admin-form .form-input {
  color: #1e293b !important;
  background-color: #ffffff !important;
}

.form-input[readonly] {
  background-color: #f8fafc !important;
  color: #64748b !important;
  cursor: not-allowed;
}

.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
.form-main, .form-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group label { font-weight: 500; font-size: 0.9rem; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); }
.form-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.form-actions { display: flex; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.error { font-size: 0.8rem; color: var(--danger); }
.image-preview { margin-bottom: 0.75rem; }
.image-preview img { max-width: 200px; border-radius: var(--radius); }
.inline-form { display: inline; }
.delete-form { margin-left: 0.5rem; }
.pagination-wrapper { margin-top: 1.5rem; }
.text-center { text-align: center; }

/* ==================== TRIX EDITOR ==================== */
.trix-editor {
  min-height: 300px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.trix-editor:focus { border-color: var(--accent); }
.trix-editor .trix-content { outline: none; }

.trix-toolbar .trix-button-group { border-radius: var(--radius-sm); overflow: hidden; }
.trix-toolbar .trix-button { background: var(--bg-primary); border-color: var(--border); }
.trix-toolbar .trix-button:hover { background: var(--bg-secondary); }
.trix-toolbar .trix-button.trix-active { background: var(--accent); color: white; border-color: var(--accent); }

.trix-editor-wrapper { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-secondary); }
.trix-editor-wrapper .trix-toolbar { border-bottom: 1px solid var(--border); padding: 0.5rem; background: var(--bg-primary); }

.form-group:has(.trix-editor) { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group:has(.trix-editor) label { font-weight: 500; font-size: 0.9rem; }

/* ==================== BLOG HERO ==================== */
.blog-hero { background: linear-gradient(135deg, var(--bg-dark) 0%, #1e3a5f 100%); padding: 4rem 0; text-align: center; color: white; }
.blog-hero-small { padding: 3rem 0; }
.hero-badge { display: inline-block; padding: 0.25rem 0.75rem; background: rgba(255,255,255,0.2); border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem; }
.hero-title { font-family: var(--font-serif); font-size: 3rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.hero-subtitle { font-size: 1.25rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }

/* ==================== SEARCH HERO ==================== */
.search-hero { position: relative; min-height: 350px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.search-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.search-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.4) 100%); }
.search-hero-content { position: relative; z-index: 1; text-align: center; color: white; padding: 2rem 0; }
.search-hero-title { font-family: var(--font-serif); font-size: clamp(2.5rem, 6vw, 4.5rem) !important; font-weight: 700; margin-bottom: 0.75rem; line-height: 1.2; }
.search-hero-subtitle { font-size: 1.1rem; opacity: 0.85; max-width: 500px; margin: 0 auto; }

/* ==================== BLOG CONTENT ==================== */
.blog-content { padding: 3rem 0; }
.blog-grid { display: grid; grid-template-columns: 1fr 320px; gap: 3rem; }
.blog-main { min-width: 0; }
.blog-sidebar { position: sticky; top: 100px; height: fit-content; }

.section-header { margin: 2rem 0 1.5rem; }
.section-title { font-family: var(--font-serif); font-size: 1.75rem; font-weight: 600; margin-bottom: 0.75rem; }
.section-line { width: 60px; height: 3px; background: var(--accent); border-radius: 2px; }

/* ==================== POSTS GRID ==================== */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2rem; }

/* ==================== POST CARD ==================== */
.post-card { background: var(--bg-secondary); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition); }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-card-link { display: block; }
.post-card-image { aspect-ratio: 16/9; overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.post-card:hover .post-card-image img { transform: scale(1.05); }
.post-card-content { padding: 1.5rem; }
.post-card-category { display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.post-card-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.75rem; color: var(--text-primary); }
.post-card-excerpt { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.6; }
.post-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.post-author { font-weight: 500; color: var(--text-secondary); }

/* ==================== FEATURED POST ==================== */
.featured-post { background: var(--bg-secondary); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 2rem; }
.featured-post-link { display: block; }
.featured-post-image { position: relative; aspect-ratio: 21/9; overflow: hidden; }
.featured-post-image img { width: 100%; height: 100%; object-fit: cover; }
.featured-badge { position: absolute; top: 1rem; left: 1rem; padding: 0.5rem 1rem; background: var(--accent); color: white; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; border-radius: var(--radius-sm); }
.featured-post-content { padding: 2rem; }
.featured-post-content .post-category { display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.featured-post-title { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; line-height: 1.3; margin-bottom: 1rem; color: var(--text-primary); }
.featured-post-excerpt { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.7; }
.featured-post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.post-author { display: flex; align-items: center; gap: 0.5rem; }
.author-avatar { width: 32px; height: 32px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.875rem; }
.author-name { font-weight: 500; color: var(--text-primary); }
.reading-time { color: var(--text-muted); font-size: 0.875rem; }

/* ==================== SIDEBAR ==================== */
.sidebar { display: flex; flex-direction: column; gap: 2rem; }
.sidebar-widget { background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.widget-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 2px solid var(--border-light); }

.popular-posts { display: flex; flex-direction: column; gap: 1rem; }
.popular-post { display: flex; gap: 1rem; align-items: flex-start; transition: var(--transition); }
.popular-post:hover { opacity: 0.8; }
.popular-post-img { width: 80px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.popular-post-content h5 { font-size: 0.9rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.25rem; color: var(--text-primary); }
.popular-post-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.5rem; }

.category-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.category-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; transition: var(--transition); }
.category-item:hover { color: var(--accent); }
.category-count { font-size: 0.75rem; color: var(--text-muted); background: var(--bg-primary); padding: 0.125rem 0.5rem; border-radius: 9999px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-badge { display: inline-block; padding: 0.375rem 0.875rem; background: var(--bg-primary); color: var(--text-secondary); font-size: 0.8rem; font-weight: 500; border-radius: 9999px; transition: var(--transition); border: 1px solid var(--border); }
.tag-badge:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ==================== SINGLE POST PAGE ==================== */
.blog-post-page { }
.post-hero, header.post-hero { position: relative; min-height: 500px; margin-top: 0; padding: 120px 0 40px; background-size: cover; background-position: center; background-repeat: no-repeat; display: flex; align-items: flex-end; }
.post-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.2) 100%); }
.post-hero-content { position: relative; z-index: 1; padding: 3rem 0; color: white; max-width: 800px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 1rem; background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: background 0.2s, border-color 0.2s; margin-bottom: 1.5rem; }
.back-btn:hover { background: var(--bg-primary); border-color: var(--accent); }
.post-hero-content .post-category { display: inline-block; padding: 0.375rem 0.875rem; background: var(--accent); color: white; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.post-hero-content .post-title { font-family: var(--font-serif); font-size: 3rem; font-weight: 700; line-height: 1.2; margin-bottom: 1.5rem; }
.post-hero-content .post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; opacity: 0.9; }

.post-body { padding: 3rem 0; }
.post-layout { display: grid; grid-template-columns: 1fr 320px; gap: 3rem; }
.post-content { min-width: 0; }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.post-excerpt { font-size: 1.25rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 2rem; padding-left: 1.5rem; border-left: 3px solid var(--accent); }
.post-text { font-size: 1.1rem; line-height: 1.8; color: var(--text-primary); }
.post-text h2, .post-text h3, .post-text h4 { font-family: var(--font-serif); margin: 2rem 0 1rem; }
.post-text p { margin-bottom: 1.5rem; }
.post-text img { border-radius: var(--radius-lg); margin: 2rem 0; }
.post-text ul, .post-text ol { margin: 1.5rem 0; padding-left: 1.5rem; }
.post-text li { margin-bottom: 0.5rem; }

.post-share { display: flex; align-items: center; gap: 1rem; padding: 1.5rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 2rem 0; }
.share-label { font-weight: 500; color: var(--text-secondary); }
.share-buttons { display: flex; gap: 0.5rem; }
.share-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: var(--transition); color: white; }
.share-twitter { background: #1da1f2; }
.share-facebook { background: #1877f2; }
.share-linkedin { background: #0a66c2; }
.share-copy { background: var(--text-secondary); }
.share-btn:hover { transform: scale(1.1); }

/* ==================== COMMENTS ==================== */
.comments-section { margin-top: 3rem; }
.comments-title { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; margin-bottom: 1.5rem; }
.comments-list { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.comment { background: var(--bg-primary); padding: 1.5rem; border-radius: var(--radius-lg); }
.comment-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.comment-avatar { width: 40px; height: 40px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.comment-author-info { display: flex; flex-direction: column; }
.comment-author-name { font-weight: 600; }
.comment-date { font-size: 0.8rem; color: var(--text-muted); }
.comment-content { line-height: 1.7; }
.comment-replies { margin-top: 1rem; padding-left: 2rem; display: flex; flex-direction: column; gap: 1rem; }

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

.comment-reply-btn {
    background: none;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.comment-reply-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.comment-reply-form-container {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.reply-form .form-group { margin-bottom: 0.75rem; }
.reply-form .form-group label { font-size: 0.85rem; margin-bottom: 0.25rem; }
.reply-form textarea { min-height: 80px; }

.reply-form-actions { display: flex; gap: 0.5rem; }

.btn-sm {
    padding: 6px 16px;
    font-size: 0.85rem;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.btn-secondary:hover {
    background: #e2e8f0;
}
.no-comments { color: var(--text-muted); font-style: italic; }

.comment-form-container { background: var(--bg-primary); padding: 2rem; border-radius: var(--radius-lg); }
.comment-form-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.comment-form { }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-primary); }
 .comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.3rem 1rem !important;
  border: 1px solid #aaaaaa !important;
  border-radius: 0.5rem !important;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.comment-form textarea {
  padding: 0.875rem 1rem;
  min-height: 120px;
  resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.comment-form input::placeholder,
.comment-form textarea::placeholder { color: #94a3b8; }

.subscriber-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #10b981;
    color: #ffffff;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.subscriber-badge .badge-icon {
    font-size: 1rem;
}
.subscriber-badge .badge-text {
    font-weight: 400;
}
.subscriber-badge strong {
    font-weight: 600;
}

.comment-form input[readonly] {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: not-allowed;
}

/* ==================== POST SIDEBAR ==================== */
.post-sidebar { position: sticky; top: 100px; height: fit-content; }
.related-posts { display: flex; flex-direction: column; gap: 1rem; }
.related-post { display: flex; gap: 1rem; transition: var(--transition); }
.related-post:hover { opacity: 0.8; }
.related-post-img { width: 80px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.related-post-content h5 { font-size: 0.9rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.25rem; color: var(--text-primary); }
.related-post-content time { font-size: 0.75rem; color: var(--text-muted); }

/* ==================== POST NAVIGATION ==================== */
.post-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.nav-link { display: flex; flex-direction: column; padding: 1.5rem; background: var(--bg-primary); border-radius: var(--radius-lg); transition: var(--transition); }
.nav-link:hover { background: var(--accent-light); }
.nav-label { font-size: 0.8rem; font-weight: 600; color: var(--accent); text-transform: uppercase; margin-bottom: 0.5rem; }
.nav-title { font-family: var(--font-serif); font-weight: 600; color: var(--text-primary); }
.nav-next { text-align: right; }

/* ==================== PAGINATION ==================== */
.pagination-wrapper { display: flex; justify-content: center; margin-top: 2rem; }
.pagination { display: flex; gap: 0.5rem; }
.page-item { }
.page-link { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border); transition: var(--transition); color: var(--text-secondary); }
.page-item.active .page-link { background: var(--accent); color: white; border-color: var(--accent); }
.page-link:hover { background: var(--bg-primary); }
.page-item.disabled .page-link { opacity: 0.5; cursor: not-allowed; }

/* ==================== LOAD MORE ==================== */
.load-more-container { display: flex; justify-content: center; margin-top: 2rem; }
.load-more-btn { min-width: 200px; }

/* ==================== SEARCH FORM ==================== */
.search-form-inline { display: flex; gap: 1rem; margin-bottom: 2rem; }
.search-input-large { flex: 1; padding: 1rem 1.5rem; border: 2px solid var(--border); border-radius: var(--radius-lg); font-size: 1rem; }
.search-input-large:focus { outline: none; border-color: var(--accent); }

/* ==================== NO POSTS ==================== */
.no-posts { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.no-posts p { margin-bottom: 0.5rem; }

/* ==================== BLOG FOOTER ==================== */
.blog-footer { background: var(--bg-dark); color: white; padding: 4rem 0 2rem; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.25rem; margin-bottom: 1rem; }
.footer-tagline { color: rgba(255,255,255,0.7); line-height: 1.6; }
.footer-links h4 { font-weight: 600; margin-bottom: 1rem; font-size: 1rem; }
.footer-links ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { color: rgba(255,255,255,0.7); transition: var(--transition); }
.footer-links a:hover { color: white; }
.footer-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.footer-tags .tag-badge { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); border: none; }
.footer-tags .tag-badge:hover { background: var(--accent); }
.footer-bottom { padding-top: 2rem; border-top: 1px solid rgba(255,255,255,0.1); text-align: center; color: rgba(255,255,255,0.5); font-size: 0.875rem; }

/* ==================== ADMIN TOPBAR & LAYOUT ==================== */
.admin-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.admin-topbar { background: var(--bg-dark); color: white; position: sticky; top: 0; z-index: 100; }
.topbar-inner { display: flex; align-items: center; max-width: 100%; padding: 0 1.5rem; height: 56px; }
.topbar-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: white; white-space: nowrap; flex-shrink: 0; margin-right: 2rem; }
.topbar-logo:hover { opacity: 0.85; }
.topbar-nav { display: flex; align-items: center; gap: 0.25rem; flex: 1; min-width: 0; }
.topbar-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.875rem; color: rgba(255,255,255,0.75); font-size: 0.875rem; font-weight: 500; border-radius: var(--radius-sm); white-space: nowrap; transition: var(--transition); }
.topbar-link:hover, .topbar-link.active { background: rgba(255,255,255,0.1); color: white; }
.topbar-icon { font-size: 1rem; flex-shrink: 0; }
.topbar-spacer { flex: 1; min-width: 1rem; }
.topbar-toggle { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; color: white; border-radius: var(--radius-sm); margin-left: auto; cursor: pointer; }
.topbar-toggle:hover { background: rgba(255,255,255,0.1); }
.topbar-backdrop { display: none; }

.admin-main { background: #f1f5f9; min-height: 0; flex: 1; }
.admin-header { background: var(--bg-secondary); padding: 1.25rem 2rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-page-title { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }
.admin-content { padding: 2rem; }

/* ==================== BLOG POSTS PAGE (pp-* namespace) ==================== */
.posts-page { max-width: 1280px; }

.pp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; }
.pp-header-left { }
.pp-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; line-height: 1.3; }
.pp-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.125rem; }
.pp-create-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; background: #1e293b; color: white; border-radius: 0.5rem; font-weight: 600; font-size: 0.9rem; transition: var(--transition); }
.pp-create-btn:hover { background: #0f172a; }

.pp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.pp-stat { background: white; border-radius: 0.75rem; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.875rem; border: 1px solid #e2e8f0; transition: var(--transition); }
.pp-stat:hover { box-shadow: var(--shadow-sm); }
.pp-stat-icon { width: 42px; height: 42px; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pp-stat-body { display: flex; flex-direction: column; gap: 0.125rem; }
.pp-stat-num { font-size: 1.5rem; font-weight: 700; color: #0f172a; line-height: 1; }
.pp-stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

.pp-alert { display: flex; align-items: center; gap: 0.625rem; padding: 0.875rem 1rem; background: #d1fae5; color: #065f46; border-radius: 0.5rem; font-size: 0.9rem; font-weight: 500; margin-bottom: 1.25rem; border: 1px solid #a7f3d0; }

.pp-card { background: white; border-radius: 0.75rem; border: 1px solid #e2e8f0; overflow: hidden; }
.pp-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid #e2e8f0; }
.pp-card-body { padding: 0; }

.pp-filters { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.pp-search-box { position: relative; flex: 1; min-width: 160px; }
.pp-search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.pp-search-input { width: 100%; padding: 0.5rem 0.75rem 0.5rem 2.25rem; border: 1px solid #e2e8f0; border-radius: 0.375rem; background: #f8fafc; font-size: 0.875rem; outline: none; transition: var(--transition); }
.pp-search-input:focus { border-color: var(--accent); background: white; }
.pp-selects { display: flex; gap: 0.5rem; }
.pp-select { padding: 0.5rem 2rem 0.5rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 0.375rem; background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") right 0.5rem center no-repeat; appearance: none; font-size: 0.875rem; outline: none; cursor: pointer; color: var(--text-primary); min-width: 130px; }
.pp-select:focus { border-color: var(--accent); background-color: white; }
.pp-filter-actions { display: flex; gap: 0.375rem; }
.pp-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: var(--transition); border: none; }
.pp-btn-primary { background: var(--accent); color: white; }
.pp-btn-primary:hover { background: var(--accent-hover); }
.pp-btn-clear { background: transparent; color: var(--text-secondary); }
.pp-btn-clear:hover { color: var(--danger); }

.pp-table-wrap { overflow-x: auto; }
.pp-table { width: 100%; border-collapse: collapse; }
.pp-table th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; background: #f8fafc; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.pp-table td { padding: 0.875rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; font-size: 0.875rem; color: var(--text-primary); }
.pp-table tbody tr { transition: background 0.15s; }
.pp-table tbody tr:hover { background: #f8fafc; }
.pp-table tbody tr:last-child td { border-bottom: none; }

.pp-post-cell { display: flex; align-items: center; gap: 0.75rem; }
.pp-post-thumb { width: 44px; height: 44px; border-radius: 0.375rem; object-fit: cover; flex-shrink: 0; background: #f1f5f9; }
.pp-post-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.pp-post-body { min-width: 0; }
.pp-post-title { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.pp-post-title a { color: #0f172a; transition: var(--transition); }
.pp-post-title a:hover { color: var(--accent); }
.pp-post-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.show-mobile { display: none; }

.pp-tag { display: inline-block; padding: 0.2rem 0.5rem; background: #f1f5f9; color: var(--text-secondary); font-size: 0.75rem; font-weight: 500; border-radius: 0.25rem; }

.pp-author-cell { display: flex; align-items: center; gap: 0.5rem; }
.pp-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }

.pp-status { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; font-size: 0.7rem; font-weight: 700; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.04em; }
.pp-status-dot { width: 6px; height: 6px; border-radius: 50%; }
.pp-status-published { background: #d1fae5; color: #065f46; }
.pp-status-published .pp-status-dot { background: var(--success); }
.pp-status-draft { background: #fef3c7; color: #92400e; }
.pp-status-draft .pp-status-dot { background: var(--warning); }

.pp-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.pp-views { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; }

.pp-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.pp-action { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 0.375rem; border: 1px solid #e2e8f0; background: white; color: var(--text-muted); transition: var(--transition); cursor: pointer; font-size: 0; }
.pp-action:hover { border-color: transparent; color: white; }
.pp-action-pub:hover { background: var(--success); }
.pp-action-unpub:hover { background: var(--warning); }
.pp-action-del:hover { background: var(--danger); }
.pp-action-comments-on { color: var(--success) !important; border-color: var(--success) !important; background: rgba(16, 185, 129, 0.1) !important; }
.pp-action-comments-on:hover { background: var(--warning) !important; border-color: var(--warning) !important; }
.pp-action-comments-off { color: #94a3b8 !important; border-color: #e2e8f0 !important; background: #f8fafc !important; }
.pp-action-comments-off:hover { background: var(--success) !important; border-color: var(--success) !important; color: white !important; }

.comment-toggle form { display: flex; align-items: center; gap: 6px; }
.toggle-btn { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.toggle-btn-on { border-color: #10b981; background: rgba(16, 185, 129, 0.15); color: #10b981; }
.toggle-btn-on:hover { background: #10b981; color: white; }
.toggle-btn-off { border-color: #e2e8f0; background: #f8fafc; color: #cbd5e1; }
.toggle-btn-off:hover { background: #10b981; border-color: #10b981; color: white; }
.toggle-label { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; }
.toggle-label-on { color: #10b981; }
.toggle-label-off { color: #94a3b8; }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.pp-action:first-child:hover { background: var(--accent); }
.pp-inline-form { display: inline; }

.pp-empty { text-align: center; padding: 3rem 1.5rem; }
.pp-empty-icon { width: 72px; height: 72px; margin: 0 auto 0.75rem; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.pp-empty h4 { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.375rem; }
.pp-empty p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.25rem; }

.pp-pagination { display: flex; justify-content: center; padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; }

/* ==================== POST GALLERY ==================== */
.post-gallery { margin: 2rem 0; }
.gallery-title { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.gallery-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; background: var(--bg-primary); transition: transform 0.2s, box-shadow 0.2s; }
.gallery-item:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
.gallery-item img, .gallery-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item video { object-fit: cover; }
.gallery-item-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); color: white; transition: background 0.2s; }
.gallery-item:hover .gallery-item-play { background: rgba(0,0,0,0.5); }
.gallery-item-play svg { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }

/* ==================== LIGHTBOX ==================== */
.lightbox { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; }
.lightbox.active { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.9); }
.lightbox-content { position: relative; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox-close { position: absolute; top: -40px; right: 0; background: rgba(255,255,255,0.1); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; }
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.2); }
.lightbox-media { display: flex; align-items: center; justify-content: center; max-height: 80vh; }
.lightbox-media img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: var(--radius); }
.lightbox-media video { max-width: 100%; max-height: 80vh; border-radius: var(--radius); }
.lightbox-counter { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 0.875rem; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .blog-grid { grid-template-columns: 1fr; }
    .blog-sidebar { position: static; }
    .post-layout { grid-template-columns: 1fr; }
    .post-sidebar { position: static; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .pp-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .blog-nav .container { flex-wrap: wrap; }
    .blog-nav-links { display: none; width: 100%; order: 3; flex-direction: column; padding-top: 1rem; }
    .blog-nav-links.active { display: flex; }
    .mobile-menu-toggle { display: flex; }
    .blog-search-form { width: 100%; }
    .search-input { width: 100%; }
    .hero-title { font-size: 2rem; }
    .featured-post-title { font-size: 1.5rem; }
    .post-hero-content .post-title { font-size: 2rem; }
    .posts-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .post-navigation { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }

    .topbar-nav { position: fixed; top: 56px; left: 0; right: 0; background: var(--bg-dark); flex-direction: column; align-items: stretch; padding: 0.5rem 0; gap: 0; transform: translateY(-100%); opacity: 0; pointer-events: none; transition: transform 0.25s, opacity 0.2s; z-index: 99; max-height: calc(100vh - 56px); overflow-y: auto; }
    .topbar-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .topbar-link { padding: 0.75rem 1.25rem; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .topbar-toggle { display: flex; }
    .topbar-backdrop.open { display: block; position: fixed; inset: 0; top: 56px; background: rgba(0,0,0,0.4); z-index: 98; }
    body.topbar-open { overflow: hidden; }

    .admin-content { padding: 1rem; }
    .pp-header { flex-direction: column; align-items: stretch; }
    .pp-create-btn { width: 100%; justify-content: center; }
    .pp-stats { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .pp-stat { padding: 0.75rem 1rem; }
    .pp-stat-num { font-size: 1.25rem; }
    .pp-stat-icon { width: 36px; height: 36px; }

    .pp-filters { flex-direction: column; align-items: stretch; }
    .pp-selects { flex-direction: column; }
    .pp-select { width: 100%; min-width: unset; }
    .pp-filter-actions { justify-content: flex-end; }

    .pp-card-header { padding: 0.875rem 1rem; }
    .pp-card-body { padding: 0; }
    .pp-table td, .pp-table th { padding: 0.625rem 0.625rem; }
    .hide-mobile { display: none; }
    .show-mobile { display: block; }
    .pp-post-thumb, .pp-post-thumb-empty { width: 36px; height: 36px; }
    .pp-actions { gap: 0.125rem; }
    .pp-action { width: 28px; height: 28px; }
    .admin-header { padding: 1rem; }
    .admin-page-title { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    .hero-title { font-size: 1.75rem; }
    .blog-hero { padding: 2rem 0; }
    .post-hero { min-height: 350px; }
    .post-hero-content .post-title { font-size: 1.5rem; }
    .post-navigation { grid-template-columns: 1fr; }
    .nav-next { text-align: left; }

    .admin-content { padding: 0.75rem; }
    .pp-stats { grid-template-columns: 1fr 1fr; gap: 0.375rem; }
    .pp-stat { padding: 0.625rem 0.75rem; }
    .pp-stat-num { font-size: 1.1rem; }
    .pp-stat-icon { width: 32px; height: 32px; }
}

/* ==================== SEARCH OVERLAY ==================== */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.active {
    display: flex;
    opacity: 1;
}

.search-overlay-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.search-overlay-close:hover {
    background: rgba(255,255,255,0.2);
}

.search-overlay-content {
    width: 100%;
    max-width: 600px;
    padding: 0 1.5rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.search-overlay.active .search-overlay-content {
    transform: translateY(0);
}

.search-overlay-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
}

.search-overlay-form svg {
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
}

.search-overlay-form input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    outline: none;
}

.search-overlay-form input::placeholder {
    color: rgba(255,255,255,0.5);
}
