/* Tool Workspace View */
.workspace {
    max-width: 800px;
    margin: 0 auto;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.workspace-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 36px;
}

.workspace-header {
    text-align: center;
    margin-bottom: 28px;
}

.workspace-header .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: inline-block;
}

.workspace-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.workspace-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 44px 20px;
    text-align: center;
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 24px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.04);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 14px;
}

.upload-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.upload-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 18px;
}

.file-input {
    display: none;
}

.btn-select {
    background: var(--accent-primary);
    color: #042f2e;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

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

/* File List */
.file-list-section {
    margin-bottom: 24px;
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 12px;
    padding: 0 2px;
}

.file-list-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.file-list-summary {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.file-list-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.file-list-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-list-action {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.btn-list-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
    border-color: var(--text-dim);
}

.btn-list-clear:hover {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.45);
    background: var(--danger-bg);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
}

.file-item.is-draggable {
    cursor: grab;
}

.file-item.is-draggable:hover {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(26, 35, 54, 0.65);
}

.file-item--placeholder {
    border: 2px dashed var(--accent-primary);
    background: rgba(16, 185, 129, 0.06);
}

.file-item--placeholder > * {
    opacity: 0.2;
}

.file-item--ghost {
    background: var(--bg-surface-hover);
    border: 1.5px solid var(--accent-primary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
    cursor: grabbing;
    opacity: 0.96;
}

body.is-reordering,
body.is-reordering * {
    user-select: none !important;
    cursor: grabbing !important;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

.file-item:hover .drag-handle,
.drag-handle:hover {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.drag-handle:focus-visible {
    outline-offset: 1px;
    color: var(--accent-primary);
}

.file-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.file-thumb {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.file-type-badge {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.file-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-move {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.btn-move:hover:not(:disabled) {
    background: var(--bg-surface-hover);
    border-color: var(--border-subtle);
    color: var(--text-main);
}

.btn-move:focus-visible {
    outline-offset: 1px;
}

.btn-move:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.btn-remove:hover {
    background: var(--danger-bg);
}

.btn-remove:focus-visible {
    outline: 2px solid var(--danger);
    outline-offset: 1px;
}

/* Actions & Progress */
.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.btn-convert {
    background: var(--accent-primary);
    color: #042f2e;
    padding: 14px 36px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    max-width: 320px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-convert:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

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

.progress-container {
    width: 100%;
    margin: 16px 0;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Result & Error banners */
.alert-box {
    padding: 20px;
    border-radius: 12px;
    margin-top: 24px;
    text-align: center;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.alert-msg {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(4, 47, 46, 0.3);
    border-top-color: #042f2e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 600px) {
    .workspace-card {
        padding: 24px 16px;
    }

    .file-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .file-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .file-name {
        max-width: 100%;
    }
}
