/* ===========================================
   MULAPRINT — MULAEARN EDITION STYLES
   Matches the purple/cyan homepage design
   Covers: blog.php, post.php, admin-posts.php
   =========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:        #0f0a1a;
    --surface:   #161024;
    --surface2:  #1e1730;
    --surface3:  #271f3d;
    --purple:    #7c3aed;
    --purple-lt: #a78bfa;
    --cyan:      #06b6d4;
    --cyan-lt:   #22d3ee;
    --text:      rgba(226,232,240,0.88);
    --text-dim:  rgba(165,180,210,0.55);
    --line:      rgba(124,58,237,0.16);
    --line-lt:   rgba(124,58,237,0.28);
    --success:   #10b981;
    --danger:    #ef4444;
    --r-sm: 8px; --r: 14px; --r-lg: 22px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Manrope', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #161024 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #fff;
}
h1 { font-size: 2.75rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; color: var(--text); font-size: 1rem; }

a { color: var(--purple-lt); text-decoration: none; transition: color .2s; }
a:hover { color: var(--cyan-lt); }

/* ============ HEADER & NAV ============ */
header {
    background: rgba(15,10,26,0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 1.1rem 0;
    position: sticky; top: 0; z-index: 100;
}
.header-container {
    max-width: 1200px; margin: 0 auto; padding: 0 2rem;
    display: flex; justify-content: space-between; align-items: center;
}
.logo {
    font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 800;
    background: linear-gradient(135deg, var(--purple-lt) 0%, var(--cyan-lt) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
nav ul { list-style: none; display: flex; gap: 2rem; }
nav a { color: var(--text); font-weight: 600; font-size: .9rem; position: relative; }
nav a::after {
    content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px;
    background: var(--purple-lt); transition: width .25s;
}
nav a:hover { color: var(--purple-lt); }
nav a:hover::after { width: 100%; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-block; padding: 0.7rem 1.4rem; border-radius: var(--r-sm);
    font-weight: 700; font-size: .85rem; letter-spacing: .01em;
    transition: all .2s; border: none; cursor: pointer; text-align: center;
    font-family: 'Manrope', sans-serif;
}
.btn-lg { padding: .9rem 1.9rem; font-size: .95rem; }
.btn-full { width: 100%; }
.btn-primary {
    background: linear-gradient(135deg, var(--purple) 0%, var(--cyan) 100%);
    color: #fff; box-shadow: 0 6px 24px rgba(124,58,237,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(124,58,237,0.45); }
.btn-secondary { background: transparent; color: var(--purple-lt); border: 2px solid var(--purple-lt); }
.btn-secondary:hover { background: var(--purple-lt); color: #14101f; transform: translateY(-1px); }

/* ============ PAGE HERO (blog listing header) ============ */
.hero { max-width: 1200px; margin: 2.5rem auto 1rem; padding: 0 2rem; }
.hero h1 {
    background: linear-gradient(135deg, var(--purple-lt) 0%, var(--cyan-lt) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { color: var(--text-dim); font-size: 1rem; }

/* ============ BLOG LISTING ============ */
.blog-container {
    max-width: 1200px; margin: 0 auto; padding: 2rem;
    display: grid; grid-template-columns: 1fr 340px; gap: 2.5rem; align-items: start;
}
.blog-posts {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.75rem;
}
.post-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden; transition: all .25s; display: flex; flex-direction: column;
}
.post-card:hover { border-color: var(--line-lt); transform: translateY(-6px); box-shadow: 0 18px 40px rgba(124,58,237,0.18); }
.post-image {
    width: 100%; height: 190px;
    background: linear-gradient(135deg, var(--purple) 0%, var(--cyan) 100%);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.post-image img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 1.4rem; flex-grow: 1; display: flex; flex-direction: column; }
.post-category {
    display: inline-block; background: rgba(124,58,237,0.16); color: var(--purple-lt);
    padding: .35rem .7rem; border-radius: 4px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: .85rem; width: fit-content;
}
.post-body h3 { font-size: 1.15rem; margin-bottom: .6rem; }
.post-excerpt { color: var(--text-dim); font-size: .9rem; margin-bottom: 1rem; flex-grow: 1; }
.post-meta {
    display: flex; justify-content: space-between; font-size: .76rem; color: var(--text-dim);
    padding-top: .9rem; border-top: 1px solid var(--line); margin-bottom: .9rem;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 100px; height: fit-content; }
.sidebar-widget {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 1.4rem; margin-bottom: 1.6rem;
}
.sidebar-widget h4 {
    margin-bottom: 1.2rem; display: flex; align-items: center; gap: .7rem; font-size: .95rem;
}
.sidebar-widget h4::before { content: ''; width: 3px; height: 1.2rem; background: var(--purple-lt); border-radius: 2px; }

.search-form { display: flex; gap: .5rem; }
.search-form input {
    flex: 1; padding: .7rem; background: rgba(255,255,255,0.04);
    border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text);
    font-family: 'Manrope', sans-serif; font-size: .85rem;
}
.search-form input:focus { outline: none; border-color: var(--purple-lt); }
.search-form button {
    padding: .7rem 1rem; background: var(--purple); color: #fff; border: none;
    border-radius: var(--r-sm); cursor: pointer; font-weight: 700;
}
.search-form button:hover { background: var(--purple-lt); }

.categories-list, .trending-list { list-style: none; }
.categories-list li { margin-bottom: .3rem; }
.categories-list a {
    display: flex; justify-content: space-between; align-items: center;
    padding: .55rem .3rem; font-size: .85rem; color: var(--text); border-radius: 6px;
}
.categories-list a:hover, .categories-list a.active { background: rgba(124,58,237,0.08); color: var(--purple-lt); }
.category-count {
    background: rgba(124,58,237,0.14); color: var(--purple-lt);
    padding: .15rem .55rem; border-radius: 50px; font-size: .72rem; font-weight: 700;
}
.trending-item { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.trending-item:last-child { border-bottom: none; }
.trending-item a { font-size: .85rem; font-weight: 600; color: var(--text); line-height: 1.5; }
.trending-item a:hover { color: var(--purple-lt); }

/* CTA box (reusable — replaces old inline orange CTA blocks) */
.cta-box {
    background: linear-gradient(135deg, rgba(124,58,237,0.14) 0%, rgba(6,182,212,0.1) 100%);
    border: 1px solid var(--line-lt); border-radius: var(--r-lg); padding: 1.6rem; text-align: center;
}
.cta-box h3, .cta-box h4 { color: var(--purple-lt); margin-bottom: .6rem; }
.cta-box p { font-size: .9rem; color: var(--text); margin-bottom: 1.1rem; }

/* ============ PAGINATION ============ */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 2.2rem; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: .65rem .95rem; border-radius: var(--r-sm); border: 1px solid var(--line);
    color: var(--text); font-size: .85rem; font-weight: 600;
}
.pagination a:hover { background: var(--purple); color: #fff; border-color: var(--purple); }
.pagination .active { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ============ SINGLE POST ============ */
.post-single { max-width: 820px; margin: 2.5rem auto; padding: 0 2rem; }
.post-header { margin-bottom: 2rem; }
.post-header-category {
    display: inline-block; background: rgba(124,58,237,0.16); color: var(--purple-lt);
    padding: .4rem .9rem; border-radius: 50px; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1.1rem;
}
.post-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 1.1rem; }
.post-header-meta { display: flex; gap: 1.3rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-dim); }

.post-featured-image {
    width: 100%; max-height: 420px; overflow: hidden; border-radius: var(--r-lg);
    margin-bottom: 2rem; border: 1px solid var(--line);
}
.post-featured-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-content { font-size: 1.02rem; color: var(--text); line-height: 1.9; margin-bottom: 2.5rem; }
.post-content h2 { font-size: 1.5rem; margin-top: 2rem; color: #fff; }
.post-content h3 { font-size: 1.2rem; margin-top: 1.6rem; color: #fff; }
.post-content p { margin-bottom: 1.2rem; }
.post-content ul, .post-content ol { margin: 0 0 1.2rem 1.4rem; }
.post-content li { margin-bottom: .5rem; }
.post-content strong { color: #fff; }
.post-content blockquote {
    border-left: 3px solid var(--purple-lt); padding: .3rem 0 .3rem 1.2rem;
    margin: 1.5rem 0; color: var(--text-dim); font-style: italic;
}
.post-content a { color: var(--cyan-lt); text-decoration: underline; }

.post-footer { border-top: 1px solid var(--line); padding-top: 2rem; }
.author-info {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 1.4rem; margin-bottom: 2.5rem;
}
.author-info h4 { color: var(--purple-lt); margin-bottom: .5rem; }
.author-info p { margin-bottom: 0; color: var(--text-dim); font-size: .9rem; }

.related-posts h3 { margin-bottom: 1.3rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.4rem; }

/* ============ ADMIN PANEL ============ */
.admin-container { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.6rem; flex-wrap: wrap; gap: 1rem; }

.admin-card {
    max-width: 420px; margin: 3rem auto; background: var(--surface);
    border: 1px solid var(--line); padding: 2.2rem; border-radius: var(--r-lg);
}
.admin-card h2 { text-align: center; margin-bottom: 1.8rem; }
.admin-hint {
    text-align: center; margin-top: 1.3rem; color: var(--text-dim); font-size: .85rem;
}
.admin-hint code { background: rgba(0,0,0,0.35); padding: .25rem .55rem; border-radius: 4px; color: var(--cyan-lt); }

.alert {
    padding: 1rem 1.2rem; border-radius: var(--r-sm); margin-bottom: 1.6rem; font-size: .9rem; font-weight: 600;
}
.alert-success { background: rgba(16,185,129,0.14); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(239,68,68,0.14); border: 1px solid var(--danger); color: var(--danger); }

form.admin-form {
    background: var(--surface); border: 1px solid var(--line); padding: 2rem;
    border-radius: var(--r-lg); margin-bottom: 2.5rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; }
.form-group { margin-bottom: 1.3rem; }
.form-group label {
    display: block; margin-bottom: .5rem; font-size: .85rem; font-weight: 700; color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%; padding: .75rem .9rem; background: rgba(255,255,255,0.04);
    border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text);
    font-family: 'Manrope', sans-serif; font-size: .9rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--purple-lt);
}
.form-group textarea { min-height: 260px; resize: vertical; font-family: 'Manrope', monospace; line-height: 1.6; }
.form-group select { cursor: pointer; }
.form-group label.checkbox-label {
    display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer;
}
.form-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--purple); cursor: pointer; }
.form-hint { color: var(--text-dim); font-size: .8rem; display: block; margin-top: .5rem; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.admin-table th, .admin-table td {
    padding: .9rem 1.1rem; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--line);
}
.admin-table th { background: var(--surface2); color: var(--purple-lt); text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(124,58,237,0.05); }

.status-badge { padding: .25rem .75rem; border-radius: 50px; font-size: .72rem; font-weight: 700; display: inline-block; }
.status-badge.published { background: rgba(16,185,129,0.18); color: var(--success); }
.status-badge.draft { background: rgba(148,163,184,0.18); color: var(--text-dim); }

.admin-actions { display: flex; gap: .6rem; }
.btn-edit, .btn-delete {
    padding: .45rem .9rem; border-radius: 6px; font-size: .78rem; font-weight: 700;
    border: none; cursor: pointer; text-decoration: none;
}
.btn-edit { background: rgba(124,58,237,0.16); color: var(--purple-lt); }
.btn-edit:hover { background: var(--purple); color: #fff; }
.btn-delete { background: rgba(239,68,68,0.14); color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: #fff; }

.setup-box {
    background: rgba(6,182,212,0.07); border: 1px solid rgba(6,182,212,0.25);
    padding: 1.8rem; border-radius: var(--r-lg); margin-top: 2.5rem;
}
.setup-box h3 { color: var(--cyan-lt); margin-bottom: 1rem; }
.setup-box ol { color: var(--text); line-height: 2; padding-left: 1.3rem; font-size: .9rem; }
.setup-box code { background: rgba(0,0,0,0.35); padding: .2rem .45rem; border-radius: 4px; color: var(--cyan-lt); }

/* ============ FOOTER ============ */
footer { background: var(--bg); border-top: 1px solid var(--line); padding: 3rem 2rem 1.2rem; margin-top: 4rem; }
.footer-content {
    max-width: 1200px; margin: 0 auto 2rem; display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem;
}
.footer-section h4 { color: var(--purple-lt); margin-bottom: 1rem; font-size: 1rem; }
.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: .65rem; }
.footer-section a { color: var(--text-dim); font-size: .88rem; }
.footer-section a:hover { color: var(--purple-lt); }
.footer-section p { color: var(--text-dim); font-size: .88rem; }
.footer-bottom {
    text-align: center; padding-top: 1.8rem; border-top: 1px solid var(--line);
    color: var(--text-dim); font-size: .82rem; max-width: 1200px; margin: 0 auto;
}

/* ============ NOT FOUND ============ */
.not-found-box { text-align: center; padding: 4rem 1rem; }
.not-found-box p { margin: 1.3rem 0; color: var(--text-dim); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .blog-container { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .header-container { flex-direction: column; gap: 1rem; }
    nav ul { gap: 1rem; flex-wrap: wrap; justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
    .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 480px) {
    .btn { width: 100%; }
    .admin-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
