/* Post Detail CSS - Comprehensive Styles */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --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);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Georgia', serif;
    
    --container-max-width: 1200px;
    --sidebar-width: 320px;
}

/* ===== POST CONTAINER ===== */
.post-container {
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* ===== POST HEADER ===== */
.post-header {
    background: var(--bg-primary);
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Breadcrumb */
.post-breadcrumb {
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.post-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

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

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-muted);
}

.current-post {
    color: var(--text-primary);
    font-weight: 500;
}

/* Post Meta */
.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.category-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.category-badge:hover {
    background: var(--primary-dark);
}

.post-date,
.reading-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Post Title */
.post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Post Excerpt */
.post-excerpt {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    font-style: italic;
}

/* Author Info */
.author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.author-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
}

.author-details {
    flex: 1;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: block;
}

.author-posts-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.author-posts-link:hover {
    text-decoration: underline;
}

/* ===== FEATURED IMAGE ===== */
.post-featured-image {
    padding: 2rem 0;
}

.featured-img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

/* ===== POST BODY ===== */
.post-body {
    padding: 3rem 0;
}

.post-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 3rem;
    align-items: start;
}

.post-main {
    min-height: 500px;
}

/* Post Text Content */
.post-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 3rem;
}

.post-text h1, .post-text h2, .post-text h3, .post-text h4, .post-text h5, .post-text h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.post-text h1 { font-size: 2rem; }
.post-text h2 { font-size: 1.75rem; }
.post-text h3 { font-size: 1.5rem; }
.post-text h4 { font-size: 1.25rem; }
.post-text h5 { font-size: 1.125rem; }
.post-text h6 { font-size: 1rem; }

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

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

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

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

.post-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 2rem 0;
}

.post-text code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
}

.post-text pre {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 2rem 0;
}

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

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

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

/* Post Tags */
.post-tags {
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.post-tags h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.tag-link {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

/* ===== POST ACTIONS ===== */
.post-actions {
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

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

.action-btn.liked {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Social Sharing */
.social-sharing {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.social-sharing h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.social-buttons {
    display: flex;
    gap: 0.5rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: white;
    text-decoration: none;
    transition: transform 0.2s;
}

.social-btn:hover {
    transform: translateY(-2px);
}

.social-btn.facebook { background: #1877f2; }
.social-btn.twitter { background: #1da1f2; }
.social-btn.linkedin { background: #0077b5; }
.social-btn.email { background: var(--secondary-color); }

/* ===== COMMENTS SECTION ===== */
.comments-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Comment Form */
.comment-form-wrapper {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.comment-form-wrapper h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    position: relative;
}

.comment-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.comment-textarea:focus {
    border-color: var(--primary-color);
}

.char-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.submit-comment-btn {
    align-self: flex-start;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.submit-comment-btn:hover {
    background: var(--primary-dark);
}

.login-to-comment {
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.login-to-comment a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-to-comment a:hover {
    text-decoration: underline;
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
}

.comment-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.comment-text {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.comment-actions {
    margin-bottom: 1rem;
}

.reply-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
}

.reply-btn:hover {
    text-decoration: underline;
}

.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

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

.cancel-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s;
}

.cancel-btn:hover {
    background: var(--bg-secondary);
}

.replies-list {
    margin-top: 1rem;
    margin-left: 2rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-light);
}

.reply-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reply-item:last-child {
    margin-bottom: 0;
}

.reply-item .comment-avatar {
    width: 40px;
    height: 40px;
}

.no-comments {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ===== POST SIDEBAR ===== */
.post-sidebar {
    position: sticky;
    top: 2rem;
}

.sidebar-widget {
    background: var(--bg-primary);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid #e1e5e9;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Post Stats Widget */
.post-stats-widget {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.stat-item i {
    color: var(--primary-color);
    font-size: 1.25rem;
    width: 20px;
}

.stat-label {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Related Posts */
.related-posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-post-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.related-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.related-post-image {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-post-content {
    flex: 1;
}

.related-post-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

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

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

.related-post-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Newsletter Widget */
.newsletter-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.newsletter-widget .widget-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
}

.newsletter-widget .widget-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.newsletter-widget p {
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.6;
    font-size: 0.95rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.newsletter-input {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    color: #6c757d;
    background: rgba(255,255,255,0.9);
    outline: none;
    transition: background 0.3s ease;
}

.newsletter-input:focus {
    background: white;
}

.newsletter-input::placeholder {
    color: #6c757d;
}

.newsletter-btn {
    padding: 12px 25px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.newsletter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .post-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .post-sidebar {
        position: static;
    }
    
    .post-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .post-header {
        padding: 2rem 0 1rem;
    }
    
    .post-title {
        font-size: 1.75rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .social-buttons {
        justify-content: center;
    }
    
    .comment-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .comment-avatar {
        width: 40px;
        height: 40px;
    }
    
    .replies-list {
        margin-left: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .post-header {
        padding: 1.5rem 0 1rem;
    }
    
    .post-body {
        padding: 2rem 0;
    }
    
    .comment-form-wrapper {
        padding: 1rem;
    }
    
    .post-actions {
        padding: 1rem;
    }
}

/* ===== LOGIN REQUIRED MESSAGE ===== */

.login-form-container {
    max-width: 400px;
    margin: 2.5rem auto 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.08);
    padding: 2rem 2.2rem 1.5rem 2.2rem;
    border: 1px solid #e2e8f0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

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

.login-form label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.2rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    background: #f7fafc;
    transition: border 0.2s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: #667eea;
    outline: none;
    background: #fff;
}

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

.login-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.login-links {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.register-link,
.forgot-password-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.register-link:hover,
.forgot-password-link:hover {
    color: #764ba2;
    text-decoration: underline;
}


.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}
.alert-error, .alert-danger {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #feb2b2;
}



/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-main,
.post-sidebar {
    animation: fadeIn 0.6s ease-out;
}