* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ffffff;
    --secondary: #f8f9fa;
    --accent: #1f2937;
    --accent-hover: #111827;
    --success: #059669;
    --error: #dc2626;
    --border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-subtle: #f3f4f6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
    background: var(--primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
}

.header {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-button {
    padding: 14px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.tab-button:hover {
    color: var(--text-primary);
    background: rgba(31, 41, 55, 0.05);
}

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(31, 41, 55, 0.02);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

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

h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 28px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input, select {
    padding: 10px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.05);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.1);
}

input::placeholder {
    color: var(--text-secondary);
}

.autocomplete-wrapper {
    position: relative;
    margin-bottom: 20px;
    max-width: 600px;
}

.autocomplete-input {
    width: 100%;
    padding: 11px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.autocomplete-list {
    position: absolute;
    width: 100%;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: all 0.15s;
}

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

.autocomplete-item:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
    padding-left: 16px;
}

.table-wrapper {
    margin-bottom: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: visible;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

th:first-child {
    text-align: left;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    text-align: center;
}

td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--accent);
}

tbody tr:hover {
    background: rgba(6, 182, 212, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-remove {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    font-size: 11px;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-primary {
    background: var(--accent);
    color: var(--primary);
    padding: 11px 24px;
    font-size: 13px;
    margin-bottom: 16px;
    font-weight: 600;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.badge {
    display: inline-block;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(6, 182, 212, 0.3);
    font-weight: 500;
    animation: slideIn 0.2s ease;
}

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

.badge-close {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.badge-close:hover {
    color: var(--error);
}

.hotspot-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    min-height: 36px;
}

.dmets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.dmets-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-subtle);
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.dmets-item:hover {
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.05);
}

.dmets-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 16px;
    text-align: center;
}

.status-message {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: none;
    font-size: 13px;
    animation: slideDown 0.2s ease;
    border: 1px solid;
}

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

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
    display: block;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
    display: block;
}

.loading {
    display: none;
    text-align: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    margin-top: 8px;
}

.loading.show::after {
    content: 'Predicting';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: 'Predicting'; }
    40% { content: 'Predicting.'; }
    60% { content: 'Predicting..'; }
    80%, 100% { content: 'Predicting...'; }
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

.summary {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    margin-top: 16px;
}

.summary h3 {
    color: var(--accent);
    margin-bottom: 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#predictionsList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prediction-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s;
    animation: slideIn 0.3s ease;
}

.prediction-card:hover {
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.05);
}

.prediction-rank {
    min-width: 48px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--primary);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.prediction-info {
    flex: 1;
}

.prediction-cancer-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.prediction-confidence {
    font-size: 12px;
    color: var(--text-secondary);
}

.prediction-probability {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    min-width: 100px;
    text-align: right;
}

.info-wrapper {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: help;
    overflow: visible;
}

.info-icon {
    margin-left: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    color: var(--primary);
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
}

.info-tooltip {
    visibility: hidden;
    opacity: 0;
    min-width: 240px;
    background: var(--accent);
    color: var(--primary);
    padding: 10px 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 99999;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: normal;
    border: 1px solid var(--accent);
    margin-top: 8px;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--accent);
}

.info-wrapper:hover .info-tooltip {
    visibility: visible;
    opacity: 1;
}

#therapy-tab h2 {
    color: var(--accent);
    margin-bottom: 32px;
    font-size: 18px;
}

#therapy-tab .form-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: 600px;
    margin: 0 auto;
    grid-template-columns: unset;
}

#therapy-tab .form-group {
    position: relative;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#therapy-tab label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    text-align: center;
    text-transform: capitalize;
    letter-spacing: normal;
    font-size: 15px;
}

#therapy-tab input {
    width: 100%;
    border: 2px solid var(--border);
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 8px;
}

#therapy-tab input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.1);
}

#therapy-tab input::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 22px;
    }

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

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

    .prediction-card {
        flex-direction: column;
        text-align: center;
    }

    .prediction-probability {
        text-align: center;
        min-width: auto;
    }
}