/* ===========================
   CSS Variables & Reset
   =========================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --text-color: #f9fafb;
    --text-light: #d1d5db;
    --background: #111827;
    --background-alt: #1f2937;
    --border-color: #374151;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--background);
    line-height: 1.6;
    font-size: 16px;
    margin: 0;
    padding: 0;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===========================
   Header
   =========================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .header {
    background: var(--background);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.hero-logo-inline {
    width: 48px;
    height: 48px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-item {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    color: var(--primary-color);
}

.nav-item:hover {
    background: var(--background-alt);
}

.nav-item-login {
    color: var(--primary-color);
}

.nav-item-cta {
    background: var(--primary-color);
    color: white !important;
}

.nav-item-cta:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===========================
   Buttons
   =========================== */
.btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
    background: var(--background-alt);
    color: var(--text-color);
}

.btn:hover {
    background: var(--border-color);
}

.btn-cta {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #f06595 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #f06595 100%);
}

/* ===========================
   Flash Messages
   =========================== */
.flash-messages {
    max-width: 1200px;
    margin: 6rem auto 0;
    padding: 0 2rem;
}

.flash-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.flash-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.flash-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===========================
   Blog Layout
   =========================== */
.blog-container {
    padding: 8rem 2rem 4rem;
    min-height: 70vh;
}

.page-title {
    font-size: 3rem;
    margin-bottom: 3rem;
    text-align: center;
    font-weight: 800;
}

/* Posts List */
.posts-list {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-card {
    background: var(--background);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.post-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.post-title a {
    color: var(--text-color);
    text-decoration: none;
}

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

.post-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-excerpt {
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.read-more:hover {
    text-decoration: underline;
}

.no-posts {
    text-align: center;
    color: var(--text-light);
    font-size: 1.2rem;
    padding: 4rem 0;
}

/* ===========================
   Single Post
   =========================== */
.post-container {
    padding: 8rem 2rem 4rem;
}

.post-header {
    max-width: 800px;
    margin: 0 auto 3rem;
    text-align: center;
}

.post-title-single {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-weight: 800;
}

.post-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    font-weight: 700;
}

.post-content h1 { font-size: 2.5rem; }
.post-content h2 { font-size: 2rem; }
.post-content h3 { font-size: 1.5rem; }

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.post-content a:hover {
    color: var(--primary-dark);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
}

.post-content code {
    background: var(--background-alt);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.post-content pre {
    background: var(--background-alt);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-light);
}

/* Responsive YouTube Embeds */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 2rem 0;
    border-radius: 8px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.post-footer {
    max-width: 800px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

/* ===========================
   Admin Styles
   =========================== */
.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
}

.admin-container h1 {
    margin-bottom: 2rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--background-alt);
    font-weight: 600;
}

.admin-table td code {
    background: var(--background-alt);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.admin-table-actions {
    white-space: nowrap;
}

.admin-table-actions a {
    margin-right: 1rem;
    color: var(--primary-color);
}

.admin-table-actions a:last-child {
    margin-right: 0;
}

/* Form Styles */
.post-form {
    max-width: 900px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--background);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    font-family: 'Monaco', 'Courier New', monospace;
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.markdown-help {
    max-width: 900px;
    margin: 3rem auto;
    padding: 1.5rem;
    background: var(--background-alt);
    border-radius: 8px;
}

.markdown-help h3 {
    margin-bottom: 1rem;
}

.markdown-help pre {
    background: var(--background);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 10rem auto;
    padding: 2rem;
    background: var(--background);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.login-container h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-form {
    margin-top: 2rem;
}

/* ===========================
   Footer
   =========================== */
.footer {
    background: var(--background-alt);
    padding: 3rem 2rem 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--text-light);
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        display: none;
        box-shadow: var(--shadow-lg);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-item {
        width: 100%;
        text-align: center;
    }
    
    .blog-container,
    .post-container {
        padding: 6rem 1rem 2rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-title-single {
        font-size: 2rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .admin-container {
        padding: 1rem;
    }
    
    .admin-table {
        font-size: 0.9rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.75rem;
    }
    
    .post-title {
        font-size: 1.25rem;
    }
    
    .post-title-single {
        font-size: 1.75rem;
    }
    
    .post-card {
        padding: 1.5rem;
    }
    
    .login-container {
        margin: 6rem auto;
        padding: 1.5rem;
    }
}

