/**
 * CKEditor 5 Custom Styles
 * Paste.lisansofisi.com.tr için özelleştirilmiş CKEditor stilleri
 */

/* Ana editör container stilleri */
.ck-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

/* Editör içeriği stilleri */
.ck-editor__editable {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* Focus durumu */
.ck-editor__editable:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Toolbar stilleri */
.ck-toolbar {
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px 4px 0 0;
}

.ck-toolbar .ck-toolbar__items {
    flex-wrap: wrap;
}

/* Buton stilleri */
.ck-button {
    margin: 2px;
    border-radius: 3px;
}

.ck-button:hover {
    background: #e9ecef;
}

.ck-button.ck-on {
    background: #007cba;
    color: white;
}

/* Dropdown stilleri */
.ck-dropdown__panel {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: white;
    z-index: 9999;
}

/* Tablo stilleri */
.ck-content table {
    border: 1px solid #ddd;
    border-collapse: collapse;
    margin: 15px 0;
    width: 100%;
}

.ck-content table td,
.ck-content table th {
    border: 1px solid #ddd;
    padding: 8px 12px;
    min-width: 2em;
}

.ck-content table th {
    background: #f8f9fa;
    font-weight: bold;
}

/* Link stilleri */
.ck-content a {
    color: #007cba;
    text-decoration: underline;
}

.ck-content a:hover {
    color: #005a82;
}

/* Resim stilleri */
.ck-content .image {
    margin: 15px 0;
    text-align: center;
}

.ck-content .image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ck-content .image-style-side {
    float: right;
    margin-left: 15px;
    margin-bottom: 15px;
    max-width: 50%;
}

.ck-content .image-style-align-left {
    float: left;
    margin-right: 15px;
    margin-bottom: 15px;
}

.ck-content .image-style-align-right {
    float: right;
    margin-left: 15px;
    margin-bottom: 15px;
}

/* Blockquote stilleri */
.ck-content blockquote {
    border-left: 4px solid #007cba;
    padding-left: 15px;
    margin: 15px 0;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 0 4px 4px 0;
}

/* Liste stilleri */
.ck-content ul,
.ck-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.ck-content li {
    margin: 5px 0;
}

/* Kod bloğu stilleri */
.ck-content pre {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    margin: 15px 0;
}

.ck-content code {
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 2px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

/* Başlık stilleri - Editör içinde */
.ck-editor__editable h1,
.ck-editor__editable h2,
.ck-editor__editable h3,
.ck-editor__editable h4,
.ck-editor__editable h5,
.ck-editor__editable h6 {
    margin: 20px 0 15px 0;
    font-weight: bold;
    color: #1a1a1a !important;
}

/* İçerik görüntüleme için */
.ck-content h1,
.ck-content h2,
.ck-content h3,
.ck-content h4,
.ck-content h5,
.ck-content h6 {
    margin: 20px 0 15px 0;
    font-weight: bold;
    color: #1a1a1a;
}

.ck-editor__editable h1,
.ck-content h1 { font-size: 2em; }

.ck-editor__editable h2,
.ck-content h2 { font-size: 1.5em; }

.ck-editor__editable h3,
.ck-content h3 { font-size: 1.3em; }

.ck-editor__editable h4,
.ck-content h4 { font-size: 1.1em; }

.ck-editor__editable h5,
.ck-content h5 { font-size: 1em; }

.ck-editor__editable h6,
.ck-content h6 { font-size: 0.9em; }

/* Responsive tasarım */
@media (max-width: 768px) {
    .ck-editor__editable {
        min-height: 300px;
        padding: 10px;
    }
    
    .ck-toolbar {
        padding: 5px;
    }
    
    .ck-toolbar .ck-toolbar__items {
        justify-content: center;
    }
    
    .ck-content .image-style-side,
    .ck-content .image-style-align-left,
    .ck-content .image-style-align-right {
        float: none;
        margin: 15px auto;
        display: block;
        max-width: 100%;
    }
}

/* Tooltip stilleri */
.ck-tooltip {
    background: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10000;
}

/* Balloon toolbar stilleri */
.ck-balloon-panel {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background: white;
    z-index: 9999;
}

/* Widget stilleri */
.ck-widget {
    position: relative;
}

.ck-widget.ck-widget_selected {
    outline: 2px solid #007cba;
    outline-offset: 1px;
}

/* Placeholder stilleri */
.ck-editor__editable.ck-placeholder::before {
    color: #999;
    font-style: italic;
}

/* Loading durumu */
.ck-editor.ck-editor_loading {
    opacity: 0.6;
    pointer-events: none;
}

.ck-editor.ck-editor_loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: ck-loading 1s linear infinite;
}

@keyframes ck-loading {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark mode desteği */
@media (prefers-color-scheme: dark) {
    .ck-editor {
        border-color: #555;
    }
    
    .ck-editor__editable {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #555;
    }
    
    .ck-toolbar {
        background: #3d3d3d;
        border-color: #555;
    }
    
    .ck-button:hover {
        background: #4d4d4d;
    }
    
    .ck-content table td,
    .ck-content table th {
        border-color: #555;
    }
    
    .ck-content table th {
        background: #3d3d3d;
    }
    
    .ck-content blockquote {
        background: #3d3d3d;
        border-left-color: #007cba;
        color: #ccc;
    }
    
    .ck-content pre {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .ck-content code {
        background: #3d3d3d;
        color: #e0e0e0;
    }
    
    /* Başlık renkleri dark mode için */
    .ck-content h1,
    .ck-content h2,
    .ck-content h3,
    .ck-content h4,
    .ck-content h5,
    .ck-content h6 {
        color: #e0e0e0;
    }
    
    .ck-content a {
        color: #4da6ff;
    }
    
    .ck-content a:hover {
        color: #66b3ff;
    }
    
    .ck-dropdown__panel,
    .ck-balloon-panel {
        background: #3d3d3d;
        border-color: #555;
    }
    
    .ck-editor__editable.ck-placeholder::before {
        color: #777;
    }
}

/* Manuel dark mode (data-theme="dark") */
[data-theme="dark"] .ck-editor {
    border-color: #555;
}

[data-theme="dark"] .ck-editor__editable {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
}

[data-theme="dark"] .ck-toolbar {
    background: #3d3d3d;
    border-color: #555;
}

[data-theme="dark"] .ck-button:hover {
    background: #4d4d4d;
}

[data-theme="dark"] .ck-content table td,
[data-theme="dark"] .ck-content table th {
    border-color: #555;
}

[data-theme="dark"] .ck-content table th {
    background: #3d3d3d;
}

[data-theme="dark"] .ck-content blockquote {
    background: #3d3d3d;
    border-left-color: #007cba;
    color: #ccc;
}

[data-theme="dark"] .ck-content pre {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

[data-theme="dark"] .ck-content code {
    background: #3d3d3d;
    color: #e0e0e0;
}

/* BAŞLIKLAR - Dark Mode için */
[data-theme="dark"] .ck-content h1,
[data-theme="dark"] .ck-content h2,
[data-theme="dark"] .ck-content h3,
[data-theme="dark"] .ck-content h4,
[data-theme="dark"] .ck-content h5,
[data-theme="dark"] .ck-content h6,
[data-theme="dark"] .ck-editor__editable h1,
[data-theme="dark"] .ck-editor__editable h2,
[data-theme="dark"] .ck-editor__editable h3,
[data-theme="dark"] .ck-editor__editable h4,
[data-theme="dark"] .ck-editor__editable h5,
[data-theme="dark"] .ck-editor__editable h6 {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .ck-content a {
    color: #4da6ff;
}

[data-theme="dark"] .ck-content a:hover {
    color: #66b3ff;
}

[data-theme="dark"] .ck-dropdown__panel,
[data-theme="dark"] .ck-balloon-panel {
    background: #3d3d3d;
    border-color: #555;
}

[data-theme="dark"] .ck-editor__editable.ck-placeholder::before {
    color: #777;
}

/* HTML Görünüm Textarea */
#htmlSourceView {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
}

[data-theme="dark"] #htmlSourceView {
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
    border-color: #555;
}

/* HTML Görünüm Butonu */
#htmlViewBtn {
    transition: all 0.2s ease;
}

#htmlViewBtn:hover {
    background: #4d4d4d !important;
}

#htmlViewBtn.active {
    background: #007cba !important;
    color: white !important;
    border-color: #007cba !important;
}

/* Light mode için buton */
:root:not([data-theme="dark"]) #htmlViewBtn {
    background: #f0f0f0;
    color: #333;
    border-color: #ccc;
}

:root:not([data-theme="dark"]) #htmlViewBtn:hover {
    background: #e0e0e0 !important;
}

/* Light mode için HTML textarea */
:root:not([data-theme="dark"]) #htmlSourceView {
    background: #f8f9fa !important;
    color: #333 !important;
    border-color: #ddd !important;
}