/**
 * News Detail Page Styles
 * Styling cho trang chi tiết bài viết tin tức
 */

/* Blog Title */
.blog-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a1a;
}

.blog-meta-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 14px;
}

.blog-meta-list li i {
    font-size: 18px;
}

.blog-thumbnail img {
    max-height: 500px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* CKEditor Content Styles */
.ckeditor-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    max-width: 100%;
}

.ckeditor-content h1,
.ckeditor-content h2,
.ckeditor-content h3,
.ckeditor-content h4,
.ckeditor-content h5,
.ckeditor-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    color: #2c3e50;
}

.ckeditor-content h2 {
    font-size: 1.75rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5em;
}

.ckeditor-content h3 {
    font-size: 1.5rem;
}

.ckeditor-content p {
    margin-bottom: 1.25em;
    text-align: justify;
}

.ckeditor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2em auto;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ckeditor-content a {
    color: #0d6efd;
    text-decoration: none;
}

.ckeditor-content a:hover {
    text-decoration: underline;
}

.ckeditor-content ul,
.ckeditor-content ol {
    margin: 1em 0;
    padding-left: 2.5em;
}

.ckeditor-content li {
    margin-bottom: 0.5em;
}

.ckeditor-content blockquote {
    border-left: 4px solid #0d6efd;
    padding: 1em 1.5em;
    margin: 1.5em 0;
    background-color: #f8f9fa;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

/* Code Blocks - Beautiful Styling */
.ckeditor-content pre {
    position: relative;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    margin: 2em 0;
    border: 1px solid #3e3e3e;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    font-family: 'Consolas', 'Monaco', 'Courier New', 'SF Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* Code Block Wrapper */
.code-block-wrapper {
    position: relative;
    margin: 2em 0;
}

/* Code Block Header */
.code-block-header {
    background: #2d2d2d;
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e3e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
}

.code-block-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-block-dots {
    display: flex;
    gap: 6px;
}

.code-block-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-block-dot.red {
    background: #ff5f56;
}

.code-block-dot.yellow {
    background: #ffbd2e;
}

.code-block-dot.green {
    background: #27c93f;
}

.code-block-title {
    color: #858585;
    font-size: 12px;
    margin-left: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Code Block Content */
.code-block-content {
    position: relative;
    background: #1e1e1e;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    padding: 1.5em;
    transition: max-height 0.3s ease;
}

.code-block-content.expanded {
    max-height: none;
}

.code-block-content.collapsed {
    overflow: hidden;
    position: relative;
}

.code-block-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, #1e1e1e);
    pointer-events: none;
}

/* Code Block Footer */
.code-block-footer {
    background: #2d2d2d;
    padding: 12px 15px;
    border-top: 1px solid #3e3e3e;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 8px 8px;
}

.code-expand-btn {
    background: #3e3e3e;
    color: #d4d4d4;
    border: 1px solid #555;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.code-expand-btn:hover {
    background: #4a4a4a;
    border-color: #666;
    color: #fff;
}

.code-expand-btn.expanded i {
    transform: rotate(180deg);
}

.code-expand-btn i {
    transition: transform 0.3s ease;
}

.ckeditor-content pre code {
    display: block;
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    white-space: pre;
    word-wrap: normal;
    overflow-x: visible;
    position: relative;
    z-index: 1;
}

/* Inline Code */
.ckeditor-content code:not(pre code) {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #d63384;
    padding: 0.25em 0.6em;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', 'SF Mono', monospace;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    word-break: break-word;
}

/* Syntax Highlighting Colors */
.ckeditor-content pre code .keyword {
    color: #569cd6;
}

.ckeditor-content pre code .string {
    color: #ce9178;
}

.ckeditor-content pre code .comment {
    color: #6a9955;
    font-style: italic;
}

.ckeditor-content pre code .number {
    color: #b5cea8;
}

.ckeditor-content pre code .function {
    color: #dcdcaa;
}

.ckeditor-content pre code .variable {
    color: #9cdcfe;
}

/* Scrollbar for Code Blocks */
.code-block-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-block-content::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-block-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-block-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Copy Button for Code Blocks */
.code-copy-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d4d4d4;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

.code-copy-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.code-copy-btn.copied {
    background: rgba(40, 167, 69, 0.3);
    border-color: #28a745;
    color: #28a745;
}

/* Better code block margins */
.code-block-wrapper + p,
.ckeditor-content p + .code-block-wrapper {
    margin-top: 2em;
}

/* Hide expand button if content is short */
.code-block-wrapper:not(.has-expand) .code-block-footer {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .blog-title {
        font-size: 1.5rem;
    }
    
    .code-block-content {
        padding: 1em;
        font-size: 13px;
        max-height: 300px;
    }
    
    .code-copy-btn {
        opacity: 1;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .code-block-title {
        display: none;
    }
}

