/* Article Detail Page Styles */

/* Layout Styles - Using unique class names to avoid conflicts */
.article-left-content {
    flex: 1;
    min-width: 0;
    margin-top: 20px;
}

.article-detail-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Ensure proper spacing on mobile */
@media (max-width: 992px) {
    .article-left-content {
        margin-right: 0;
        margin-top: 20px;
    }
}

/* Article Header Styles */
.article-detail-header {
    margin-bottom: 20px;
}

.article-detail-meta {
    margin-bottom: 10px;
    color: #777;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.article-detail-title {
    font-size: 2em;
    margin: 0;
    line-height: 1.3;
}

@media (max-width: 767px) {
    .article-detail-title {
        font-size: 1.5em;
        line-height: 1.3;
        margin-top: 0;
        margin-bottom: 10px;
        word-break: break-word;
    }
}

/* Article Content Styles */
.article-detail-featured-image {
    margin-bottom: 20px;
}

/* Prevent text overflow and layout breaking */
.article-detail-container,
.article-detail-content,
.article-detail-content p,
.article-detail-content div,
.comment-text,
.comment-content {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* Handle long URLs and code blocks */
.article-detail-content a,
.article-detail-content code,
.article-detail-content pre {
    word-break: break-all;
    overflow-wrap: break-word;
}

.article-detail-content pre {
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Ensure containers don't overflow */
.article-left-content {
    min-width: 0; /* Allow flex item to shrink below content size */
}

/* Handle tables and wide content */
.article-detail-content table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.article-detail-content table td,
.article-detail-content table th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0;
}

/* Handle embedded content and iframes */
.article-detail-content iframe,
.article-detail-content video,
.article-detail-content embed,
.article-detail-content object {
    max-width: 100%;
    height: auto;
}

/* Responsive wrapper for embedded content */
.article-detail-content .embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
}

.article-detail-content .embed-responsive::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.article-detail-content .embed-responsive iframe,
.article-detail-content .embed-responsive video,
.article-detail-content .embed-responsive embed,
.article-detail-content .embed-responsive object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.article-detail-featured-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.article-detail-banner {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.article-detail-banner a {
    display: block;
}

.article-detail-banner img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
}

.article-detail-content {
    line-height: 1.6;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.article-detail-content img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
}

/* Article Tags */
.article-detail-tags {
    margin-bottom: 20px;
}

.article-detail-tag {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 8px;
    padding: 4px 10px;
    background-color: #f5f5f5;
    border-radius: 20px;
    color: #555;
    font-size: 0.85em;
    text-decoration: none;
}

/* Social Share Section */
.article-share-section {
    padding-top: 20px;
    padding-bottom: 20px;
    border-top: 1px solid #eee;
    background-color: #fff;
    margin-top: 20px;
}

.share-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    text-decoration: none;
    position: relative;
}

.share-button i {
    margin-right: 8px;
}

.share-button span {
    font-size: 0.9em;
}

.facebook {
    color: #1877f2;
}

.twitter {
    color: #1da1f2;
}

/* Comments Section */
.comments-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.comments-section h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
}

.comments-disabled-message {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #e57373;
    margin-bottom: 20px;
}

.comments-disabled-message p {
    margin: 0;
    color: #d32f2f;
    font-weight: 500;
}

.comment-form {
    margin-bottom: 20px;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.comment-form button {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.login-message {
    margin-bottom: 20px;
}

.login-message a {
    color: #1976d2;
    text-decoration: none;
}

.comments-list {
    margin-top: 20px;
}

.comment {
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin-left: var(--comment-indent, 0em);
}

.comment-meta {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #777;
}

.comment-content {
    line-height: 1.4;
}

.reply-button {
    background: #f0f0f0;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
}

.reply-form {
    margin-top: 10px;
}

.reply-form.hidden {
    display: none;
}

.reply-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.reply-form button {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

/* Category Tags for Related Articles */
.article-categories {
    margin-top: 5px;
}

.category-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    margin-right: 5px;
    background-color: #f0f0f0;
    border-radius: 12px;
    color: #555;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.category-tag:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* AI News Section Styles */
.ai-news-section {
    border-top: 3px solid #6200ea;
    background-color: #f5f0ff;
}

.ai-news-section .section-title {
    color: #6200ea;
}

/* Sidebar styles handled by homepage CSS - no custom styles needed */

/* Photo Gallery Styles */
.article-gallery-section {
    margin: 20px 0;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.gallery-title {
    font-size: 1.4em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 15px 10px 10px;
    font-size: 0.9em;
    line-height: 1.3;
}

/* Lightbox Styles */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-close:hover {
    color: #ccc;
}

#lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.lightbox-prev,
.lightbox-next {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    pointer-events: all;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(255,255,255,0.4);
}

.lightbox-caption {
    color: white;
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
    line-height: 1.4;
}

.lightbox-counter {
    color: white;
    text-align: center;
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive adjustments for gallery */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .lightbox-content {
        padding: 10px;
    }
    
    .lightbox-nav {
        padding: 0 10px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        padding: 10px 15px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-item img {
        height: 120px;
    }
}

/* Responsive styles for sidebar handled by homepage CSS */
