/* 
 * Content Display CSS
 * Xử lý hiển thị nội dung từ Quill Editor
 */

/* Container chính cho nội dung */
.content-display {
    font-size: 16px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow: hidden;
}

/* Xử lý ảnh trong nội dung */
.content-display img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 15px 0;
    display: block;
    box-sizing: border-box;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Override inline styles cho ảnh */
.content-display img[width] {
    width: auto !important;
    max-width: 100% !important;
}

.content-display img[style*="width"] {
    width: auto !important;
    max-width: 100% !important;
}

.content-display img[style*="height"] {
    height: auto !important;
}

/* Headings */
.content-display h1,
.content-display h2,
.content-display h3,
.content-display h4,
.content-display h5,
.content-display h6 {
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.content-display h1 { font-size: 2rem; }
.content-display h2 { font-size: 1.75rem; }
.content-display h3 { font-size: 1.5rem; }
.content-display h4 { font-size: 1.25rem; }
.content-display h5 { font-size: 1.1rem; }
.content-display h6 { font-size: 1rem; }

/* Paragraphs */
.content-display p {
    margin-bottom: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Lists */
.content-display ul,
.content-display ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.content-display li {
    margin-bottom: 5px;
}

/* Blockquotes */
.content-display blockquote {
    border-left: 4px solid #007bff;
    padding: 15px 20px;
    margin: 20px 0;
    background-color: #f8f9fa;
    border-radius: 4px;
    max-width: 100%;
    box-sizing: border-box;
    font-style: italic;
}

.content-display blockquote p:last-child {
    margin-bottom: 0;
}

/* Code blocks */
.content-display pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.content-display code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content-display pre code {
    background-color: transparent;
    padding: 0;
}

/* Tables */
.content-display table {
    width: 100%;
    max-width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
    table-layout: auto;
    word-wrap: break-word;
}

.content-display table th,
.content-display table td {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    text-align: left;
    word-wrap: break-word;
}

.content-display table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.content-display table img {
    max-width: 200px !important;
    margin: 5px 0;
}

/* Links */
.content-display a {
    color: #007bff;
    text-decoration: none;
    word-wrap: break-word;
}

.content-display a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Video và iframe responsive */
.content-display video,
.content-display iframe {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 4px;
    margin: 15px 0;
}

/* Text alignment classes từ Quill */
.content-display .ql-align-center {
    text-align: center;
}

.content-display .ql-align-right {
    text-align: right;
}

.content-display .ql-align-justify {
    text-align: justify;
}

/* Text formatting từ Quill */
.content-display strong {
    font-weight: 600;
}

.content-display em {
    font-style: italic;
}

.content-display u {
    text-decoration: underline;
}

.content-display s {
    text-decoration: line-through;
}

/* Đảm bảo tất cả elements không tràn */
.content-display * {
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Line Height support */
.content-display p[style*="line-height"],
.content-display div[style*="line-height"],
.content-display h1[style*="line-height"],
.content-display h2[style*="line-height"],
.content-display h3[style*="line-height"],
.content-display h4[style*="line-height"],
.content-display h5[style*="line-height"],
.content-display h6[style*="line-height"] {
    /* CSS này đảm bảo line-height inline styles hoạt động đúng */
}

/* Editor line height support */
.ql-editor p[style*="line-height"],
.ql-editor div[style*="line-height"],
.ql-editor h1[style*="line-height"],
.ql-editor h2[style*="line-height"],
.ql-editor h3[style*="line-height"],
.ql-editor h4[style*="line-height"],
.ql-editor h5[style*="line-height"],
.ql-editor h6[style*="line-height"] {
    /* CSS này đảm bảo line-height inline styles hiển thị trong editor */
}

/* Font Size support */
.content-display span[style*="font-size"],
.content-display p[style*="font-size"],
.content-display div[style*="font-size"],
.content-display strong[style*="font-size"],
.content-display em[style*="font-size"] {
    /* CSS này đảm bảo font-size inline styles hoạt động đúng */
}

.ql-editor span[style*="font-size"],
.ql-editor p[style*="font-size"],
.ql-editor div[style*="font-size"],
.ql-editor strong[style*="font-size"],
.ql-editor em[style*="font-size"] {
    /* CSS này đảm bảo font-size inline styles hiển thị trong editor */
}

/* Excel Table Styles */
.content-display .excel-table,
.ql-editor .excel-table {
    width: 100% !important;
    border-collapse: collapse !important;
    background-color: #fff !important;
    font-family: inherit !important;
    margin: 15px 0 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    border: 1px solid #dee2e6 !important;
    display: table !important;
}

.content-display .excel-table td,
.content-display .excel-table th {
    border: 1px solid #dee2e6;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.content-display .excel-table th {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
    color: #495057 !important;
    border-bottom: 2px solid #dee2e6 !important;
}

.content-display .excel-table tbody tr:nth-child(even) {
    background-color: #f9f9f9 !important;
}

.content-display .excel-table tbody tr:hover {
    background-color: #e3f2fd !important;
    transition: background-color 0.2s ease;
}

/* Combined table styles already handled above */

/* Responsive cho mobile */
@media (max-width: 768px) {
    .content-display {
        font-size: 14px;
    }
    
    .content-display img {
        margin: 10px 0;
    }
    
    .content-display blockquote {
        padding: 10px 15px;
        margin: 15px 0;
    }
    
    .content-display table {
        font-size: 12px;
    }
    
    .content-display table th,
    .content-display table td {
        padding: 6px 8px;
    }

    /* Excel Table responsive */
    .content-display .excel-table,
    .ql-editor .excel-table {
        font-size: 12px !important;
        margin: 10px 0 !important;
        border-radius: 4px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }

    .content-display .excel-table td,
    .content-display .excel-table th,
    .ql-editor .excel-table td,
    .ql-editor .excel-table th {
        padding: 6px 8px !important;
        font-size: 12px !important;
        word-break: break-word !important;
    }

    .content-display .excel-table th,
    .ql-editor .excel-table th {
        font-size: 11px !important;
        padding: 5px 6px !important;
    }
    
    .content-display h1 { font-size: 1.5rem; }
    .content-display h2 { font-size: 1.3rem; }
    .content-display h3 { font-size: 1.2rem; }
    .content-display h4 { font-size: 1.1rem; }
    .content-display h5 { font-size: 1rem; }
    .content-display h6 { font-size: 0.9rem; }
}

/* Print styles */
@media print {
    .content-display {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .content-display img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    .content-display blockquote {
        page-break-inside: avoid;
    }
} 