/* ========================================
   Editor View Styles
   ======================================== */

/* Editor Container - Split Pane Layout */
.editor-container {
    display: flex;
    min-height: 100vh;
}

/* Editor Panels */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Left Panel: Form */
.editor-form {
    background: var(--bg-primary);
    border-right: 1px solid var(--bg-tertiary);
    overflow-y: auto;
    max-height: 100vh;
}

/* Editor Header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.editor-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Release Form */
.release-form {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Form Sections */
.form-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.form-section h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.form-section > p.form-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

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

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

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Character Count */
.char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Image Preview */
.image-preview {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.image-preview.hidden {
    display: none;
}

.image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

.image-preview .image-status {
    font-size: 0.75rem;
    color: var(--accent-success);
}

.image-preview .image-status.error {
    color: var(--accent-danger);
}

/* Right Panel: Preview */
.editor-preview {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

/* Preview Header */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--bg-elevated);
}

.preview-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Preview Toggle */
.preview-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 2px;
}

.toggle-btn {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn.active {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.toggle-btn:not(.active):hover {
    color: var(--text-secondary);
}

/* Preview Container */
.editor-preview .iphone-container {
    height: calc(100vh - 57px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    overflow: auto;
}

/* Article Preview Mode */
.article-preview-mode .iphone-screen {
    background: var(--bg-primary);
}

.article-preview-mode .iphone-wallpaper {
    display: none;
}

.article-preview-mode .home-screen {
    display: none;
}

.article-preview-content {
    position: absolute;
    inset: 50px 0 0 0;
    overflow-y: auto;
    padding: var(--space-md);
}

/* Mobile: Stack Layout */
@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
    }
    
    .editor-form {
        border-right: none;
        border-bottom: 1px solid var(--bg-tertiary);
        max-height: none;
        order: 1;
    }
    
    .editor-preview {
        position: relative;
        height: auto;
        min-height: 500px;
        order: 2;
    }
    
    .editor-preview .iphone-container {
        height: 500px;
    }
}

/* Mobile: Compact Form */
@media (max-width: 768px) {
    .editor-header {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
    }
    
    .editor-actions {
        width: 100%;
    }
    
    .editor-actions .btn {
        flex: 1;
    }
    
    .release-form {
        padding: var(--space-md);
    }
    
    .form-section {
        padding: var(--space-md);
    }
    
    /* Hide preview on small screens during editing */
    .editor-preview {
        display: none;
    }
    
    .editor-preview.mobile-visible {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 100;
        background: var(--bg-secondary);
    }
}

/* Preview Floating Button (Mobile) */
.preview-fab {
    display: none;
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 50;
    align-items: center;
    justify-content: center;
}

.preview-fab svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

@media (max-width: 768px) {
    .preview-fab {
        display: flex;
    }
}

/* Auto-save Indicator */
.autosave-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.autosave-indicator.saving {
    color: var(--accent-warning);
}

.autosave-indicator.saved {
    color: var(--accent-success);
}

.autosave-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Inline Copy Button */
.btn-inline-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--accent-primary);
    background: transparent;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: var(--space-sm);
    transition: all var(--transition-fast);
    vertical-align: middle;
}

.btn-inline-copy:hover {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.btn-inline-copy:active {
    transform: scale(0.95);
}

/* Form Validation States */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: var(--accent-danger);
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: var(--accent-success);
}

/* Focus within form group */
.form-group:focus-within label {
    color: var(--accent-primary);
}

/* Textarea with better UX */
textarea#article-body {
    min-height: 200px;
    line-height: 1.6;
    font-size: 0.9375rem;
}

/* Drag handle for resize */
textarea {
    resize: vertical;
}

/* Markdown hint styling */
.markdown-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
}

.markdown-hint code {
    background: var(--bg-elevated);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

/* ========================================
   AI Generation Buttons & Modal
   ======================================== */

/* AI Button in Labels */
.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--news-accent);
    background: transparent;
    border: 1px solid var(--news-accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: var(--space-sm);
    transition: all var(--transition-fast);
    vertical-align: middle;
}

.btn-ai:hover {
    background: var(--news-accent);
    color: var(--text-primary);
}

.btn-ai:active {
    transform: scale(0.95);
}

.btn-ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ai:disabled:hover {
    background: transparent;
    color: var(--news-accent);
}

/* Multiple AI buttons container */
.ai-buttons {
    display: inline-flex;
    gap: 4px;
}

/* AI Modal Styles */
.ai-modal-content {
    max-width: 600px;
}

/* AI Prompt Section */
.ai-prompt-section {
    margin-bottom: var(--space-md);
}

.ai-prompt-section label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.ai-prompt-section textarea {
    width: 100%;
    margin-bottom: var(--space-sm);
    font-size: 0.9375rem;
}

.ai-prompt-section .btn {
    width: 100%;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    color: var(--text-tertiary);
}

.ai-loading .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* AI Results */
.ai-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.ai-suggestion {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-suggestion:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
}

.ai-suggestion.selected {
    border-color: var(--accent-primary);
    background: rgba(10, 132, 255, 0.1);
}

.ai-suggestion-text {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.ai-suggestion-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* AI Error */
.ai-error {
    padding: var(--space-md);
    background: rgba(255, 69, 58, 0.1);
    border-radius: var(--radius-md);
    color: var(--accent-danger);
    text-align: center;
}

/* AI Configure Prompt */
.ai-configure-prompt {
    text-align: center;
    padding: var(--space-lg);
}

.ai-configure-prompt p {
    margin-bottom: var(--space-md);
    color: var(--text-tertiary);
}

