/* ========================================================================
   CKEDITOR CONTENT STYLING (Frontend)
   ======================================================================== */

/* 
   Add this CSS to your blogs.css or create a separate ckeditor-content.css
   This styles the rich text content created with CKEditor
*/

/* Main content wrapper */
.blog-post-content {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
}

/* Headings */
.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4,
.blog-post-content h5,
.blog-post-content h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #1a1a1a;
}

.blog-post-content h1 {
    font-size: 2.5em;
    border-bottom: 3px solid #4fb3d9;
    padding-bottom: 0.3em;
}

.blog-post-content h2 {
    font-size: 2em;
    border-bottom: 2px solid #5dbea3;
    padding-bottom: 0.3em;
}

.blog-post-content h3 {
    font-size: 1.75em;
    color: #4fb3d9;
}

.blog-post-content h4 {
    font-size: 1.5em;
}

.blog-post-content h5 {
    font-size: 1.25em;
}

.blog-post-content h6 {
    font-size: 1em;
    color: #666;
    text-transform: uppercase;
}

/* Paragraphs */
.blog-post-content p {
    margin-bottom: 1.5em;
    text-align: justify;
}

.blog-post-content p:last-child {
    margin-bottom: 0;
}

/* Links */
.blog-post-content a {
    color: #4fb3d9;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.blog-post-content a:hover {
    color: #5dbea3;
    border-bottom-color: #5dbea3;
}

/* Strong and emphasis */
.blog-post-content strong,
.blog-post-content b {
    font-weight: 700;
    color: #1a1a1a;
}

.blog-post-content em,
.blog-post-content i {
    font-style: italic;
}

.blog-post-content u {
    text-decoration: underline;
}

/* Lists */
.blog-post-content ul,
.blog-post-content ol {
    margin: 1.5em 0;
    padding-left: 2em;
}

.blog-post-content ul {
    list-style-type: disc;
}

.blog-post-content ol {
    list-style-type: decimal;
}

.blog-post-content li {
    margin-bottom: 0.75em;
    line-height: 1.8;
}

.blog-post-content li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.blog-post-content ul ul,
.blog-post-content ol ol,
.blog-post-content ul ol,
.blog-post-content ol ul {
    margin-top: 0.75em;
    margin-bottom: 0;
}

.blog-post-content ul ul {
    list-style-type: circle;
}

.blog-post-content ul ul ul {
    list-style-type: square;
}

/* Blockquotes */
.blog-post-content blockquote {
    margin: 2em 0;
    padding: 1.5em 2em;
    border-left: 5px solid #4fb3d9;
    background: linear-gradient(to right, rgba(79, 179, 217, 0.05), transparent);
    font-style: italic;
    color: #555;
    position: relative;
}

.blog-post-content blockquote::before {
    content: '"';
    font-size: 4em;
    color: rgba(79, 179, 217, 0.2);
    position: absolute;
    top: -10px;
    left: 10px;
    font-family: Georgia, serif;
}

.blog-post-content blockquote p {
    margin: 0;
}

.blog-post-content blockquote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.9em;
    color: #666;
    font-style: normal;
}

.blog-post-content blockquote cite::before {
    content: '— ';
}

/* Code blocks */
.blog-post-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 1.5em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2em 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.blog-post-content code {
    background: #f5f5f5;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.blog-post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Tables */
.blog-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-radius: 8px;
}

