/* ============================================
   DevFolio Editor Layout & Styles
   ============================================ */

.editor-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 0;
    height: calc(100vh - var(--topbar-height) - 2 * var(--space-6));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Editor Sidebar with Tabs */
.editor-sidebar {
    display: flex;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    overflow: hidden;
}

.editor-tabs {
    width: 52px;
    min-width: 52px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: var(--space-2);
    gap: 2px;
    overflow-y: auto;
}

.editor-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-1);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: var(--font-medium);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
}

.editor-tab svg {
    margin-bottom: 2px;
}

.editor-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.editor-tab.active {
    background: var(--accent-glow);
    color: var(--accent-secondary);
}

/* Tab Content */
.editor-tab-content {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
    display: none;
}

.editor-tab-content.active {
    display: block;
    animation: fadeIn 0.15s ease;
}

/* Inline repeater items */
.repeater-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: border-color var(--transition-fast);
}

.repeater-item:hover {
    border-color: var(--accent-border);
}

.repeater-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.repeater-item-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.repeater-item-actions {
    display: flex;
    gap: var(--space-1);
}

.repeater-item-actions button {
    padding: 2px var(--space-2);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.repeater-item-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.repeater-item-actions .delete-btn:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* Editor Preview */
.editor-preview {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: var(--space-3);
}

.preview-device-btns {
    display: flex;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 2px;
}

.preview-device-btn {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.preview-device-btn.active {
    background: var(--bg-hover);
    opacity: 1;
}

.preview-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--font-medium);
}

.preview-frame-container {
    flex: 1;
    padding: var(--space-4);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-lg);
    transition: width var(--transition-normal);
}

/* Preview frame sizes for device simulation */
.preview-frame[data-device="tablet"] {
    width: 768px;
    max-width: 100%;
}

.preview-frame[data-device="mobile"] {
    width: 375px;
    max-width: 100%;
}

/* Select override for dark inputs */
.select-sm {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    outline: none;
}

.select-sm:focus {
    border-color: var(--accent-border);
}

/* Full Page Preview */
.full-preview-container {
    height: calc(100vh - var(--topbar-height) - 2 * var(--space-6) - 80px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: white;
}

.full-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Export Grid */
.export-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    max-width: 800px;
}

.export-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: center;
    transition: all var(--transition-fast);
}

.export-card:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-md);
}

.export-card.highlight {
    border-color: var(--accent-border);
    background: linear-gradient(135deg, var(--bg-secondary), var(--accent-glow));
}

.export-card-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
}

.export-card h3 {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.export-card p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Deploy */
.deploy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    max-width: 900px;
}

.deploy-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.deploy-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.deploy-icon {
    font-size: 2.5rem;
}

.deploy-card-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.deploy-free {
    font-size: var(--text-sm);
    color: var(--success);
}

.deploy-status {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.deploy-status.success {
    background: var(--success-bg);
    color: var(--success);
}

.deploy-status.error {
    background: var(--error-bg);
    color: var(--error);
}

.deploy-status.loading {
    background: var(--info-bg);
    color: var(--info);
}

.manual-deploy-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--accent-glow);
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    flex-shrink: 0;
}

/* Responsive editor */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 300px 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .export-grid, .deploy-grid {
        grid-template-columns: 1fr;
    }
}
