/**
 * TutoScore Admin - Blog Editor Styles
 */

/* Top bar adjustments */
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.back-link:hover {
    background: var(--bg-body);
    color: var(--primary);
}

/* Publish toggle switch */
.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.switch-label input {
    display: none;
}

.switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    transition: background 0.2s;
}

.switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch-label input:checked + .switch-slider {
    background: var(--success);
}

.switch-label input:checked + .switch-slider::after {
    transform: translateX(20px);
}

.switch-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.switch-label input:checked ~ .switch-text {
    color: var(--success);
    font-weight: 500;
}

/* Editor container */
.editor-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Hero Image Upload Section */
.hero-upload-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-body);
    transition: background 0.2s;
}

.hero-upload-section.drag-over {
    background: rgba(34, 113, 177, 0.05);
    border-color: var(--primary);
}

.hero-preview {
    width: 100%;
    aspect-ratio: 2000 / 642;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.hero-placeholder svg {
    opacity: 0.5;
}

.hero-placeholder span {
    font-size: 14px;
    font-weight: 500;
}

.hero-placeholder small {
    font-size: 12px;
    opacity: 0.7;
}

.hero-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn-upload {
    cursor: pointer;
}

.btn-upload input {
    display: none;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Upload Progress */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Slug field */
.slug-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-body);
}

.slug-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.slug-prefix {
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    padding: 0;
}

.slug-field input {
    flex: 1;
    max-width: 300px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: monospace;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.slug-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.slug-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Language tabs container */
.lang-tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-body);
    padding-right: 16px;
}

.lang-tabs {
    display: flex;
}

.lang-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.lang-tab:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.02);
}

.lang-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-card);
}

.lang-flag {
    font-size: 16px;
}

.required-badge {
    color: var(--danger);
    font-weight: 600;
}

/* Translate button */
.btn-translate {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    background: rgba(34, 113, 177, 0.1);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-translate:hover {
    background: var(--primary);
    color: white;
}

.btn-translate:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-translate svg {
    flex-shrink: 0;
}

.btn-translate svg.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.editor-panel {
    display: none;
    padding: 24px;
}

.editor-panel.active {
    display: block;
}

/* Form groups */
.editor-panel .form-group {
    margin-bottom: 20px;
}

.editor-panel .form-group:last-child {
    margin-bottom: 0;
}

.editor-panel label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.editor-panel label small {
    font-weight: 400;
    color: var(--text-muted);
}

.editor-panel input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.editor-panel input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.editor-panel textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.6;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: vertical;
    transition: border-color 0.15s;
}

.editor-panel textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

#content_fr, #content_en, #content_es {
    min-height: 400px;
}

/* Editor toolbar */
.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar + textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.editor-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.editor-toolbar button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Preview Modal */
.modal-preview {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-preview .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.preview-lang-tabs {
    display: flex;
    gap: 4px;
}

.preview-lang-tab {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.preview-lang-tab:hover {
    border-color: var(--primary);
}

.preview-lang-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.preview-content {
    padding: 32px;
    max-width: 700px;
    margin: 0 auto;
}

/* Preview article styles */
.preview-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.2;
}

.preview-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 32px 0 16px;
}

.preview-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.preview-content p {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.preview-content ul, .preview-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.preview-content li {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 8px;
}

.preview-content code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 3px;
}

.preview-content pre {
    background: var(--sidebar-bg);
    color: #e0e0e0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}

.preview-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.preview-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.preview-content a {
    color: var(--primary);
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.preview-empty {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* Blog list page extras */
.post-title-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.post-title-link:hover {
    text-decoration: underline;
}

.slug-code {
    font-size: 12px;
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-secondary);
}

.lang-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(34, 113, 177, 0.1);
    color: var(--primary);
    border-radius: 3px;
}

.lang-badge.empty {
    background: var(--bg-body);
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .slug-field {
        flex-wrap: wrap;
    }

    .slug-field input {
        max-width: 100%;
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .slug-hint {
        order: 4;
        width: 100%;
    }

    .lang-tabs {
        overflow-x: auto;
    }

    .lang-tab {
        padding: 12px 16px;
        white-space: nowrap;
    }

    .top-bar-actions {
        flex-wrap: wrap;
    }
}
