/* editor.css */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header */
.main-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-white);
    border-color: var(--secondary-color);
}

/* Editor Container */
.editor-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem 2rem;
}

.editor-wrapper {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 2rem;
}

/* Form Elements */
.article-info-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

.char-count {
    display: block;
    text-align: right;
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Featured Image Upload */
.featured-image-upload {
    display: flex;
    gap: 1rem;
    align-items: start;
}

.image-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-gray);
    background: var(--bg-light);
    position: relative;
    overflow: hidden;
}

.image-preview i {
    font-size: 3rem;
}

.image-preview p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Rich Text Editor */
.editor-section {
    margin-bottom: 2rem;
}

.editor-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

#editor {
    height: 500px;
    background: var(--bg-white);
}

.ql-toolbar {
    border: 1px solid var(--border-color) !important;
    border-radius: 6px 6px 0 0 !important;
    background: var(--bg-light) !important;
}

.ql-container {
    border: 1px solid var(--border-color) !important;
    border-top: none !important;
    border-radius: 0 0 6px 6px !important;
    font-size: 1rem !important;
    font-family: inherit !important;
}

.ql-editor {
    min-height: 500px;
    padding: 1.5rem !important;
}

.ql-editor h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.ql-editor h2 {
    font-size: 1.5rem;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.ql-editor h3 {
    font-size: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.ql-editor p {
    margin-bottom: 1rem;
}

.ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 6px;
}

.ql-editor iframe {
    max-width: 100%;
    height: 400px;
    display: block;
    margin: 1rem auto;
    border-radius: 6px;
}

/* Author Info */
.author-info-section {
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.author-info-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.author-info-section p {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.author-info-section small {
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 1rem;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay p {
    color: white;
    font-size: 1.1rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        flex-direction: column;
    }

    .editor-container {
        padding: 1rem;
    }

    .editor-wrapper {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .featured-image-upload {
        flex-direction: column;
    }

    .image-preview {
        width: 100%;
    }

    #editor {
        height: 400px;
    }

    .ql-editor {
        min-height: 400px;
    }
}
