/* Generate Page Styles */

/* Page Layout */
.generate-page {
    min-height: calc(100vh - 56px);
    background: var(--bg-primary);
}

.generate-page.page-container {
    max-width: 100%;
    padding: 0;
}

.generate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.generate-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.generate-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Split Panel Layout */
.generate-layout {
    display: flex;
    min-height: calc(100vh - 125px);
}

.generation-panel {
    flex-shrink: 0;
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 125px);
    position: sticky;
    top: 69px;
    background: var(--bg-primary);
}

.generate-splitter {
    width: 6px;
    flex-shrink: 0;
    background: var(--border-color);
    cursor: col-resize;
    position: relative;
}

.generate-splitter:hover,
.generate-splitter.active {
    background: var(--accent-primary);
}

.generate-splitter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background: var(--text-tertiary);
    border-radius: 1px;
    opacity: 0;
}

.generate-splitter:hover::before,
.generate-splitter.active::before {
    opacity: 1;
    background: #fff;
}

body.resizing-panels {
    cursor: col-resize;
    user-select: none;
}

body.resizing-panels * {
    cursor: col-resize !important;
}

.results-panel {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-width: 0;
}

/* Workflow Dropdown Selector */
.workflow-selector {
    position: relative;
    min-width: 300px;
    max-width: 400px;
}

.workflow-selector-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    width: 100%;
    font-size: 14px;
}

.workflow-selector-trigger:hover {
    border-color: var(--accent-primary);
}

.workflow-selector-trigger .material-icons-outlined:first-child {
    color: var(--accent-primary);
}

.workflow-selector-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-selector-placeholder {
    color: var(--text-secondary);
}

.workflow-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 450px;
    overflow: hidden;
    display: none;
    z-index: 1000;
}

.workflow-dropdown.show {
    display: flex;
    flex-direction: column;
}

.workflow-search {
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.workflow-search::placeholder {
    color: var(--text-tertiary);
}

.workflow-categories {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
}

.workflow-category-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.workflow-category-btn:hover {
    background: var(--bg-primary);
}

.workflow-category-btn.active {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.workflow-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.workflow-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.workflow-list-item:last-child {
    border-bottom: none;
}

.workflow-list-item:hover {
    background: var(--bg-tertiary);
}

.workflow-list-item.selected {
    background: var(--accent-light);
}

.workflow-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.workflow-list-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workflow-list-icon .material-icons-outlined {
    color: var(--text-tertiary);
    font-size: 20px;
}

.workflow-list-info {
    flex: 1;
    min-width: 0;
}

.workflow-list-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-list-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.workflow-empty-dropdown {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary);
}

/* Queue Status Badge */
.queue-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.queue-status .material-icons-outlined {
    font-size: 18px;
}

.queue-count {
    font-weight: 600;
    color: var(--accent-primary);
}

/* Workflow Header in Form */
.workflow-form-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.workflow-form-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.workflow-form-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* Prompt Section */
.prompt-section {
    margin-bottom: 24px;
}

.prompt-field {
    position: relative;
}

.prompt-textarea {
    width: 100%;
    min-height: 150px;
    padding: 14px;
    padding-right: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    line-height: 1.5;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.prompt-textarea::placeholder {
    color: var(--text-tertiary);
}

.prompt-textarea.negative {
    min-height: 80px;
    padding-right: 14px;
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.prompt-textarea.negative:focus {
    border-color: #ef4444;
}

/* Negative Prompt Section */
.negative-prompt-section {
    margin-top: 12px;
}

.negative-prompt-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    width: 100%;
}

.negative-prompt-toggle:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.negative-prompt-toggle.active {
    border-style: solid;
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.negative-prompt-toggle .toggle-icon {
    font-size: 16px;
    font-weight: 600;
    width: 16px;
    text-align: center;
}

.negative-prompt-content {
    display: none;
    margin-top: 8px;
}

.negative-prompt-content.open {
    display: block;
}

/* Prompt Header with title and buttons */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.prompt-header .form-section-title {
    margin-bottom: 0;
    line-height: 28px;
}

.prompt-header-buttons {
    display: flex;
    gap: 8px;
}

.prompt-builder-btn,
.prompt-history-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.prompt-builder-btn:hover,
.prompt-history-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.prompt-builder-btn .material-icons-outlined,
.prompt-history-btn .material-icons-outlined {
    font-size: 16px;
}

/* Prompt History Dropdown */
.prompt-history-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
}

.prompt-history-dropdown.show {
    display: block;
}

.prompt-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.prompt-history-clear {
    font-size: 11px;
    color: var(--text-tertiary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.prompt-history-clear:hover {
    color: var(--color-error);
}

.prompt-history-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-history-item:last-child {
    border-bottom: none;
}

.prompt-history-item:hover {
    background: var(--bg-tertiary);
}

.prompt-history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Quick Settings */
.quick-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.setting-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Compact Dimensions & Quantity */
.compact-dimensions,
.compact-quantity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.compact-dimensions {
    margin-right: 12px;
}

.dim-label,
.qty-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dim-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    padding: 3px 6px;
    cursor: pointer;
    min-width: 58px;
}

.dim-select:hover {
    border-color: var(--accent-primary);
}

.dim-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.dim-x {
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 0 2px;
}

.qty-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    line-height: 1;
}

.qty-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.qty-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 16px;
    text-align: center;
}

/* Size Presets (legacy) */
.size-preset-group {
    display: flex;
    gap: 8px;
}

.size-preset-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
}

