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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0f1e36 0%, #1e3a5f 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 98%;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.page {
    min-height: 600px;
}

/* Header */
header {
    background: linear-gradient(135deg, #2c5f8d 0%, #3a7bb5 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

header .btn-secondary {
    position: absolute;
    top: 20px;
    right: 30px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #2c5f8d;
    color: white;
}

.btn-primary:hover {
    background: #3a7bb5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 95, 141, 0.4);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: white;
    color: #2c5f8d;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
}

.btn-large {
    padding: 16px 48px;
    font-size: 1.2rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Upload Page */
.upload-section {
    padding: 60px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.upload-box {
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 60px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 600px;
}

.upload-box:hover {
    border-color: #2c5f8d;
    background: #f0f5fa;
}

.upload-box.dragover {
    border-color: #2c5f8d;
    background: #e3eef7;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-box h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 10px;
}

.upload-box p {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.file-name {
    margin-top: 15px;
    padding: 12px 20px;
    background: #e3eef7;
    color: #1e3a5f;
    border-radius: 8px;
    font-weight: 500;
    display: none;
}

/* Info Section */
.info-section {
    padding: 40px 60px 60px;
    background: #f8f9fa;
}

.info-section h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 15px;
}

.info-section p {
    color: #64748b;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 10px 0;
    color: #475569;
    font-size: 1rem;
}

.info-section li:before {
    content: "✓ ";
    color: #10b981;
    font-weight: bold;
    margin-right: 8px;
}

/* Processing Page */
.processing-section {
    padding: 80px 30px;
    text-align: center;
}

.spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    border: 6px solid #e2e8f0;
    border-top-color: #2c5f8d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.processing-section h2 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 15px;
}

.processing-section p {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 0 auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e3a5f, #2c5f8d);
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Results Page */
.results-section {
    padding: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.results-header h2 {
    font-size: 1.8rem;
    color: #1e293b;
}

.results-actions {
    display: flex;
    gap: 10px;
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    background: linear-gradient(135deg, #2c5f8d 0%, #3a7bb5 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Results Content Layout */
.results-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
    padding: 0 20px 30px 20px;
}

.viewer-section, .table-section {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.viewer-section h3, .table-section h3 {
    font-size: 1.3rem;
    color: #1e293b;
    margin-bottom: 15px;
}

/* NGL Viewer */
.ngl-viewport {
    width: 100%;
    height: 600px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    margin-bottom: 15px;
}

.viewer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.viewer-controls .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.chain-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chain-selector label {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}

.chain-select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.chain-select:hover:not(:disabled) {
    border-color: #2c5f8d;
}

.chain-select:focus {
    outline: none;
    border-color: #2c5f8d;
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1);
}

.chain-select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: auto;
    width: 100%;
}

.table-section {
    overflow-x: auto;
}

.no-results {
    text-align: center;
    padding: 60px;
    color: #64748b;
    font-size: 1.2rem;
}

.no-results p {
    margin: 0;
}

/* Tabulator Overrides */
.tabulator {
    font-size: 14px;
    background: white;
}

.tabulator-header {
    background: #f8f9fa;
    border-bottom: 2px solid #e2e8f0;
}

.tabulator-col-title {
    font-weight: 600;
    color: #1e293b;
}

.tabulator-row {
    transition: background 0.2s ease;
    cursor: pointer;
}

.tabulator-row:hover {
    background: #f0f5fa !important;
}

.tabulator-row.tabulator-selected {
    background: #d6e4f0 !important;
}

.tabulator-row.tabulator-selected:hover {
    background: #c7dbe8 !important;
}

.tabulator-footer {
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .upload-box {
        padding: 40px 20px;
    }
    
    .info-section {
        padding: 30px 20px;
    }
    
    .stats-row {
        flex-direction: column;
    }
    
    .results-content {
        padding: 0 10px 20px 10px;
    }
    
    .ngl-viewport {
        height: 400px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    header .btn-secondary {
        position: static;
        margin-top: 20px;
    }
}
