/* Create Post Page Styles */

/* Page layout */
.page-header {
    margin-bottom: var(--space-6);
}

.page-header h1 {
    margin-bottom: var(--space-2);
}

.page-header p {
    color: var(--text-medium);
}

/* Form sections */
.form-section {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.form-section h2 {
    display: flex;
    align-items: center;
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: var(--space-3);
}

.form-section h2 i {
    margin-right: var(--space-2);
    color: var(--primary-color);
}

.required {
    color: var(--error);
}

/* Settings grid layout */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.full-width {
    grid-column: 1 / -1;
}

/* Form controls */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--text-base);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.help-text {
    font-size: var(--text-sm);
    color: var(--text-medium);
    margin-top: var(--space-1);
}

/* Visibility info */
.visibility-info {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
}

.visibility-info p {
    padding: var(--space-2) var(--space-3);
    background-color: var(--bg-light);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
}

.visibility-info i {
    color: var(--primary-color);
}

/* Image upload */
.image-upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: flex-start;
}

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

.image-preview.has-preview {
    border: none;
    background-size: cover;
    background-position: center;
    color: transparent;
}

.image-preview i {
    font-size: 32px;
    margin-bottom: var(--space-2);
}

.image-upload-controls {
    flex: 1;
    min-width: 250px;
}

.file-input-wrapper {
    margin-bottom: var(--space-4);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.image-info {
    font-size: var(--text-sm);
    color: var(--text-medium);
}

.image-info p {
    margin-bottom: var(--space-1);
}

/* Content editor */
.content-editor-wrapper {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    overflow: hidden;
}

#editor-container {
    min-height: 300px;
    font-family: 'Poppins', sans-serif;
    font-size: var(--text-base);
}

/* Custom Quill styling */
.ql-toolbar.ql-snow {
    border-color: var(--border-medium);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    background-color: var(--bg-light);
}

.ql-container.ql-snow {
    border-color: var(--border-medium);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    font-family: 'Poppins', sans-serif;
}

/* Editor validation message */
.editor-validation-message {
    display: none;
    color: var(--error);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

/* Remove underlines from form buttons and actions */
.form-actions a,
.modal-footer a,
.login-buttons a {
    text-decoration: none;
}

/* Login required message */
.login-required {
    text-align: center;
    padding: var(--space-8);
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.login-required i {
    font-size: 48px;
    color: var(--text-light);
    margin-bottom: var(--space-4);
}

.login-required h2 {
    margin-bottom: var(--space-3);
}

.login-required p {
    max-width: 500px;
    margin: 0 auto var(--space-6) auto;
    color: var(--text-medium);
}

.login-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

/* Loading indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-4);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s;
}

.modal-content.large-modal {
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
}

.large-modal .modal-body {
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-medium);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-dark);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Preview styles for post buttons */
.ql-editor .post-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    margin: 4px 0;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

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

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

.ql-editor .btn-success {
    background-color: #10B981;
    color: white;
}

.ql-editor .btn-danger {
    background-color: #EF4444;
    color: white;
}

.ql-editor .btn-info {
    background-color: #3B82F6;
    color: white;
}

/* Editor Mode Selector */
.editor-mode-selector {
    margin-bottom: var(--space-4);
}

.toggle-switch-container {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.toggle-switch-container label {
    font-weight: 500;
    color: var(--text-dark);
}

.mode-options {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.mode-option {
    font-size: var(--text-sm);
    color: var(--text-medium);
    transition: color 0.2s ease;
}

.mode-option.active {
    color: var(--primary-color);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-medium);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Code Editor Styles */
.code-editor-tabs {
    display: flex;
    background-color: var(--bg-light);
    border: 1px solid var(--border-medium);
    border-bottom: none;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    overflow: hidden;
}

.code-tab {
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-weight: 500;
    cursor: pointer;
    border-right: 1px solid var(--border-medium);
    transition: background-color 0.2s ease;
}

.code-tab:last-child {
    border-right: none;
}

.code-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.code-editor {
    display: none;
    height: 300px;
    border: 1px solid var(--border-medium);
    border-top: none;
}

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

/* CodeMirror Customizations */
.CodeMirror {
    height: 300px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Preview Section */
.code-editor-preview {
    margin-top: var(--space-4);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    overflow: hidden;
}

.code-editor-preview h3 {
    padding: var(--space-3) var(--space-4);
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-medium);
    margin: 0;
    font-size: var(--text-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-preview {
    height: 300px;
    overflow: hidden;
    background-color: white;
}

#code-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

#preview-code-btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}

/* Fix for mobile views */
@media (max-width: 768px) {
    .toggle-switch-container {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
    
    .code-editor-tabs {
        flex-wrap: wrap;
    }
    
    .code-tab {
        flex: 1;
        text-align: center;
        padding: var(--space-2);
        font-size: var(--text-sm);
    }
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .image-upload-container {
        flex-direction: column;
    }
    
    .image-preview {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .login-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: var(--space-4);
    }
}
