/* ============================================
   Developer Blog - Main Stylesheet
   Mobile-first, pure CSS, zero frameworks
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
    --max-width: 1200px;
    --narrow: 720px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Hind Siliguri', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* --- Container --- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
.container-narrow { max-width: var(--narrow); }

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-outline { background: transparent; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* --- Header --- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 60px;
}

.logo { flex-shrink: 0; }
.logo img { height: 36px; width: auto; }
.logo-text { font-size: 1.3rem; font-weight: 700; color: var(--text); }

.main-nav { flex: 1; }
.nav-list {
    list-style: none;
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }
.nav-list a {
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
.nav-list a:hover { background: var(--border-light); color: var(--text); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.search-form input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    width: 160px;
    transition: width var(--transition), border-color var(--transition);
    background: var(--bg);
}
.search-form input:focus { outline: none; border-color: var(--primary); width: 200px; }

/* User Menu & Dropdown */
.user-menu { display: flex; align-items: center; gap: 0.5rem; }
.avatar-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-placeholder {
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary);
    border-radius: 50%;
}
.avatar-placeholder.avatar-lg { width: 80px; height: 80px; font-size: 2rem; }
.avatar-placeholder.avatar-xl { width: 120px; height: 120px; font-size: 3rem; }

.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 200;
    overflow: hidden;
}
.dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text);
    font-size: 0.9rem;
}
.dropdown-menu a:hover { background: var(--border-light); }
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: block; }

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.mobile-toggle span {
    width: 22px; height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* --- Flash Messages --- */
.flash {
    padding: 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash .container { display: flex; align-items: center; justify-content: space-between; }
.flash-success { background: #f0fdf4; color: var(--success); border-bottom: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: var(--danger); border-bottom: 1px solid #fecaca; }
.flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; padding: 0 0.5rem; }

/* --- Hero / Featured Post --- */
.hero { padding: 2rem 0; }
.hero-card {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow var(--transition);
}
.hero-card:hover { box-shadow: var(--shadow-lg); color: var(--text); }
.hero-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.hero-content { padding: 1.5rem; }
.hero-content h1 { margin: 0.5rem 0; }
.hero-excerpt { color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.95rem; }

/* --- Badge --- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-sm { font-size: 0.7rem; padding: 0.1rem 0.5rem; }

/* --- Posts Grid --- */
.latest-posts { padding: 2rem 0; }
.section-title {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.posts-grid-3 { grid-template-columns: repeat(3, 1fr); }

.post-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.post-card a { color: var(--text); text-decoration: none; display: block; }
.post-card-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card-body { padding: 1rem; }
.post-card-body h3 { font-size: 1.05rem; margin: 0.4rem 0; line-height: 1.4; }
.post-card-body p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* --- Post Meta --- */
.post-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
}
.page-info { font-size: 0.9rem; color: var(--text-muted); }

/* --- Top Writers --- */
.top-writers { padding: 2rem 0; background: var(--surface); }
.writers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}
.writer-card {
    text-align: center;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.writer-avatar { margin: 0 auto 0.75rem; }
.writer-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto; }
.writer-card h4 { font-size: 1rem; margin-bottom: 0.2rem; }
.writer-skill { font-size: 0.8rem; color: var(--text-muted); }
.writer-posts { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-top: 0.3rem; }

/* --- Stats Bar --- */
.site-stats { padding: 2rem 0; }
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* --- Single Post Page --- */
.post-page { padding: 2rem 0; }
.post-hero-img { margin-bottom: 1.5rem; border-radius: var(--radius-lg); overflow: hidden; }
.post-hero-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

.post-header { margin-bottom: 2rem; }
.post-header h1 { font-size: 2rem; margin: 0.5rem 0; }
.post-author-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.post-author-inline img { width: 28px; height: 28px; border-radius: 50%; }

/* --- Prose (Article Content) --- */
.prose {
    font-size: 1.05rem;
    line-height: 1.85;
}
.prose p { margin-bottom: 1.25rem; }
.prose h2 { margin: 2rem 0 1rem; font-size: 1.5rem; }
.prose h3 { margin: 1.5rem 0 0.75rem; font-size: 1.25rem; }
.prose img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}
.prose blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--border-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
}
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose a { text-decoration: underline; }

