.finetune-page {
    margin: 0;
    background: radial-gradient(circle at top, #101014, #08080b 55%, #050506);
    min-height: 100vh;
}

.ft-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.ft-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(147, 51, 234, 0.10));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

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

.ft-icon {
    font-size: 36px;
}

.ft-header-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #f8fafc;
    font-family: 'Outfit', sans-serif;
}

.ft-header-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}

.ft-section-card {
    background: rgba(12, 12, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

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

.ft-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #7dd3fc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ft-section-icon {
    font-size: 18px;
}

/* Forms */
.ft-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ft-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ft-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
}

.ft-input {
    padding: 10px 14px;
    border-radius: 8px;
    background: #14141c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    font-size: 14px;
    transition: border-color 0.2s, outline 0.2s;
}

.ft-input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    border-color: transparent;
}

.ft-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.ft-textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: #14141c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    line-height: 1.5;
}

.ft-textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    border-color: transparent;
}

.ft-checkbox-group {
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
}

.ft-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ft-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

/* Buttons */
.ft-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.ft-btn:hover {
    filter: brightness(1.15);
}

.ft-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

.ft-btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
}

.ft-btn-secondary {
    background: #1f2937;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ft-btn-danger {
    background: #dc2626;
    color: white;
}

.ft-btn-success {
    background: #16a34a;
    color: white;
}

.ft-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.ft-btn-lg {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
}

.ft-btn-group {
    display: flex;
    gap: 8px;
}

.ft-actions-section {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Upload Area */
.ft-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(37, 99, 235, 0.04);
}

.ft-upload-area:hover {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.ft-upload-area.drag-over {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.12);
    transform: scale(1.01);
}

.ft-upload-area.file-loaded {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}

.ft-upload-content {
    pointer-events: none;
}

.ft-upload-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.ft-upload-text {
    font-size: 14px;
    color: #e2e8f0;
    margin: 6px 0;
}

.ft-upload-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* Data Info */
.ft-data-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(22, 163, 74, 0.08);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: 10px;
}

.ft-data-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ft-stat {
    font-size: 13px;
    color: #e2e8f0;
}

.ft-data-preview {
    max-height: 200px;
    overflow-y: auto;
    background: #0a0e16;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Pipeline Progress */
.ft-pipeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0 20px;
    padding: 0 8px;
    overflow-x: auto;
}

.ft-pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.ft-pipeline-step span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    white-space: nowrap;
}

.ft-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1f2937;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s ease;
    position: relative;
}

.ft-pipeline-step.active .ft-step-dot {
    background: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.ft-pipeline-step.completed .ft-step-dot {
    background: #16a34a;
    border-color: #16a34a;
}

.ft-pipeline-step.completed .ft-step-dot::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.ft-pipeline-step.failed .ft-step-dot {
    background: #dc2626;
    border-color: #dc2626;
}

.ft-pipeline-step.active span,
.ft-pipeline-step.completed span {
    color: #e2e8f0;
    font-weight: 600;
}

.ft-pipeline-connector {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
    margin-bottom: 20px;
    transition: background 0.4s;
}

.ft-pipeline-connector.completed {
    background: #16a34a;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.3); }
    50% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.6); }
}

/* Progress Bar */
.ft-progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: #1f2937;
    border-radius: 4px;
    overflow: hidden;
}

.ft-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ft-progress-text {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #7dd3fc;
    margin-top: 8px;
}

/* Metrics Grid */
.ft-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.ft-metric-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}

.ft-metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.ft-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

/* Status Badge */
.ft-status-badge {
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ft-status-badge.pending { background: #374151; color: #9ca3af; }
.ft-status-badge.downloading { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
.ft-status-badge.preparing_data { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.ft-status-badge.training { background: rgba(147, 51, 234, 0.2); color: #a78bfa; animation: pulse-badge 1.5s ease-in-out infinite; }
.ft-status-badge.merging { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.ft-status-badge.converting_gguf { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.ft-status-badge.registering_ollama { background: rgba(16, 163, 127, 0.2); color: #34d399; }
.ft-status-badge.completed { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.ft-status-badge.failed { background: rgba(220, 38, 38, 0.2); color: #f87171; }

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Log Container */
.ft-log-container {
    max-height: 400px;
    overflow-y: auto;
    background: #0a0e16;
    border-radius: 10px;
    padding: 14px 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ft-log-container::-webkit-scrollbar {
    width: 6px;
}

.ft-log-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.ft-log-container::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 3px;
}

.ft-log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ft-log-entry.error {
    color: #f87171;
}

.ft-log-entry.success {
    color: #4ade80;
}

.ft-log-entry .log-time {
    color: #475569;
    margin-right: 8px;
}

.ft-log-empty {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

/* Job History */
.ft-job-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.ft-job-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ft-job-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}

.ft-job-item-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .ft-form-grid {
        grid-template-columns: 1fr;
    }

    .ft-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ft-pipeline {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ft-pipeline-connector {
        display: none;
    }

    .ft-header-card {
        flex-direction: column;
        gap: 12px;
    }
}

.ft-textarea-section label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    display: block;
    margin-bottom: 6px;
}

.ft-model-suggestions {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.ft-model-suggestion {
    background: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #93c5fd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin: 2px 4px 2px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ft-model-suggestion:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.5);
    color: #dbeafe;
}

.ft-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    font-size: 12px;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 6px;
}
