/* --- Global Variables & Reset --- */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* --- Navigation --- */
.navbar {
    background: var(--card-bg);
    padding: 1.2rem 5%;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links .btn-outline {
    border: 2px solid var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    color: var(--primary-color);
}

.nav-links .btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* --- Hero Banner --- */
.hero {
    background: linear-gradient(to right, #1e293b, #0f172a);
    color: white;
    text-align: center;
    padding: 5rem 1rem;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.hero p {
    color: #94a3b8;
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Two-Column Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 3rem 2rem;
    flex: 1;
}

.blog-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 3rem;
}

@media (max-width: 768px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
}

/* --- Main Content (Article Feed) --- */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.post-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-card h2 a {
    color: var(--text-main);
}

.post-card h2 a:hover {
    color: var(--primary-color);
}

.post-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.post-excerpt {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    font-weight: bold;
    display: inline-block;
    border-bottom: 2px solid transparent;
}

.read-more:hover {
    border-bottom: 2px solid var(--primary-color);
}

/* --- Sidebar & Widgets --- */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.widget {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

/* Profile Widget Styling */
.widget-profile {
    padding: 0; 
    overflow: hidden;
    text-align: center;
}

.widget-banner {
    height: 120px;
    background-image: url('/static/background.jpg');
    background-size: cover;
    background-position: center;
    background-color: var(--border-color);
}

.widget-profile-pic {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid var(--card-bg);
    margin-top: -45px;
    background-color: white;
    object-fit: cover;
}

.widget-profile-content {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
}

.widget h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.widget-profile h3 {
    border-bottom: none; 
    margin-bottom: 0.5rem;
}

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

.widget input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.widget button {
    width: 100%;
    padding: 0.75rem;
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.widget button:hover {
    background: var(--primary-color);
}

/* --- Footer --- */
footer {
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 3rem 1rem;
    margin-top: auto;
}

/* --- Markdown Styles --- */
.markdown-content h2, .markdown-content h3 { margin-top: 2rem; margin-bottom: 1rem; color: var(--text-main); }
.markdown-content p { margin-bottom: 1.2rem; }
.markdown-content ul, .markdown-content ol { margin-bottom: 1.2rem; padding-left: 2rem; }
.markdown-content blockquote { border-left: 4px solid var(--primary-color); padding-left: 1rem; color: var(--text-muted); font-style: italic; background: #f1f5f9; padding: 1rem; border-radius: 0 8px 8px 0; margin-bottom: 1.2rem; }
.markdown-content code { background: #e2e8f0; padding: 0.2rem 0.4rem; border-radius: 4px; font-family: monospace; font-size: 0.9em; }

/* Responsive Image Styling (Applies to both Post Page and Homepage) */
.markdown-content img, .post-excerpt img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    margin: 2rem auto;
    display: block;
}

/* --- Form styles for Admin/Login --- */
.login-page { display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card-bg); width: 100%; max-width: 400px; padding: 2.5rem; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); text-align: center; }
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--text-main); font-size: 0.9rem; }
.form-group input, .form-group textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; font-size: 1rem; font-family: inherit; }
.btn-primary { display: block; width: 100%; padding: 0.75rem; background-color: var(--primary-color); color: white; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }
.btn-primary:hover { background-color: var(--primary-hover); }

/* --- Mobile Navigation Fix --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav-links .btn-outline {
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }
}