.size-preset-btn:hover {
    background: var(--bg-secondary);
}

.size-preset-btn.active {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.size-preset-icon {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.size-preset-btn[data-ratio="portrait"] .size-preset-icon {
    width: 14px;
    height: 20px;
}

.size-preset-btn[data-ratio="landscape"] .size-preset-icon {
    width: 20px;
    height: 14px;
}


/* Main Fields (no uiGroup) */
.main-fields {
    margin-bottom: 16px;
}

/* Field Groups (uiGroup collapsible sections) */
.field-group {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.field-group-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: var(--bg-secondary);
    width: 100%;
    text-align: left;
}

.field-group-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.field-group-toggle .material-icons-outlined {
    font-size: 20px;
}

.field-group-content {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.field-group.open .field-group-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Form Fields (reusing existing patterns) */
.generate-form-field {
    margin-bottom: 16px;
}

.generate-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.generate-form-field .input-field {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.generate-form-field .input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.generate-form-field small {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Links in form fields and descriptions */
.generate-form-field a,
.generate-panel a,
.field-group-content a {
    color: #60a5fa;
    text-decoration: none;
}

.generate-form-field a:hover,
.generate-panel a:hover,
.field-group-content a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Seed Field */
.seed-field {
    display: flex;
    gap: 8px;
}

.seed-field .input-field {
    flex: 1;
}

.seed-field .input-field.seed-locked {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.seed-field .input-field.seed-random {
    color: var(--text-tertiary);
    font-style: italic;
}

.seed-field .input-field.seed-random::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.seed-lock-btn,
.seed-randomize-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

.seed-lock-btn:hover,
.seed-randomize-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.seed-lock-btn.locked {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Slider Field */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
}

.slider-container .slider-value {
    width: 60px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    text-align: center;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.generate-btn:hover {
    background: var(--accent-hover);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.generate-btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Results Panel Sections */
.results-section {
    margin-bottom: 32px;
}

.results-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-section-title .material-icons-outlined {
    font-size: 20px;
    color: var(--text-tertiary);
}

.results-limit-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.results-limit-selector label {
    color: var(--text-tertiary);
}

.results-limit-selector select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.results-limit-selector select:hover {
    border-color: var(--border-hover);
}

.results-limit-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Active Jobs Section */
.active-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job-card-compact {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.job-card-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.job-card-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

.job-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.job-card-status.queued {
    color: #f59e0b;
}

.job-card-status.running {
    color: #3b82f6;
}

.job-card-status.complete {
    color: #10b981;
}

.job-card-status.error {
    color: #ef4444;
}

.job-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.job-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.job-progress-text {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
    text-align: right;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.result-card {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
}

.result-card img,
.result-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video Result Card */
.result-card-video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    color: white;
    font-size: 16px;
}

.result-card-video-badge .material-icons-outlined {
    font-size: 16px;
}

.result-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
}

.result-card:hover .result-card-overlay {
    opacity: 1;
}

.result-card-action {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
}

.result-card-action:hover {
    background: var(--accent-primary);
}

/* Empty States */
.generate-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.generate-empty-state .material-icons-outlined {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.generate-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.generate-empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

.results-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.results-empty-state .material-icons-outlined {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.results-empty-state h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.results-empty-state p {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* No Workflow Selected State */
.no-workflow-state {
    padding: 40px 20px;
    text-align: center;
}

.no-workflow-state .material-icons-outlined {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.no-workflow-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Mobile Generate Bar */
.mobile-generate-bar {
    display: none;
    position: fixed;
    bottom: 50px; /* Above the mobile bottom nav */
    left: 0;
    right: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 1050; /* Below mobile-bottom-nav (1100) but above content */
}

.mobile-generate-bar .generate-btn {
    margin: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .generation-panel {
        width: 340px;
    }

    .workflow-selector {
        min-width: 260px;
    }
}

@media (max-width: 768px) {
    .generate-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }

    .generate-header-left {
        width: 100%;
    }

    .generate-header-right {
        display: none;
    }

    .workflow-selector {
        min-width: 100%;
        max-width: 100%;
    }

    .generate-layout {
        flex-direction: column;
        min-height: auto;
    }

    .generation-panel {
        width: 100% !important; /* Override inline JS width from splitter */
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        top: 0;
        max-height: none;
        padding: 16px;
        padding-bottom: 130px; /* Space for mobile-generate-bar (60px) + bottom-nav (50px) + extra */
    }

    .results-panel {
        padding: 16px;
        padding-bottom: 130px; /* Space for mobile-generate-bar (60px) + bottom-nav (50px) + extra */
    }

    .mobile-generate-bar {
        display: block;
    }

    .generation-panel .generate-btn {
        display: none;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

/* Loading States */
.generate-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.generate-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.generate-loading p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Input Image Field */
.input-image-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.input-image-preview {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-secondary);
}

.input-image-preview.has-image {
    border-style: solid;
    border-color: var(--accent-primary);
}

.input-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.input-image-clear {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #ff4444;
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.input-image-clear:hover {
    background: #ff6666;
}

.input-image-select {
    padding: 8px 12px;
    white-space: nowrap;
}

.input-image-id-field {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.input-image-id-field:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.input-image-id-field::placeholder {
    color: var(--text-secondary);
}

/* Folder Selector */
.folder-selector-section {
    margin-bottom: 24px;
}

.folder-selector {
    position: relative;
    width: 100%;
}

.folder-selector-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.folder-selector-trigger:hover {
    border-color: var(--accent-primary);
}

.folder-selector-trigger .material-icons-outlined:first-child {
    font-size: 18px;
    color: var(--text-secondary);
}

.folder-selector-trigger .material-icons-outlined:last-child {
    font-size: 18px;
    color: var(--text-tertiary);
    margin-left: auto;
}

.folder-selector-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.folder-dropdown.show {
    display: block;
}

.folder-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.folder-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.folder-dropdown-item.active {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.folder-dropdown-item .material-icons-outlined {
    font-size: 18px;
    color: var(--text-secondary);
}

.folder-dropdown-item.active .material-icons-outlined {
    color: var(--accent-primary);
}

.folder-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.folder-dropdown-create {
    color: var(--accent-primary);
}

.folder-dropdown-create .material-icons-outlined {
    color: var(--accent-primary);
}

/* Create Folder Modal */
.generate-folder-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.generate-folder-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
}

.generate-folder-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.generate-folder-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.generate-folder-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
}

.generate-folder-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.generate-folder-modal-body {
    padding: 16px;
}

.generate-folder-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.generate-folder-input-wrapper:focus-within {
    border-color: var(--accent-primary);
}

.generate-folder-input-wrapper .material-icons-outlined {
    font-size: 20px;
    color: var(--text-secondary);
}

.generate-folder-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.generate-folder-input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.generate-folder-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}