.blog-post-content thead {
    background: linear-gradient(135deg, #4fb3d9 0%, #5dbea3 100%);
    color: white;
}

.blog-post-content th {
    padding: 1em;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

.blog-post-content td {
    padding: 1em;
    border-bottom: 1px solid #e0e0e0;
}

.blog-post-content tbody tr {
    transition: background-color 0.3s ease;
}

.blog-post-content tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.blog-post-content tbody tr:hover {
    background-color: rgba(79, 179, 217, 0.1);
}

.blog-post-content tbody tr:last-child td {
    border-bottom: none;
}

/* Images */
.blog-post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2em auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-post-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Image alignment classes (CKEditor adds these) */
.blog-post-content img.align-left {
    float: left;
    margin: 0.5em 1.5em 1em 0;
}

.blog-post-content img.align-right {
    float: right;
    margin: 0.5em 0 1em 1.5em;
}

.blog-post-content img.align-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Image captions */
.blog-post-content figure {
    margin: 2em 0;
    text-align: center;
}

.blog-post-content figure img {
    margin: 0 auto 1em;
}

.blog-post-content figcaption {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Horizontal rule */
.blog-post-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #4fb3d9, transparent);
    margin: 3em 0;
}

/* Subscript and superscript */
.blog-post-content sub,
.blog-post-content sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.blog-post-content sup {
    top: -0.5em;
}

.blog-post-content sub {
    bottom: -0.25em;
}

/* Definition lists */
.blog-post-content dl {
    margin: 1.5em 0;
}

.blog-post-content dt {
    font-weight: 700;
    color: #4fb3d9;
    margin-top: 1em;
}

.blog-post-content dd {
    margin-left: 2em;
    margin-bottom: 1em;
}

/* Address */
.blog-post-content address {
    font-style: normal;
    padding: 1em;
    background: #f8f9fa;
    border-left: 4px solid #4fb3d9;
    margin: 1.5em 0;
}

/* Mark/highlight */
.blog-post-content mark {
    background-color: #fff3cd;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

/* Embedded content (iframes, videos) */
.blog-post-content iframe {
    max-width: 100%;
    margin: 2em 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Video wrapper for responsive videos */
.blog-post-content .video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 2em 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.blog-post-content .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 8px;
}

/* Clearfix for floated images */
.blog-post-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .blog-post-content {
        font-size: 15px;
    }

    .blog-post-content h1 {
        font-size: 2em;
    }

    .blog-post-content h2 {
        font-size: 1.75em;
    }

    .blog-post-content h3 {
        font-size: 1.5em;
    }

    .blog-post-content h4 {
        font-size: 1.25em;
    }

    .blog-post-content ul,
    .blog-post-content ol {
        padding-left: 1.5em;
    }

    .blog-post-content blockquote {
        padding: 1em 1.5em;
        margin: 1.5em 0;
    }

    .blog-post-content pre {
        padding: 1em;
        font-size: 0.85em;
    }

    .blog-post-content table {
        font-size: 0.9em;
    }

    .blog-post-content th,
    .blog-post-content td {
        padding: 0.75em 0.5em;
    }

    /* Remove float on mobile for better readability */
    .blog-post-content img.align-left,
    .blog-post-content img.align-right {
        float: none;
        margin: 2em auto;
        display: block;
    }
}

/* Print styles */
@media print {
    .blog-post-content {
        font-size: 12pt;
        line-height: 1.6;
    }

    .blog-post-content a {
        color: #000;
        text-decoration: underline;
    }

    .blog-post-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    .blog-post-content h1,
    .blog-post-content h2,
    .blog-post-content h3,
    .blog-post-content h4,
    .blog-post-content h5,
    .blog-post-content h6 {
        page-break-after: avoid;
    }

    .blog-post-content pre,
    .blog-post-content blockquote,
    .blog-post-content table {
        page-break-inside: avoid;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .blog-post-content {
        color: #e0e0e0;
    }

    .blog-post-content h1,
    .blog-post-content h2,
    .blog-post-content h3,
    .blog-post-content h4,
    .blog-post-content h5,
    .blog-post-content h6 {
        color: #f0f0f0;
    }

    .blog-post-content a {
        color: #5dbea3;
    }

    .blog-post-content code {
        background: #2d2d2d;
        color: #f06292;
    }

    .blog-post-content blockquote {
        background: rgba(79, 179, 217, 0.1);
        color: #ccc;
    }

    .blog-post-content table tbody tr:nth-child(even) {
        background-color: #2d2d2d;
    }

    .blog-post-content table tbody tr:hover {
        background-color: rgba(79, 179, 217, 0.15);
    }

    .blog-post-content mark {
        background-color: #856404;
        color: #fff;
    }
}