/* =========================================================================
   TorchFold UI — Modern Bioinformatics Theme
   ========================================================================= */

/* ---------- CSS Variables ---------- */
:root {
    /* Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    --secondary: #0d9488;
    --secondary-dark: #0f766e;
    --accent: #8b5cf6;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0891b2;
    --info-bg: #cffafe;

    /* Neutrals */
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", "Consolas", monospace;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition: all 0.2s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ---------- Layout ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 64px 0;
}

.section-alt {
    background: var(--bg-alt);
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.section-desc {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-bg);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-alt);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
    color: white;
    padding: 80px 0 100px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139,92,246,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: linear-gradient(90deg, #60a5fa, #c084fc, #f0abfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 40px;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---------- Card ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    border: 1px solid var(--border);
}

.form-card {
    max-width: 800px;
    margin: -60px auto 0;
    position: relative;
    z-index: 10;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---------- Sequence Type Tabs ---------- */
.seq-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.seq-type-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-alt);
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.seq-type-tab:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.seq-type-tab.active {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.tab-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.seq-type-tab[data-type="protein"] .tab-icon,
.seq-type-tab.active[data-type="protein"] .tab-icon {
    background: var(--primary);
}

.seq-type-tab[data-type="dna"] .tab-icon,
.seq-type-tab.active[data-type="dna"] .tab-icon {
    background: var(--secondary);
}

.seq-type-tab[data-type="rna"] .tab-icon,
.seq-type-tab.active[data-type="rna"] .tab-icon {
    background: var(--accent);
}

.seq-type-tab[data-type="ligand"] .tab-icon,
.seq-type-tab.active[data-type="ligand"] .tab-icon {
    background: var(--warning);
}

.seq-type-tab[data-type="ion"] .tab-icon,
.seq-type-tab.active[data-type="ion"] .tab-icon {
    background: var(--info);
}

/* ---------- Sequence Entry ---------- */
.sequences-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.seq-entry {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.seq-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.seq-entry-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.seq-type-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.seq-type-badge.protein { background: var(--primary); }
.seq-type-badge.dna { background: var(--secondary); }
.seq-type-badge.rna { background: var(--accent); }
.seq-type-badge.ligand { background: var(--warning); }
.seq-type-badge.ion { background: var(--info); }

.seq-id-input {
    width: 60px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    outline: none;
    transition: var(--transition);
}

.seq-id-input:focus {
    border-color: var(--primary);
}

.seq-remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.seq-remove-btn:hover {
    background: var(--danger);
    color: white;
}

.seq-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.seq-copy-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--primary-bg);
    color: var(--primary);
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.seq-copy-btn:hover {
    background: var(--primary);
    color: white;
}

.seq-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    outline: none;
    transition: var(--transition);
    letter-spacing: 0.5px;
}

.seq-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.seq-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.seq-length {
    font-weight: 600;
}

.seq-validation {
    color: var(--success);
}

.seq-validation.error {
    color: var(--danger);
}

