/* Modern Blog CMS Styles */
:root {
    /* Color Palette - Modern & Clean */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-dark: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --accent: #f59e0b;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    /* Shadow */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Typography */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* Sticky Footer Setup */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

img {
    max-width: 100%;
    display: block;
    height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-dark);
    line-height: 1.25;
    margin-bottom: var(--spacing-sm);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

main {
    flex: 1;
}

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    /* Slightly reduced padding */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: auto;
    width: auto;
    max-height: 55px;
    /* Mobile safe height */
    object-fit: contain;
}

@media(min-width: 700px) {
    .logo img {
        max-height: 85px;
        /* Large but constrained on Desktop */
    }
}

.nav-links {
    display: none;
}

@media(min-width: 700px) {
    .nav-links {
        display: flex;
        gap: var(--spacing-md);
    }
}

.nav-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* Search Bar */
.search-form {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-right: var(--spacing-sm);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.search-form:focus-within {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input {
    border: none;
    background: transparent;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    width: 160px;
    color: var(--text-dark);
    outline: none;
}

.search-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background-color: transparent;
    color: var(--secondary);
}

.btn-ghost:hover {
    color: var(--text-dark);
    background-color: #f1f5f9;
}

/* Hero Section */
.hero {
    padding: var(--spacing-xl) 0;
    text-align: center;
    background: radial-gradient(circle at top center, #eff6ff, var(--background));
    border-bottom: 1px solid var(--border);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: var(--spacing-sm);
    color: var(--text-dark);
}

.hero-title span {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-lg);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 3.5rem;
    }
}

/* Blog Grid */
.posts-section {
    padding: var(--spacing-xl) 0;
}

.section-header {
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .post-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Article Card */
.post-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    /* Essential for stretched link */
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.post-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background-color: #e2e8f0;
}

.post-content {
    padding: var(--spacing-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: var(--spacing-sm);
}

.badge {
    background-color: #eff6ff;
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.post-excerpt {
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.read-more {
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.read-more:hover {
    gap: 0.5rem;
}

/* Stretched Link Utility */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* Form & Editor Styles */
.editor-form {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-row {
    display: grid;
    gap: var(--spacing-md);
}

@media(min-width: 640px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-dark);
}

input[type="text"],
input[type="url"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Single Post View & HTML Content */
.article-header {
    text-align: center;
    padding: var(--spacing-xl) 0;
    background: var(--background);
}

.article-meta {
    margin-top: var(--spacing-md);
    color: var(--secondary);
}

.article-content {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-sm);
    font-size: 1.125rem;
    color: var(--text-dark);
}

.back-link {
    display: inline-block;
    margin-bottom: var(--spacing-md);
    color: var(--secondary);
    font-weight: 500;
}

.content-body {
    line-height: 1.8;
}

.content-body p {
    margin-bottom: 1.5rem;
}

.content-body h1,
.content-body h2,
.content-body h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 700;
}

.content-body ul,
.content-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.content-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    font-style: italic;
    color: var(--secondary);
    margin: 1.5rem 0;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.content-body img {
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    display: block;
    max-width: 100%;
}

/* Related Posts Section */
.related-posts {
    background: var(--background);
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--border);
}

.related-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

/* Login Page Styles */
.login-body {
    background: radial-gradient(circle at center, #eff6ff 0%, #f8fafc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid white;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: var(--text-dark);
}

/* Footer Adjustments */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
    text-align: center;
    color: var(--secondary);
}

footer a {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s;
    margin: 0 0.5rem;
}

footer a:hover {
    color: var(--primary);
}