/* --- Author Box --- */
.post-author-box {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.author-card {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}
.author-avatar img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.author-info h3 { margin-bottom: 0.3rem; }
.author-info p { font-size: 0.9rem; color: var(--text-muted); }
.author-social {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.post-actions { margin-top: 1.5rem; }

/* --- Related Posts --- */
.related-posts { padding: 3rem 0; background: var(--bg); }

/* --- Search Page --- */
.search-page { padding: 2rem 0; }
.search-form-lg { display: flex; gap: 0.5rem; margin: 1.5rem 0; }
.search-form-lg input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}
.search-form-lg input:focus { outline: none; border-color: var(--primary); }
.search-info { color: var(--text-muted); margin-bottom: 1.5rem; }

.posts-list { display: flex; flex-direction: column; gap: 1rem; }
.post-list-item a {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    align-items: center;
}
.post-list-item a:hover { box-shadow: var(--shadow-lg); }
.post-list-content { flex: 1; }
.post-list-content h3 { font-size: 1.05rem; margin: 0.3rem 0; }
.post-list-content p { font-size: 0.85rem; color: var(--text-muted); }
.post-list-thumb img { width: 160px; height: 90px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }

/* --- Category Page --- */
.category-page { padding: 2rem 0; }
.page-header { margin-bottom: 1.5rem; }
.page-header p { color: var(--text-muted); }

/* --- Static Pages --- */
.page-content { padding: 2rem 0; }
.page-content h1 { margin-bottom: 1.5rem; }

/* --- Auth Pages --- */
.auth-page { padding: 3rem 0; display: flex; align-items: center; min-height: 60vh; }
.auth-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.auth-card-wide { max-width: 560px; }
.auth-card h1 { text-align: center; margin-bottom: 0.25rem; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-link { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.form-group label small { font-weight: 400; color: var(--text-muted); }
.required { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition);
}
input:focus, select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input[type="file"] { font-size: 0.85rem; }
.form-textarea { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    padding-top: 1.5rem;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* --- Profile Page --- */
.profile-page { padding: 2rem 0; }
.profile-grid { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; }
.profile-sidebar { position: sticky; top: 80px; align-self: start; }
.profile-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
}
.profile-avatar { margin-bottom: 1rem; }
.profile-avatar img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin: 0 auto; }
.profile-role { font-size: 0.8rem; color: var(--primary); font-weight: 600; }
.profile-bio { font-size: 0.85rem; color: var(--text-muted); margin: 0.5rem 0; }
.profile-joined { font-size: 0.8rem; color: var(--text-light); }

.my-posts-list { display: flex; flex-direction: column; gap: 0.5rem; }
.my-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    gap: 1rem;
}
.my-post-item a { color: var(--text); }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.status-published { background: #dcfce7; color: var(--success); }
.status-pending { background: #fef9c3; color: #a16207; }
.status-draft { background: #f1f5f9; color: var(--text-muted); }
.status-rejected { background: #fee2e2; color: var(--danger); }

/* --- Card --- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 1rem; }

/* --- Error Page --- */
.error-page {
    text-align: center;
    padding: 4rem 0;
}
.error-page h1 { font-size: 4rem; color: var(--text-light); }
.error-page p { color: var(--text-muted); margin: 1rem 0; }

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

/* --- Footer --- */
.site-footer {
    background: var(--text);
    color: #cbd5e1;
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-about h3 { color: #fff; margin-bottom: 0.5rem; }
.footer-about p { font-size: 0.9rem; }
.footer-links h4 { color: #fff; margin-bottom: 0.75rem; font-size: 0.95rem; }
.footer-links ul { list-style: none; }
.footer-links a { color: #94a3b8; font-size: 0.9rem; display: block; padding: 0.2rem 0; }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #334155; padding-top: 1rem; text-align: center; font-size: 0.8rem; }

/* --- Utility --- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.inline-form { display: inline-block; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 60px; left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        display: none;
        z-index: 99;
    }
    .main-nav.open { display: block; }
    .nav-list { flex-direction: column; }
    .mobile-toggle { display: flex; }
    .search-form input { width: 120px; }
    .search-form input:focus { width: 140px; }
    
    h1 { font-size: 1.4rem; }
    .hero-card { grid-template-columns: 1fr; }
    .posts-grid { grid-template-columns: 1fr; }
    .posts-grid-3 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-sidebar { position: static; }
    
    .post-header h1 { font-size: 1.5rem; }
    .post-list-thumb { display: none; }
    
    .stats-bar { gap: 1.5rem; }
    .stat-num { font-size: 1.3rem; }

    .auth-card { padding: 1.5rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .posts-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1025px) {
    .hero-card { grid-template-columns: 1.5fr 1fr; }
    .posts-grid { grid-template-columns: repeat(4, 1fr); }
}
