/* CKEditor Content Styles for Frontend Display */

/* Base styles */
.ck-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #374151;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Headings */
.ck-content h1,
.ck-content h2,
.ck-content h3,
.ck-content h4,
.ck-content h5,
.ck-content h6 {
    margin: 32px 0 16px 0;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
}

.ck-content h1 { 
    font-size: 2.25rem; 
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.ck-content h2 { 
    font-size: 2rem; 
    color: #1e40af;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    margin: 32px 0 20px 0;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
    position: relative;
}

.ck-content h2::before {
    content: "📋";
    margin-right: 8px;
    font-size: 0.9em;
}

.ck-content h3 { 
    font-size: 1.6rem; 
    color: #059669;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    padding: 10px 16px;
    border-radius: 6px;
    border-left: 3px solid #10b981;
    margin: 28px 0 16px 0;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1);
    position: relative;
}

.ck-content h3::before {
    content: "▶";
    margin-right: 8px;
    color: #059669;
    font-size: 0.9em;
}

.ck-content h4 { 
    font-size: 1.25rem; 
}

.ck-content h5 { 
    font-size: 1.125rem; 
}

.ck-content h6 { 
    font-size: 1rem; 
    color: #6b7280;
}

/* Paragraphs */
.ck-content p {
    margin: 16px 0;
    text-align: justify;
}

/* Links */
.ck-content a {
    color: #3b82f6;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.ck-content a:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.ck-content a[target="_blank"]:after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
}

