/* Applebiter Blog - Main Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --bg-color: #fff;
    --border-color: #e1e8ed;
    --code-bg: #f5f5f5;
    --link-color: #3498db;
    --link-hover: #2980b9;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: #f8f9fa;
}

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

/* Header */
header {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.site-logo:hover {
    transform: scale(1.05);
}

.header-text {
    flex: 1;
}

header h1 {
    font-size: 2.5rem;
    cursor: pointer;
    transition: opacity 0.2s;
    margin: 0;
}

header h1:hover {
    opacity: 0.9;
}

header p {
    color: #ecf0f1;
    margin-top: 0.5rem;
}

/* Tags */
.tags-filter {
    background: white;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tags-filter h3 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

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

.tag {
    padding: 0.4rem 0.8rem;
    background: #ecf0f1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.tag:hover {
    background: #e0e6e8;
}

.tag.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Loading & Error */
.loading, .error {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    margin: 2rem 0;
}

.loading {
    color: #7f8c8d;
}

.error {
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

/* Post List */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.post-card-content {
    padding: 1.5rem;
}

.post-card h2 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.post-meta {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-excerpt {
    color: #555;
    line-height: 1.6;
}

.post-tags {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    background: #ecf0f1;
    border-radius: 12px;
    color: #555;
}

/* Single Post */
.post-single {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 900px;
    margin: 0 auto 2rem;
}

.back-button {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 2rem;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: background 0.2s;
}

.back-button:hover {
    background: var(--link-hover);
}

.post-single h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2.5rem;
    line-height: 1.2;
}

.post-single .post-meta {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

/* Markdown Content */
.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--primary-color);
    margin: 2rem 0 1rem;
    line-height: 1.3;
}

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

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

.post-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.post-content a:hover {
    border-bottom-color: var(--link-color);
}

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

/* Inline code */
.post-content code:not([class*="language-"]) {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

/* Code blocks with Prism */
.post-content pre[class*="language-"] {
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.post-content pre[class*="language-"] code {
    background: none;
    padding: 0;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Line numbers styling */
.line-numbers .line-numbers-rows {
    border-right: 1px solid #4a4a4a;
}

/* Toolbar (copy button) styling */
div.code-toolbar {
    margin: 2rem 0;
}

div.code-toolbar > .toolbar {
    opacity: 1;
}

div.code-toolbar > .toolbar button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

div.code-toolbar > .toolbar button:hover {
    background: #2980b9;
}

div.code-toolbar > .toolbar button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Success message after copy */
div.code-toolbar > .toolbar .copy-to-clipboard-button[data-copy-state="copy-success"] {
    background: #27ae60;
}

/* Scrollbar for code blocks */
.post-content pre[class*="language-"]::-webkit-scrollbar {
    height: 8px;
}

.post-content pre[class*="language-"]::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.post-content pre[class*="language-"]::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
}

.post-content pre[class*="language-"]::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

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

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

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

/* Media */
.post-media {
    margin: 2rem 0;
}

.media-item {
    margin-bottom: 1.5rem;
}

.media-item img,
.media-item audio,
.media-item iframe {
    max-width: 100%;
    border-radius: 4px;
}

.media-item iframe {
    width: 100%;
    aspect-ratio: 16/9;
    height: auto;
}

.media-caption {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    margin-top: 4rem;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .post-single {
        padding: 1.5rem;
    }
    
    .header-content {
        gap: 1rem;
    }
    
    .site-logo {
        width: 60px;
        height: 60px;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .post-single h1 {
        font-size: 2rem;
    }
}
