/**
 * Rich Text Editor Styles for RenkliPati Forum
 * CKEditor 5 customization with Turkish UI
 */

/* CKEditor 5 Container */
.ck-editor {
    border-radius: 8px !important;
    border: 1px solid #d1d5db !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.15s ease !important;
}

.ck-editor:focus-within {
    border-color: #9333ea !important;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1) !important;
}

/* Toolbar Styling */
.ck-editor__top .ck-sticky-panel .ck-toolbar {
    border-radius: 8px 8px 0 0 !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: linear-gradient(to bottom, #fafafa, #f4f4f5) !important;
    padding: 8px 12px !important;
}

.ck-editor__top .ck-sticky-panel .ck-toolbar .ck-toolbar__items {
    gap: 2px !important;
}

/* Toolbar Buttons */
.ck-button {
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
    color: #374151 !important;
}

.ck-button:hover {
    background: #e5e7eb !important;
    border-color: #d1d5db !important;
}

.ck-button.ck-on {
    background: #9333ea !important;
    border-color: #9333ea !important;
    color: white !important;
}

.ck-button.ck-on:hover {
    background: #7c3aed !important;
    border-color: #7c3aed !important;
}

/* Toolbar Separators */
.ck-toolbar__separator {
    background: #d1d5db !important;
    margin: 0 4px !important;
}

/* Editor Content Area */
.ck-editor__editable {
    border-radius: 0 0 8px 8px !important;
    min-height: 150px !important;
    padding: 16px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: #374151 !important;
}

.ck-editor__editable:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Content Styling */
.ck-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
}

.ck-content h1 {
    font-size: 1.875rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 1.5em 0 0.75em 0 !important;
    line-height: 1.2 !important;
}

.ck-content h2 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 1.25em 0 0.625em 0 !important;
    line-height: 1.3 !important;
}

.ck-content h3 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 1em 0 0.5em 0 !important;
    line-height: 1.4 !important;
}

.ck-content p {
    margin: 0.75em 0 !important;
    line-height: 1.6 !important;
}

.ck-content blockquote {
    border-left: 4px solid #9333ea !important;
    padding-left: 1rem !important;
    margin: 1.5em 0 !important;
    font-style: italic !important;
    color: #6b7280 !important;
    background: #f9fafb !important;
    padding: 1rem 1rem 1rem 1.5rem !important;
    border-radius: 0 8px 8px 0 !important;
}

.ck-content code {
    background: #f3f4f6 !important;
    color: #e11d48 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace !important;
    font-size: 0.875em !important;
}

.ck-content pre {
    background: #1f2937 !important;
    color: #f9fafb !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    overflow-x: auto !important;
    margin: 1.5em 0 !important;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
}

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

/* Lists */
.ck-content ul,
.ck-content ol {
    padding-left: 1.5rem !important;
    margin: 1em 0 !important;
}

.ck-content li {
    margin: 0.25em 0 !important;
}

/* Links */
.ck-content a {
    color: #9333ea !important;
    text-decoration: underline !important;
    transition: color 0.15s ease !important;
}

.ck-content a:hover {
    color: #7c3aed !important;
}

/* Images */
.ck-content .image {
    margin: 1.5em 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.ck-content .image img {
    border-radius: 8px !important;
    max-width: 100% !important;
    height: auto !important;
}

.ck-content .image-style-side {
    float: right !important;
    margin-left: 1.5em !important;
    max-width: 50% !important;
}

.ck-content .image > figcaption {
    background: #f9fafb !important;
    padding: 0.75rem !important;
    font-size: 0.875rem !important;
    color: #6b7280 !important;
    text-align: center !important;
    border-radius: 0 0 8px 8px !important;
}

/* Media Embeds */
.ck-content .media {
    margin: 1.5em 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

/* Mentions in Editor Content */
.ck-content .mention {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 0.875em !important;
    display: inline-block !important;
    transition: all 0.15s ease !important;
}

.ck-content .mention:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 4px rgba(147, 51, 234, 0.2) !important;
}

/* Mention Dropdown in Editor */
.ck-mention-list {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
    max-height: 200px !important;
}

.ck-mention-list-item {
    padding: 8px 12px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
}

.ck-mention-list-item:hover,
.ck-mention-list-item.ck-highlight {
    background: #f3f4f6 !important;
}

.ck-mention-list-item.ck-highlight {
    background: #ede9fe !important;
    border-left: 3px solid #9333ea !important;
}

/* Dropdown Panels */
.ck-dropdown__panel {
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Color Palette */
.ck-color-ui-dropdown .ck-color-grid {
    padding: 8px !important;
}

.ck-color-ui-dropdown .ck-color-grid__tile {
    border-radius: 4px !important;
    border: 1px solid #e5e7eb !important;
    transition: all 0.15s ease !important;
}

.ck-color-ui-dropdown .ck-color-grid__tile:hover {
    transform: scale(1.1) !important;
    border-color: #9333ea !important;
}

/* Font Size Dropdown */
.ck-font-size-dropdown .ck-list__item {
    padding: 6px 12px !important;
    border-radius: 4px !important;
    margin: 2px !important;
    transition: background-color 0.15s ease !important;
}

.ck-font-size-dropdown .ck-list__item:hover {
    background: #f3f4f6 !important;
}

/* Special Characters */
.ck-special-characters-grid {
    padding: 8px !important;
}

.ck-special-characters-grid .ck-button {
    border-radius: 4px !important;
    transition: all 0.15s ease !important;
}

.ck-special-characters-grid .ck-button:hover {
    background: #ede9fe !important;
    border-color: #9333ea !important;
}

/* Word Count Display */
.word-count {
    font-size: 0.875rem !important;
    color: #6b7280 !important;
    text-align: right !important;
    margin-top: 0.5rem !important;
    font-family: 'Inter', sans-serif !important;
}

/* Editor Container */
.editor-container {
    position: relative;
}

.editor-container .loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.editor-container .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #9333ea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ck-editor__top .ck-sticky-panel .ck-toolbar {
        flex-wrap: wrap !important;
        padding: 6px 8px !important;
    }
    
    .ck-editor__editable {
        min-height: 120px !important;
        padding: 12px !important;
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    .ck-button {
        padding: 4px 6px !important;
    }
    
    .ck-dropdown__panel {
        max-width: calc(100vw - 40px) !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ck-editor {
        border-color: #374151 !important;
        background: #1f2937 !important;
    }
    
    .ck-editor__top .ck-sticky-panel .ck-toolbar {
        background: linear-gradient(to bottom, #374151, #1f2937) !important;
        border-bottom-color: #4b5563 !important;
    }
    
    .ck-button {
        color: #e5e7eb !important;
    }
    
    .ck-button:hover {
        background: #4b5563 !important;
        border-color: #6b7280 !important;
    }
    
    .ck-editor__editable {
        background: #1f2937 !important;
        color: #e5e7eb !important;
    }
    
    .ck-content h1,
    .ck-content h2,
    .ck-content h3 {
        color: #f9fafb !important;
    }
    
    .ck-content blockquote {
        background: #374151 !important;
        color: #d1d5db !important;
        border-left-color: #9333ea !important;
    }
    
    .ck-content code {
        background: #374151 !important;
        color: #fbbf24 !important;
    }
}

/* Animation Keyframes */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ck-editor {
        border-width: 2px !important;
    }
    
    .ck-button {
        border-width: 2px !important;
    }
    
    .ck-content .mention {
        border: 2px solid #9333ea !important;
    }
}