/* Lists */
.ck-content ul,
.ck-content ol {
    margin: 20px 0;
    padding-left: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    padding: 16px 20px 16px 40px;
    border-left: 4px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ck-content li {
    margin: 12px 0;
    line-height: 1.7;
    font-size: 1.05em;
    color: #374151;
    position: relative;
}

.ck-content ul li {
    list-style: none;
    padding-left: 20px;
}

.ck-content ul li::before {
    content: "🔹";
    position: absolute;
    left: -20px;
    color: #3b82f6;
    font-size: 1.1em;
}

.ck-content ol {
    counter-reset: custom-counter;
}

.ck-content ol li {
    list-style: none;
    counter-increment: custom-counter;
    padding-left: 30px;
    position: relative;
}

.ck-content ol li::before {
    content: counter(custom-counter);
    position: absolute;
    left: -25px;
    top: 0;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.ck-content ul ul,
.ck-content ol ol,
.ck-content ul ol,
.ck-content ol ul {
    margin: 8px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-left: 2px solid #cbd5e1;
    padding: 12px 16px 12px 30px;
}

.ck-content ul ul li::before {
    content: "▫";
    color: #64748b;
    font-size: 1em;
}

.ck-content ol ol li::before {
    content: counter(custom-counter, lower-alpha);
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    font-size: 0.8em;
    width: 20px;
    height: 20px;
}

/* Blockquotes */
.ck-content blockquote {
    border-left: 4px solid #3b82f6;
    padding: 16px 20px;
    margin: 24px 0;
    background-color: #f8fafc;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #6b7280;
}

.ck-content blockquote p {
    margin: 0;
}

/* Code blocks */
.ck-content pre {
    background-color: #1f2937;
    color: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: auto;
    border: 1px solid #374151;
}

.ck-content code {
    background-color: #f3f4f6;
    color: #e11d48;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.9em;
}

.ck-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

/* Tables */
.ck-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 24px 0;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ck-content table td,
.ck-content table th {
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
}

.ck-content table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #d1d5db;
}

.ck-content table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.ck-content table tbody tr:hover {
    background-color: #f3f4f6;
}

/* Images */
.ck-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.ck-content img:hover {
    transform: scale(1.02);
}

.ck-content figure {
    margin: 24px 0;
    text-align: center;
}

.ck-content figcaption {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

/* Image alignment */
.ck-content img[style*="float: left"],
.ck-content .image-style-align-left {
    float: left;
    margin: 8px 20px 8px 0;
}

.ck-content img[style*="float: right"],
.ck-content .image-style-align-right {
    float: right;
    margin: 8px 0 8px 20px;
}

.ck-content .image-style-align-center {
    display: block;
    margin: 20px auto;
}

/* Horizontal rules */
.ck-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
    margin: 32px 0;
}

/* Strong and emphasis */
.ck-content strong,
.ck-content b {
    font-weight: 600;
    color: #1f2937;
}

.ck-content em,
.ck-content i {
    font-style: italic;
    color: #4b5563;
}

.ck-content u {
    text-decoration: underline;
    text-decoration-color: #3b82f6;
    text-decoration-thickness: 2px;
}

.ck-content s {
    text-decoration: line-through;
    color: #6b7280;
}

/* Text alignment */
.ck-content .text-left {
    text-align: left;
}

.ck-content .text-center {
    text-align: center;
}

.ck-content .text-right {
    text-align: right;
}

.ck-content .text-justify {
    text-align: justify;
}

/* Font sizes */
.ck-content .text-xs { font-size: 0.75rem; }
.ck-content .text-sm { font-size: 0.875rem; }
.ck-content .text-base { font-size: 1rem; }
.ck-content .text-lg { font-size: 1.125rem; }
.ck-content .text-xl { font-size: 1.25rem; }
.ck-content .text-2xl { font-size: 1.5rem; }
.ck-content .text-3xl { font-size: 1.875rem; }

/* Media queries for responsive design */
@media (max-width: 768px) {
    .ck-content {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .ck-content h1 { font-size: 1.875rem; }
    .ck-content h2 { 
        font-size: 1.6rem; 
        padding: 10px 16px;
    }
    .ck-content h3 { 
        font-size: 1.3rem; 
        padding: 8px 12px;
    }
    
    .ck-content table {
        font-size: 14px;
    }
    
    .ck-content table td,
    .ck-content table th {
        padding: 8px 12px;
    }
    
    .ck-content img[style*="float: left"],
    .ck-content img[style*="float: right"],
    .ck-content .image-style-align-left,
    .ck-content .image-style-align-right {
        float: none;
        margin: 16px auto;
        display: block;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ck-content {
        color: #e5e7eb;
    }
    
    .ck-content h1,
    .ck-content h4,
    .ck-content h5,
    .ck-content h6 {
        color: #f9fafb;
    }
    
    .ck-content h2 {
        background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
        color: #dbeafe;
        border-left-color: #60a5fa;
    }
    
    .ck-content h3 {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        color: #d1fae5;
        border-left-color: #34d399;
    }
    
    .ck-content blockquote {
        background-color: #374151;
        border-left-color: #60a5fa;
    }
    
    .ck-content table {
        background-color: #1f2937;
        border-color: #374151;
    }
    
    .ck-content table th {
        background-color: #374151;
        color: #f9fafb;
    }
    
    .ck-content table tbody tr:nth-child(even) {
        background-color: #2d3748;
    }
    
    .ck-content table tbody tr:hover {
        background-color: #4a5568;
    }
    
    .ck-content code {
        background-color: #374151;
        color: #fbbf24;
    }
    
    .ck-content ul,
    .ck-content ol {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-left-color: #374151;
    }
    
    .ck-content ul li::before {
        color: #60a5fa;
    }
    
    .ck-content ol li::before {
        background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    }
    
    .ck-content ul ul,
    .ck-content ol ol,
    .ck-content ul ol,
    .ck-content ol ul {
        background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
        border-left-color: #475569;
    }
}

/* RTL Support */
[dir="rtl"] .ck-content {
    text-align: right;
}

[dir="rtl"] .ck-content ul,
[dir="rtl"] .ck-content ol {
    padding-left: 0;
    padding-right: 24px;
}

[dir="rtl"] .ck-content blockquote {
    border-left: none;
    border-right: 4px solid #3b82f6;
    border-radius: 8px 0 0 8px;
}

[dir="rtl"] .ck-content img[style*="float: left"] {
    float: right;
    margin: 8px 0 8px 20px;
}

[dir="rtl"] .ck-content img[style*="float: right"] {
    float: left;
    margin: 8px 20px 8px 0;
}

/* Print styles */
@media print {
    .ck-content {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    .ck-content a {
        color: #000;
        text-decoration: underline;
    }
    
    .ck-content a[target="_blank"]:after {
        content: " (" attr(href) ")";
    }
    
    .ck-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    .ck-content h1,
    .ck-content h2,
    .ck-content h3 {
        page-break-after: avoid;
    }
    
    .ck-content blockquote {
        background-color: transparent;
        border: 1px solid #ccc;
    }
}
