/* SmartCV Interactive Resume Builder Stylesheet */

.builder-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 70px);
    background: #f1f5f9;
}

/* Builder Top Toolbar */
.builder-toolbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 70px;
    z-index: 90;
    gap: 1rem;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.resume-title-input {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.65rem;
    background: transparent;
    transition: all var(--transition-fast);
    max-width: 250px;
}

.resume-title-input:hover, .resume-title-input:focus {
    background: #ffffff;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.save-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--status-success);
    background: var(--status-success-bg);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
}

.save-status-badge.saving {
    color: var(--status-warning);
    background: var(--status-warning-bg);
}

/* Workspace Split-Screen */
.builder-workspace {
    display: grid;
    grid-template-columns: 520px 1fr;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 126px);
}

/* Left: Form Editor Panel */
.builder-editor-pane {
    background: #ffffff;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* Section Navigation Tabs */
.editor-tabs-scroll {
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-base);
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    gap: 0.35rem;
    scrollbar-width: thin;
}

.editor-tab-btn {
    background: transparent;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.editor-tab-btn:hover {
    color: var(--text-primary);
    background: #ffffff;
}

.editor-tab-btn.active {
    color: var(--brand-primary);
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.editor-section-container {
    padding: 1.5rem;
    flex: 1;
}

.editor-section {
    display: none;
}

.editor-section.active {
    display: block;
    animation: fadeIn 150ms ease-in-out;
}

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

.section-headline {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-headline h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Repeater Item Accordion Cards */
.repeater-card {
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    transition: border-color var(--transition-fast);
}

.repeater-card:hover {
    border-color: var(--border-strong);
}

.repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.repeater-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.repeater-del-btn {
    background: transparent;
    border: none;
    color: var(--status-danger);
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.repeater-del-btn:hover {
    background: var(--status-danger-bg);
}

/* AI Action Pill Button */
.btn-ai-pill {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    color: var(--brand-primary);
    border: 1px solid #c7d2fe;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-ai-pill:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 100%);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
    transform: translateY(-1px);
}

/* Right: Preview Pane */
.builder-preview-pane {
    background: #475569;
    height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
}

.preview-scale-wrapper {
    transform-origin: top center;
    transition: transform 150ms ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    background: #ffffff;
    border-radius: 2px;
}

/* Floating Zoom Bar */
.preview-controls-bar {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    padding: 0.4rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 50;
    box-shadow: var(--shadow-xl);
}

.zoom-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zoom-level-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    min-width: 45px;
    text-align: center;
}

/* Customizer Panel Drawer / Tab */
.color-picker-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--border-strong);
    transition: transform var(--transition-fast);
}

.color-swatch:hover, .color-swatch.active {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--brand-primary);
}

/* Mobile Switcher */
.mobile-view-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid var(--border-subtle);
    z-index: 150;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.mobile-view-tabs button {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    touch-action: manipulation;
}

.mobile-view-tabs button.active {
    color: var(--brand-primary);
    border-top: 2px solid var(--brand-primary);
    background: #f8fafc;
}

/* Mobile Preview Actions */
.mobile-preview-actions {
    display: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .builder-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    .mobile-view-tabs {
        display: flex;
    }
    .builder-layout {
        padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
    }
    .builder-preview-pane {
        display: none;
        overflow-x: hidden !important;
        width: 100%;
    }
    .builder-workspace.preview-mode .builder-editor-pane {
        display: none;
    }
    .builder-workspace.preview-mode .builder-preview-pane {
        display: flex;
        min-height: calc(100vh - 180px);
        overflow-x: hidden !important;
        width: 100%;
        padding-bottom: 80px;
    }
    .builder-workspace.preview-mode .mobile-preview-actions {
        display: flex;
        position: fixed;
        bottom: calc(68px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        z-index: 120;
        width: min(92vw, 360px);
        pointer-events: auto;
    }
    .mobile-preview-actions .btn-mobile-download {
        width: 100%;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
        font-weight: 700;
        border-radius: var(--radius-full);
        box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    .preview-controls-bar {
        bottom: calc(8.5rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 900px) {
    .builder-toolbar {
        flex-wrap: wrap;
        padding: 0.5rem 0.85rem;
        gap: 0.5rem;
        top: 64px;
    }
    .toolbar-left {
        flex: 1 1 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .toolbar-center {
        flex: 1 1 100%;
        display: flex;
        gap: 0.5rem;
    }
    .toolbar-center select {
        flex: 1 1 auto;
        min-width: 0;
        width: auto !important;
    }
    .toolbar-right {
        flex: 1 1 100%;
        display: flex;
        gap: 0.5rem;
        justify-content: space-between;
    }
    .toolbar-right .btn {
        flex: 1;
        min-height: 42px;
        font-size: 0.85rem;
        padding: 0.45rem 0.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
    }
    .resume-title-input {
        max-width: 100%;
        flex: 1;
    }
}

@media (max-width: 640px) {
    .editor-section-container {
        padding: 1rem;
    }
    .editor-tabs-scroll {
        padding: 0.4rem 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    .editor-tab-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }
    .save-status-badge {
        font-size: 0.7rem;
    }
}
