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

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --text-primary: #e8e8e8;
    --text-secondary: #a8a8a8;
    --accent: #ff6b6b;
    --border: #333;
}

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

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

/* Navigation */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Recent Posts Section */
.recent-posts {
    margin: 4rem 0;
}

.recent-posts h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.post-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.post-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.post-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.post-card h3 a:hover {
    color: var(--accent);
}

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

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.read-more {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.read-more:hover {
    opacity: 0.8;
}

.view-all {
    text-align: center;
}

.view-all a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

/* Articles Page */
.articles-list {
    margin: 2rem 0;
}

.article-item {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    transition: border-color 0.3s ease;
}

.article-item:hover {
    border-color: var(--accent);
}

.article-item h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.article-item h2 a {
    color: var(--text-primary);
    text-decoration: none;
}

.article-item h2 a:hover {
    color: var(--accent);
}

/* Full Article */
.article-full {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.8;
    margin: 2rem 0;
}

.article-content h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
}

.article-content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content code {
    background: var(--bg-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

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

.article-content pre code {
    padding: 0;
}

.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1rem 2rem;
}

.article-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--bg-primary);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

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

/* Article Navigation */
.article-nav {
    display: flex;
    justify-content: space-between;
    margin: 2rem 0;
    gap: 1rem;
}

.article-nav a {
    flex: 1;
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--accent);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

.article-nav a:hover {
    border-color: var(--accent);
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
}

/* Page */
.page-full {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.page-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin: 3rem 0;
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.pagination a:hover {
    border-color: var(--accent);
}

/* Authentication Styles */

/* User Menu in Navbar */
#auth-placeholder {
    margin-left: auto;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.logout-btn {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logout-btn:hover {
    opacity: 0.8;
}

.login-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.login-link:hover {
    opacity: 0.8;
}

/* Login Form */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem 0;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.error-message {
    color: #ff6b6b;
    font-size: 0.9rem;
    padding: 0.75rem;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.auth-button {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease;
    margin-top: 1rem;
}

.auth-button:hover {
    opacity: 0.8;
}

.auth-button:active {
    opacity: 0.6;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer p {
    margin: 0;
}

/* Protected Content */
.protected-content {
    min-height: 50vh;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        gap: 1rem;
        font-size: 0.9rem;
        flex-wrap: wrap;
    }

    .article-full,
    .page-full {
        padding: 1.5rem;
    }

    .article-nav {
        flex-direction: column;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .article-header h1 {
        font-size: 1.75rem;
    }

    .auth-card {
        padding: 2rem;
    }

    .auth-card h1 {
        font-size: 1.5rem;
    }

    .user-menu {
        gap: 0.5rem;
        flex-direction: column;
        align-items: flex-end;
    }

    .logout-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}
