/* --- MODERN GRAPHITE (UNIFIED) --- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Soft Zinc Palette */
    --bg-color: #09090b;
    --card-bg: #18181b;
    --card-hover: #27272a;

    --text-color: #f4f4f5;
    --text-muted: #a1a1aa;

    /* CYAN ACCENT */
    --accent-color: #22d3ee;
    --accent-hover: #06b6d4;
    --accent-light: rgba(34, 211, 238, 0.1);
    --accent-text: #000;

    --success-color: #34d399;
    --danger-color: #dc2626;
    --border-color: #1f1f22;

    --modal-overlay: rgba(0, 0, 0, 0.7);

    /* Radius & Spacing */
    --radius-md: 2px;
    --radius-sm: 2px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Linear Progress */
.progress-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--accent-light);
    z-index: 10001;
    /* Above modal */
    overflow: hidden;
}

.progress-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    animation: progress-indeterminate 1s infinite linear;
    transform-origin: 0% 50%;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(0) scaleX(0);
    }

    40% {
        transform: translateX(0) scaleX(0.4);
    }

    100% {
        transform: translateX(100%) scaleX(0.5);
    }
}

body.modal-open {
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.4;
    padding: 1.5rem;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

/* --- RESTORED UTILITIES & LAYOUT FROM BASE --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* --- COMPONENTS: HEADER --- */

header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- COMPONENTS: BUTTONS --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px !important;
    padding: 0 0.85rem !important;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    gap: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn.primary {
    background-color: var(--accent-color);
    color: var(--accent-text);
}

.btn.primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn.primary.danger {
    background-color: var(--danger-color);
    color: #fff;
    border-color: transparent;
}

.btn.primary.danger:hover {
    background-color: #ef4444;
}

.btn.secondary {
    background-color: #27272a;
    color: #e4e4e7;
    border: 1px solid #3f3f46;
}

.btn.secondary:hover {
    background-color: #3f3f46;
    border-color: #52525b;
}

.btn svg.lucide {
    width: 14px;
    height: 14px;
}

/* Restored .btn-icon for standalone icons */
.btn-icon {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--accent-color);
}

.btn-icon.small {
    padding: 4px;
}

/* --- SECTION: FOLDER VIEW --- */

.folder-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
}

.folder-column {
    background-color: #1a1a1e;
    border: 1px solid #27272a;
    border-radius: var(--radius-sm);
    padding: 1rem;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    overflow: hidden;
}

.folder-column:hover {
    border-color: var(--accent-color);
}

.folder-column.drag-over {
    border-color: var(--accent-color);
    background-color: var(--accent-light);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.1);
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #27272a;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.folder-header h3 {
    font-size: 0.85rem;
    color: #e4e4e7;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.folder-header h3 i {
    color: var(--accent-color);
    width: 16px;
    height: 16px;
}

.upload-btn {
    color: #a1a1aa;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    background: transparent;
    border: 1px solid transparent;
}

.upload-btn:hover {
    color: var(--accent-color);
    background-color: var(--accent-light);
}

/* File List & Items */
.file-list {
    flex: 1;
    overflow-y: auto;
    font-size: 0.8rem;
    color: #a1a1aa;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 8px;
    border-radius: 2px;
    background-color: rgba(255, 255, 255, 0.02);
    cursor: default;
    transition: all 0.2s;
}

.file-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.file-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-delete {
    background: transparent;
    border: none;
    color: #71717a;
    cursor: pointer;
    display: none;
    padding: 2px;
    margin-left: 4px;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.file-item:hover .file-item-delete {
    display: flex;
}

.file-item-delete:hover {
    color: #ef4444;
}

.file-item-delete i,
.file-item-delete svg {
    width: 14px;
    height: 14px;
}

/* --- SECTION: WORKFLOW LIST (CARDS) --- */

.card {
    background-color: #141417;
    border: 1px solid #1f1f22;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    border: none;
}

.card-id {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 700;
}

.delete-btn {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0.4;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.delete-btn:hover {
    color: #ef4444;
    opacity: 1;
}

.card-steps {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

/* Step Window - Pure Plate Style */
.step {
    flex: 1;
    min-width: 140px;
    padding: 2rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s;
    background-color: transparent;
    border: none !important;
    box-shadow: none !important;
    opacity: 0.5;
    position: relative;
}

.step.active,
.step.next-up {
    background-color: rgba(255, 255, 255, 0.08) !important;
    opacity: 1 !important;
}

.step-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0 !important;
}

.step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px !important;
}

.step-icon i,
.step-icon svg {
    width: 52px !important;
    height: 52px !important;
    color: #52525b;
    stroke-width: 1.5;
    transition: all 0.2s;
}

/* Colors for Step States */
.step.active .step-icon i,
.step.active .step-icon svg {
    color: var(--success-color) !important;
    stroke-width: 2 !important;
}

/* Pulse Animation */
@keyframes pulse-soft {
    0% {
        filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.2));
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.4));
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.2));
        transform: scale(1);
        opacity: 0.8;
    }
}

.step.next-up .step-icon i,
.step.next-up .step-icon svg {
    color: var(--accent-color) !important;
    stroke-width: 2.2 !important;
    /* Animation applied here */
    animation: pulse-soft 4s infinite ease-in-out;
}

.step-label {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 850;
    color: #71717a;
    transition: color 0.2s;
}

.step.active .step-label,
.step.next-up .step-label {
    color: #fff;
    font-weight: 950;
}

.step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.step-status {
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.status-icon {
    display: none;
}

.arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3f3f46;
    /* low contrast by default */
    transition: all 0.3s ease;
}

/* Light up arrow when previous step is active or next-up */
.step.active+.arrow,
.step.active+.arrow+.step.active+.arrow

/* Chain for subsequent steps if needed, though simple sibling works for immediate next */
    {
    color: var(--accent-color);
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.4));
}

.arrow i {
    width: 24px;
    height: 24px;
    stroke-width: 3;
    /* Thicker Icon */
}

/* Action Buttons */
.btn-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.btn-action {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 2px;
    color: #71717a;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-action:hover:not(:disabled) {
    background-color: var(--accent-light);
    color: var(--accent-color);
    border-color: var(--accent-color) !important;
}

.btn-action:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-color: transparent !important;
}

/* Drop Overlay */
.step-drop-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(2px);
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 2px solid var(--accent-color);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.step.drag-over .step-drop-overlay {
    display: flex;
}

/* --- SECTION: MODALS --- */

/* Restored .modal Wrapper Logic */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #0d0d0f;
    border: 1px solid #1f1f22;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-md);
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content input {
    background-color: #09090b;
    border: 1px solid #27272a;
    color: #e4e4e7;
    font-family: 'Inter', sans-serif;
    padding: 0.75rem;
    width: 100%;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.modal-content input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-light);
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.confirm-modal-content {
    max-width: 400px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: auto;
}

/* Close Modal Button */
.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #52525b;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.close-modal-btn:hover {
    color: #ef4444;
}

/* Result List */
.result-list {
    background-color: #09090b;
    border: 1px solid #27272a;
    border-radius: var(--radius-sm);
    color: #e4e4e7;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.result-item {
    border-bottom: 1px solid #1c1c1f;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-item:last-child {
    border-bottom: none;
}

.result-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.result-icon.text-green {
    color: #34d399;
}

.result-icon.text-red {
    color: #f87171;
}

.result-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
    align-items: center;
}

.toast {
    background-color: #18181b;
    border: 1px solid #27272a;
    color: #f4f4f5;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    min-width: 300px;
    justify-content: center;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}