/**
 * Frontend Styles for Single Post Templates
 * Material UI + Tailwind Design Principles
 * Lightweight & Performance Optimized
 */

/* CSS Variables - Material Design Color System */
:root {
    --er-primary: #1976d2;
    --er-primary-dark: #1565c0;
    --er-secondary: #dc004e;
    --er-text-primary: #212121;
    --er-text-secondary: #757575;
    --er-divider: #e0e0e0;
    --er-background: #ffffff;
    --er-surface: #f5f5f5;
    --er-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --er-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --er-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --er-radius: 8px;
    --er-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dynamic values from settings */
    --er-content-width: 800px;
    --er-heading-size: 32px;
    --er-body-size: 16px;
    --er-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Template Styles */
.er-post-template {
    font-family: var(--er-font-family);
    color: var(--er-text-primary);
    line-height: 1.6;
    background-color: var(--er-surface);
}

.er-post-article {
    background-color: var(--er-background);
}

.er-post-container {
    max-width: var(--er-content-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Typography */
.er-post-title {
    font-size: var(--er-heading-size);
    font-weight: 700;
    line-height: 1.2;
    margin: 24px 0;
    color: var(--er-text-primary);
    letter-spacing: -0.02em;
}

.er-post-content {
    font-size: var(--er-body-size);
    color: var(--er-text-primary);
    margin: 32px 0;
}

.er-post-content p {
    margin-bottom: 1.5em;
    line-height: 1.75;
}

.er-post-content h2,
.er-post-content h3,
.er-post-content h4 {
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 0.75em;
    line-height: 1.3;
    color: var(--er-text-primary);
}

.er-post-content h2 { font-size: 1.75em; }
.er-post-content h3 { font-size: 1.5em; }
.er-post-content h4 { font-size: 1.25em; }

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

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

/* Featured Images */
.er-featured-image {
    margin: 0;
    overflow: hidden;
}

.er-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.er-featured-full {
    border-radius: 0;
    margin-bottom: 40px;
}

.er-featured-full img {
    max-height: 500px;
    object-fit: cover;
}

.er-featured-contained {
    border-radius: var(--er-radius);
    margin: 24px 0;
}

.er-featured-contained img {
    border-radius: var(--er-radius);
}

.er-featured-centered {
    text-align: center;
    margin: 32px 0;
}

.er-featured-centered img {
    border-radius: var(--er-radius);
    box-shadow: var(--er-shadow-md);
}

/* Post Meta */
.er-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    color: var(--er-text-secondary);
    font-size: 14px;
    margin: 16px 0;
    padding: 16px 0;
    border-top: 1px solid var(--er-divider);
    border-bottom: 1px solid var(--er-divider);
}

.er-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.er-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    opacity: 0.7;
}

.er-meta-item a {
    color: var(--er-text-secondary);
    text-decoration: none;
    transition: var(--er-transition);
}

.er-meta-item a:hover {
    color: var(--er-primary);
}

/* Post Tags */
.er-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0;
}

.er-tag {
    display: inline-block;
    padding: 6px 12px;
    background-color: var(--er-surface);
    color: var(--er-text-secondary);
    border-radius: 16px;
    font-size: 13px;
    text-decoration: none;
    transition: var(--er-transition);
    border: 1px solid var(--er-divider);
}

.er-tag:hover {
    background-color: var(--er-primary);
    color: white;
    border-color: var(--er-primary);
}

/* Post Footer */
.er-post-footer {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--er-divider);
}

/* Page Links */
.er-page-links {
    margin: 32px 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.er-page-links a,
.er-page-links > span {
    display: inline-block;
    padding: 8px 12px;
    background-color: var(--er-surface);
    border-radius: var(--er-radius);
    text-decoration: none;
    color: var(--er-text-primary);
    transition: var(--er-transition);
}

.er-page-links a:hover {
    background-color: var(--er-primary);
    color: white;
}

/* Modern Template Specific */
.er-template-modern .er-post-container {
    padding-top: 40px;
    padding-bottom: 40px;
}

.er-template-modern .er-post-header {
    margin-bottom: 32px;
}

/* Minimal Template Specific */
.er-template-minimal {
    background-color: white;
}

.er-minimal-container {
    max-width: 700px;
}

.er-template-minimal .er-post-header {
    text-align: center;
    margin: 64px 0 48px;
}

.er-template-minimal .er-post-title {
    font-size: calc(var(--er-heading-size) * 1.2);
    margin-bottom: 16px;
}

.er-template-minimal .er-post-meta {
    justify-content: center;
    border: none;
}

/* Magazine Template Specific */
.er-featured-hero {
    position: relative;
    margin: 0;
    max-height: 600px;
}

.er-featured-hero img {
    max-height: 600px;
    object-fit: cover;
    width: 100%;
}

.er-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 48px 0 32px;
}

.er-title-overlay {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.er-hero-overlay .er-post-meta {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
}

.er-hero-overlay .er-meta-item a {
    color: rgba(255, 255, 255, 0.9);
}

.er-magazine-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    margin-top: 40px;
}

.er-magazine-sidebar {
    position: sticky;
    top: 32px;
    align-self: start;
}

.er-sidebar-widget {
    background-color: var(--er-surface);
    padding: 24px;
    border-radius: var(--er-radius);
    margin-bottom: 24px;
}

.er-sidebar-widget h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--er-text-primary);
}

.er-recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.er-recent-list li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--er-divider);
}

.er-recent-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.er-recent-list a {
    color: var(--er-text-primary);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    transition: var(--er-transition);
}

.er-recent-list a:hover {
    color: var(--er-primary);
}

/* Comments Section */
.er-comments-wrapper {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 2px solid var(--er-divider);
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .er-post-container {
        padding: 0 16px;
    }
    
    .er-post-title {
        font-size: calc(var(--er-heading-size) * 0.85);
    }
    
    .er-post-meta {
        font-size: 13px;
        gap: 12px;
    }
    
    .er-magazine-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .er-magazine-sidebar {
        position: static;
    }
    
    .er-template-minimal .er-post-header {
        margin: 32px 0 24px;
    }
}

@media (max-width: 480px) {
    .er-post-title {
        font-size: calc(var(--er-heading-size) * 0.75);
    }
    
    .er-post-content {
        font-size: calc(var(--er-body-size) * 0.95);
    }
    
    .er-featured-full img {
        max-height: 300px;
    }
}