.mode-warning {
    color: var(--danger);
    font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-add-seq {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-dark);
    background: transparent;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-add-seq:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.btn-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* ---------- Advanced Options ---------- */
.advanced-section {
    margin-bottom: 24px;
}

.advanced-toggle {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    transition: var(--transition);
}

.advanced-toggle:hover {
    color: var(--primary);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 10px;
}

.advanced-toggle.open .toggle-icon {
    transform: rotate(90deg);
}

.advanced-content {
    margin-top: 16px;
    padding: 20px;
    background: var(--bg-alt);
    border-radius: var(--radius);
}

/* ---------- Examples ---------- */
.examples-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

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

.examples-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.example-chip {
    padding: 6px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.example-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* ---------- Jobs List ---------- */
.jobs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.jobs-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}

.job-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

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

.job-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.job-icon.pending { background: var(--warning-bg); }
.job-icon.running { background: var(--info-bg); }
.job-icon.completed { background: var(--success-bg); }
.job-icon.failed { background: var(--danger-bg); }
.job-icon.cancelled { background: var(--bg-alt); }

.job-details {
    flex: 1;
    min-width: 0;
}

.job-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.job-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.job-status-badge.pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.job-status-badge.running {
    background: var(--info-bg);
    color: var(--info);
}

.job-status-badge.completed {
    background: var(--success-bg);
    color: var(--success);
}

.job-status-badge.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.job-status-badge.cancelled {
    background: var(--bg-alt);
    color: var(--text-muted);
}

.job-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.job-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.job-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.job-action-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-alt);
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ---------- Modal Content ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item {
    padding: 12px 16px;
    background: var(--bg-alt);
    border-radius: var(--radius);
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.progress-bar-container {
    margin: 16px 0;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.log-section {
    margin-top: 20px;
}

.log-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.log-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.result-files {
    margin-top: 20px;
}

.result-files-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

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

.result-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    transition: var(--transition);
}

.result-file-item:hover {
    background: var(--primary-bg);
}

.result-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-file-icon {
    font-size: 20px;
}

.result-file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.result-file-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.result-file-download {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.result-file-download:hover {
    background: var(--primary-dark);
    color: white;
}

/* ---------- Docs ---------- */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.doc-card {
    text-align: center;
    padding: 32px 24px;
}

.doc-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.doc-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.doc-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--text);
    color: rgba(255, 255, 255, 0.7);
    padding: 32px 0;
    margin-top: 40px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.footer-logo {
    font-weight: 700;
    color: white;
}

.footer-sep {
    color: rgba(255, 255, 255, 0.3);
}

.footer-right {
    display: flex;
    gap: 24px;
}

.footer-right a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.footer-right a:hover {
    color: white;
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    min-width: 300px;
    max-width: 450px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }

    .hero-desc {
        font-size: 15px;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-value {
        font-size: 22px;
    }

    .nav {
        display: none;
    }

    .form-card {
        margin-top: -40px;
        padding: 24px 20px;
    }

    .card {
        padding: 24px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 48px 0;
    }

    .section-title {
        font-size: 24px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* =========================================================================
   Ligand & Bonded Atom Pairs UI
   ========================================================================= */

/* Ligand CCD codes input */
.ligand-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ligand-input-row .form-input {
    flex: 1;
}

.ligand-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Bonds container */
.bonds-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.bond-entry {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    padding: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.bond-entry .bond-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bond-entry .bond-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.bond-entry .bond-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-mono);
}

.bond-entry .bond-arrow {
    text-align: center;
    font-size: 18px;
    color: var(--primary);
    font-weight: bold;
    padding-bottom: 6px;
}

.bond-entry .btn-remove-bond {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bond-entry .btn-remove-bond:hover {
    background: var(--danger);
    color: white;
}

.bond-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.bond-section-title .bond-side {
    flex: 1;
    text-align: center;
    font-weight: 600;
}

.bond-section-title .bond-side:first-child {
    text-align: right;
}

.bond-section-title .bond-side:last-child {
    text-align: left;
}

@media (max-width: 768px) {
    .bond-entry {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .bond-entry .bond-arrow {
        grid-column: 1 / -1;
        text-align: center;
    }
    .bond-entry .btn-remove-bond {
        grid-column: 1 / -1;
        width: 100%;
        height: 32px;
    }
}

/* =========================================================================
   Option Group (radio / checkbox) — Inference Mode & Data Pipeline
   ========================================================================= */

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.option-text {
    font-weight: 500;
}

/* =========================================================================
   3D Structure Viewer (3Dmol.js)
   ========================================================================= */

.viewer-card {
    padding: 0;
    overflow: hidden;
}

.viewer-layout {
    display: flex;
    align-items: stretch;
}

.viewer-panel {
    width: 300px;
    flex-shrink: 0;
    padding: 24px;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.viewer-style-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
}

.viewer-style-group .option-item {
    gap: 5px;
    font-size: 13px;
}

.viewer-toggles {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.viewer-panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.viewer-info {
    margin-top: 14px;
    padding: 10px 12px;
    background: var(--bg-alt);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
    word-break: break-all;
}

.viewer-info strong {
    color: var(--text);
    font-size: 13px;
}

.viewer-viewport-wrapper {
    position: relative;
    flex: 1;
    min-height: 560px;
    background: #eef2f7;
}

.viewer-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.viewer-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 24px;
    pointer-events: none;
}

.viewer-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-secondary);
    font-size: 13px;
    z-index: 2;
}

/* Small screens: stack panel above viewport */
@media (max-width: 900px) {
    .viewer-layout {
        flex-direction: column;
    }

    .viewer-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .viewer-viewport-wrapper {
        min-height: 420px;
    }
}

/* =========================================================================
   Collapsed copy groups (identical duplicate sequences)
   ========================================================================= */
.seq-group {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    animation: slideIn 0.3s ease;
}

.seq-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.seq-group-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.seq-group-toggle:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.seq-group-ids {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.seq-group-count {
    background: var(--primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.seq-group-preview {
    margin-top: 6px;
    margin-left: 28px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: var(--transition);
}

.seq-group-preview:hover {
    color: var(--primary);
}

.seq-group-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.seq-group .seq-entry {
    background: var(--surface);
    animation: none;
}

/* =========================================================================
   Jobs list pagination
   ========================================================================= */
.jobs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.jobs-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.jobs-page-btn:hover:not(:disabled):not(.ellipsis):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.jobs-page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    cursor: default;
}

.jobs-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.jobs-page-btn.ellipsis {
    border: none;
    background: none;
    cursor: default;
    color: var(--text-muted);
}
