/* SFT Editor Styles */

.sft-editor-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.sft-editor-wrapper:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sft-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
}

.sft-toolbar-btn {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sft-toolbar-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.sft-toolbar-btn:active {
    transform: translateY(0);
    background: #e5e7eb;
}

.sft-toolbar-separator {
    width: 1px;
    height: 36px;
    background: #e0e0e0;
    margin: 0 4px;
}

.sft-toolbar-select {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 36px;
}

.sft-toolbar-select:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.sft-toolbar-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sft-color-picker-wrapper {
    display: inline-block;
}

.sft-color-picker {
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sft-color-picker:hover {
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.sft-toolbar-wordcount {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.sft-editor-content {
    padding: 20px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.6;
    color: #1f2937;
    outline: none;
}

.sft-editor-content:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}

.sft-editor-content:focus {
    outline: none;
}

.sft-editor-content h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 0.67em 0;
    color: #111827;
}

.sft-editor-content h2 {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0.75em 0;
    color: #111827;
}

.sft-editor-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0.83em 0;
    color: #111827;
}

.sft-editor-content h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 1em 0;
    color: #111827;
}

.sft-editor-content h5 {
    font-size: 1em;
    font-weight: 600;
    margin: 1.17em 0;
    color: #111827;
}

.sft-editor-content h6 {
    font-size: 0.9em;
    font-weight: 600;
    margin: 1.33em 0;
    color: #111827;
}

.sft-editor-content p {
    margin: 1em 0;
}

.sft-editor-content ul,
.sft-editor-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.sft-editor-content li {
    margin: 0.5em 0;
}

.sft-editor-content a {
    color: #4f46e5;
    text-decoration: underline;
}

.sft-editor-content a:hover {
    color: #4338ca;
}

.sft-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1em 0;
}

.sft-editor-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.sft-editor-content table td,
.sft-editor-content table th {
    border: 1px solid #e0e0e0;
    padding: 8px;
}

.sft-editor-content table th {
    background: #f9fafb;
    font-weight: 600;
}

.sft-editor-content blockquote {
    border-left: 4px solid #4f46e5;
    padding-left: 1em;
    margin: 1em 0;
    color: #6b7280;
    font-style: italic;
}

.sft-editor-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.sft-editor-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
}

.sft-editor-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.sft-editor-statusbar {
    padding: 8px 16px;
    background: #f9fafb;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #6b7280;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sft-editor-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    animation: fadeIn 0.3s ease;
}

.sft-editor-fullscreen .sft-editor-content {
    max-height: calc(100vh - 120px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.sft-editor-wrapper[data-theme="dark"] {
    background: #1f2937;
    border-color: #374151;
}

.sft-editor-wrapper[data-theme="dark"] .sft-editor-toolbar {
    background: #111827;
    border-color: #374151;
}

.sft-editor-wrapper[data-theme="dark"] .sft-toolbar-btn {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.sft-editor-wrapper[data-theme="dark"] .sft-toolbar-btn:hover {
    background: #374151;
}

.sft-editor-wrapper[data-theme="dark"] .sft-editor-content {
    background: #1f2937;
    color: #f9fafb;
}

.sft-editor-wrapper[data-theme="dark"] .sft-editor-statusbar {
    background: #111827;
    border-color: #374151;
    color: #9ca3af;
}

@media (max-width: 768px) {
    .sft-editor-toolbar {
        padding: 8px;
        gap: 2px;
    }
    
    .sft-toolbar-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 32px;
        height: 32px;
    }
    
    .sft-toolbar-select {
        padding: 6px 10px;
        font-size: 12px;
        height: 32px;
    }
    
    .sft-editor-content {
        padding: 16px;
        font-size: 14px;
    }
}

.sft-editor-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.sft-editor-loading:after {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
#sft-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.sft-toast {
    background: #2196f3;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
    animation: slideInRight 0.3s ease;
}

.sft-toast.success {
    background: #4caf50;
}

.sft-toast.error {
    background: #f44336;
}

.sft-toast:hover {
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error overlay */
#sft-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(244, 67, 54, 0.1);
    border: 2px solid #f44336;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
