/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
}

.header-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header i {
    margin-right: 0.5rem;
    color: #3498db;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: #34495e;
    border-bottom: 3px solid #3498db;
    overflow-x: auto;
}

/* Step Navigation Controls */
.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 20px 30px;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    position: sticky;
    bottom: 0;
    z-index: 100;
}

/* Checkbox with Button Layout */
.checkbox-with-button {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.checkbox-with-button .checkbox-container {
    margin-bottom: 0;
    flex: 1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-outline-primary {
    color: #007bff;
    border: 1px solid #007bff;
    background: transparent;
}

.btn-outline-primary:hover:not(:disabled) {
    color: white;
    background: #007bff;
    border-color: #007bff;
}

.btn-outline-primary:disabled {
    color: #6c757d;
    border-color: #6c757d;
    background: transparent;
    cursor: not-allowed;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.nav-btn:hover:not(:disabled) {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.nav-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.step-indicator span {
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 20px;
    min-width: 30px;
    text-align: center;
}

.step-indicator #current-step {
    background: #007bff;
    color: white;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    color: white;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    min-width: 200px;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.tab-button.active {
    background: #3498db;
    border-bottom-color: #e74c3c;
    transform: translateY(-2px);
}

.tab-button i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    padding: 2rem;
    min-height: 600px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #e1e8ed;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.card h2 i {
    margin-right: 0.5rem;
    color: #3498db;
}

/* File Generation Note */
.file-generation-note {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-left: 5px solid #ffc107;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

.file-generation-note i {
    color: #856404;
    font-size: 1.5rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.file-generation-note .note-content {
    flex: 1;
    color: #856404;
    line-height: 1.6;
}

.file-generation-note .note-content p {
    margin: 0;
    font-size: 0.95rem;
}

.file-generation-note .note-content strong {
    color: #664d03;
    font-weight: 600;
}

/* Protein Loading Styles */
.input-methods {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.method-option {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.method-option:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.method-option h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.method-option h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.divider {
    text-align: center;
    font-weight: bold;
    color: #7f8c8d;
    font-size: 1.1rem;
}

.divider::before,
.divider::after {
    content: '';
    display: inline-block;
    width: 50px;
    height: 2px;
    background: #bdc3c7;
    vertical-align: middle;
    margin: 0 1rem;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.file-upload-area:hover {
    background: #e3f2fd;
    border-color: #2980b9;
}

.file-upload-area i {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 1rem;
    display: block;
}

.file-upload-area p {
    margin-bottom: 1rem;
    color: #7f8c8d;
}

.file-info {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
}

.file-info p {
    margin: 0.25rem 0;
    color: #155724;
}

/* PDB Fetch */
.pdb-fetch {
    margin-top: 1rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.input-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Status Messages */
.status-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Protein Preview */
.protein-preview {
    margin-top: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
}

.preview-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

/* Structure comparison container - force side by side and centered */
.structure-comparison-container {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    max-width: 1400px !important;
    gap: 20px !important;
    margin: 0 auto !important;
    justify-content: center !important;
}

.structure-comparison-container .comparison-viewer {
    flex: 0 1 48% !important;
    min-width: 450px !important;
    max-width: 48% !important;
}

/* Override preview-content for comparison view */
#completed-structure-preview .preview-content {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 0 !important;
    grid-template-columns: none !important;
}

.protein-info p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.protein-visualization {
    background: white;
    border-radius: 4px;
    padding: 1rem;
    border: 1px solid #dee2e6;
    min-height: 300px;
    position: relative;
}

/* Ensure NGL viewer controls overlay within both original and prepared viewers */
.molecule-viewer {
    position: relative;
}

#ngl-viewer {
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.viewer-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.viewer-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.viewer-controls .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Superimposed structure preview: controls inside the viewer box (parent has position: relative) */
#superimposed-molecule-viewer .viewer-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

/* Simulation Parameters */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.param-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.param-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 0.5rem;
}

.param-section h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Simulation Steps */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step-item {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    overflow: hidden;
    transition: all 0.3s ease;
}

.step-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #34495e;
    color: white;
    cursor: pointer;
}

.step-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.step-header h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.step-content {
    padding: 1.5rem;
    background: white;
    display: none;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3498db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* File Generation */
.generation-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.files-preview {
    margin-bottom: 2rem;
}

.files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-2px);
}

.file-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.file-item p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.download-section {
    margin-bottom: 2rem;
}

.download-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.simulation-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
}

.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-item {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.summary-item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.summary-item p {
    color: #7f8c8d;
    margin: 0.25rem 0;
}

/* Checkbox Group Styles */
.checkbox-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 0.5rem;
    transform: scale(1.2);
}

.checkbox-container:hover {
    color: #007bff;
}

/* Ion Controls */
.ion-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ion-controls select {
    flex: 1;
}




#ligand-forcefield-section {
    transition: all 0.3s ease;
}

#ligand-forcefield-section.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Tooltip styling for better text wrapping */
.tooltip {
    max-width: 300px;
}

.tooltip-inner {
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
}

.btn i {
    font-size: 1rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

.footer p {
    margin: 0;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .tab-navigation {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: auto;
        border-bottom: 1px solid #2c3e50;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .input-methods {
        grid-template-columns: 1fr;
    }
    
    .divider {
        order: 2;
    }
    
    .preview-content {
        grid-template-columns: 1fr;
    }
    
    .params-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .generation-controls {
        flex-direction: column;
    }
    
    .download-options {
        flex-direction: column;
    }
    
    .summary-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Structure Preparation Styles */
.card-description {
    color: #7f8c8d;
    margin-bottom: 2rem;
    font-style: italic;
}

.prep-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.prep-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
}

.prep-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 0.5rem;
}

.prep-section h3 i {
    margin-right: 0.5rem;
    color: #3498db;
}

.prep-section-fullwidth {
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.prep-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prep-option {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    border: 1px solid #e1e8ed;
    transition: all 0.3s ease;
}

.prep-option:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 0.75rem;
    transform: scale(1.2);
}

.option-description {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
    margin-left: 1.5rem;
}

.prep-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.prep-status {
    background: #e8f5e8;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.prep-status h3 {
    color: #155724;
    margin-bottom: 1rem;
}

.status-content {
    color: #155724;
}

.prepared-structure-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    margin-top: 2rem;
    width: 100%;
    box-sizing: border-box;
}

#sequence-viewer-section {
    width: 100%;
    box-sizing: border-box;
}

.prepared-structure-preview h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.structure-info p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.structure-visualization {
    margin-top: 1rem;
}

#prepared-ngl-viewer {
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* Custom Checkbox Styles */
.checkbox-container input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked {
    background: #3498db;
    border-color: #3498db;
}

.checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.checkbox-container input[type="checkbox"]:hover {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Responsive Design for Structure Prep */
@media (max-width: 768px) {
    .prep-sections {
        grid-template-columns: 1fr;
    }
    
    .prep-actions {
        flex-direction: column;
    }
    
    .prep-option {
        padding: 0.75rem;
    }
    
    .option-description {
        margin-left: 1.25rem;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* Missing Residues Horizontal Display */
.missing-residues-horizontal {
    display: inline;
    color: #155724;
    font-weight: bold;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.chain-missing-info {
    margin-bottom: 1.5rem;
}

.chain-missing-info h4 {
    color: #155724;
    margin-bottom: 0.5rem;
}

/* Sequence Viewer Styles */
.sequence-viewer-container {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    width: 100%;
    box-sizing: border-box;
}

.sequence-chain-container {
    margin-bottom: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1.5rem;
}

.sequence-chain-container:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sequence-chain-header {
    margin-bottom: 1rem;
}

.sequence-chain-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sequence-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    font-size: 14px;
    line-height: 1.8;
    width: 100%;
    box-sizing: border-box;
}

.sequence-line {
    display: flex;
    margin-bottom: 2px;
    white-space: nowrap;
}

.sequence-line-number {
    color: #6c757d;
    margin-right: 1rem;
    min-width: 60px;
    text-align: right;
    font-size: 12px;
    user-select: none;
}

.sequence-characters {
    letter-spacing: 2px;
    word-spacing: 0;
    flex: 1;
    overflow-x: auto;
    min-width: 0;
}

.sequence-char {
    display: inline-block;
    padding: 2px 1px;
    transition: background-color 0.2s;
}

.sequence-char:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* Trim Residues Section */
.trim-info-box {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    color: #004085;
    font-size: 0.9rem;
    line-height: 1.6;
}

.trim-info-box i {
    color: #0066cc;
    margin-right: 0.5rem;
}

.trim-info-box strong {
    color: #003366;
}

.trim-residues-container {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.trim-chain-controls {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
}

.trim-chain-controls h5 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.trim-inputs {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.trim-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trim-input-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    min-width: 100px;
}

.trim-limit {
    font-weight: normal;
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

.trim-input-group input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.trim-input-group input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.trim-info {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Log Modal Styles */
.log-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

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

.log-modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

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

.log-modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.log-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
}

.log-modal-close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.log-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.log-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: calc(90vh - 80px);
}

.log-content {
    min-height: 100%;
}

.log-line {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    word-wrap: break-word;
}

.log-line:last-child {
    border-bottom: none;
}

.log-time {
    color: #858585;
    margin-right: 0.5rem;
}

.log-icon {
    margin-right: 0.5rem;
}

.log-message {
    color: #d4d4d4;
}

.log-info .log-message {
    color: #d4d4d4;
}

.log-success .log-message {
    color: #4ec9b0;
}

.log-warning .log-message {
    color: #dcdcaa;
}

.log-error .log-message {
    color: #f48771;
}

.log-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #252526;
    border-left: 4px solid #4ec9b0;
    border-radius: 4px;
}

.log-result h4 {
    color: #4ec9b0;
    margin-bottom: 0.5rem;
}

.log-result p {
    color: #d4d4d4;
    margin: 0.5rem 0;
}

.log-result ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    color: #d4d4d4;
}

.log-result li {
    margin: 0.5rem 0;
}

/* File Editor Modal Styles */
#file-content-modal {
    animation: fadeIn 0.3s;
}

#file-content-modal > div {
    animation: slideDown 0.3s;
}

#modal-content-edit {
    line-height: 1.6;
    tab-size: 4;
    -moz-tab-size: 4;
}

#modal-content-edit:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

#save-status {
    font-weight: 500;
    animation: slideUp 0.3s;
}

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

#edit-file-btn:hover {
    background: #0056b3 !important;
}

#save-file-btn:hover {
    background: #218838 !important;
}

#cancel-edit-btn:hover {
    background: #5a6268 !important;
}

/* Frozen/Disabled Checkboxes - Gray only the checkbox, keep text bold and normal */
.checkbox-container input[type="checkbox"]:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.checkbox-container input[type="checkbox"]:disabled + .checkmark {
    opacity: 0.5 !important;
}

/* Keep text labels bold and normal color when checkbox is disabled */
.checkbox-container:has(input[type="checkbox"]:disabled) {
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 1 !important;
    color: #2c3e50 !important;
    font-weight: 600 !important;
}

.checkbox-container:has(input[type="checkbox"]:disabled):hover {
    color: #2c3e50 !important;
}

/* Prevent interaction on disabled checkbox inputs */
.checkbox-container input[type="checkbox"]:disabled {
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.5 !important;
}

/* Gray out the checkmark for disabled checkboxes */
.checkbox-container input[type="checkbox"]:disabled:checked {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

.checkbox-container input[type="checkbox"]:disabled:checked::after {
    color: #ffffff !important;
}

/* Frozen/Disabled Toggle Switches - Gray only the toggle, keep it hidden */
.switch input[type="checkbox"]:disabled {
    opacity: 0 !important; /* Keep the input completely hidden */
    cursor: not-allowed !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

.switch input[type="checkbox"]:disabled + .slider {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background-color: #95a5a6 !important; /* Gray color for disabled toggles */
}

.switch input[type="checkbox"]:disabled:checked + .slider {
    background-color: #95a5a6 !important; /* Gray color even when checked */
}

.switch input[type="checkbox"]:disabled:not(:checked) + .slider {
    background-color: #bdc3c7 !important; /* Lighter gray when unchecked */
}

.switch:has(input[type="checkbox"]:disabled) {
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 1 !important; /* Keep switch container visible */
}

.switch:has(input[type="checkbox"]:disabled) .slider {
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Ensure disabled switch input stays completely hidden */
.switch input[type="checkbox"]:disabled {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Docking Section Collapsible Styles */
#docking-section.collapsed .section-description,
#docking-section.collapsed .custom-plumed-section {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

#docking-section.collapsed .plumed-toggle-header {
    margin-bottom: 0;
}

.docking-box-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.docking-box-row .form-group {
    flex: 1;
}

.docking-setup-entry {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.docking-setup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.docking-setup-chains {
    font-size: 0.9em;
    color: #6c757d;
}

/* Docking Ligand Selection Row Styles */
.docking-ligand-row {
    transition: all 0.2s ease;
}

.docking-ligand-row:hover {
    background: #e9ecef !important;
    border-color: #6f42c1 !important;
}

.docking-ligand-row .checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Docking Box Controls Compact Layout */
#docking-setup-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.docking-setup-entry {
    transition: all 0.2s ease;
}

.docking-setup-entry:hover {
    border-color: #6f42c1 !important;
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.15);
}

.docking-setup-entry input[type="number"] {
    transition: border-color 0.2s ease;
}

.docking-setup-entry input[type="number"]:focus {
    border-color: #6f42c1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.1);
}

/* Small checkmarks for chain selection */
.docking-ligand-row .checkmark {
    width: 16px !important;
    height: 16px !important;
}

.docking-ligand-row .checkmark:after {
    left: 5px !important;
    top: 2px !important;
    width: 4px !important;
    height: 8px !important;
}


/* Docking Setup Collapsible Section */
.docking-setup-collapsible {
    transition: all 0.3s ease;
}

.docking-setup-header {
    user-select: none;
    transition: background 0.2s ease;
}

.docking-setup-header:hover {
    background: linear-gradient(135deg, #5a31a8 0%, #7d4bc7 100%) !important;
}

.docking-setup-content {
    transition: all 0.3s ease;
}

#docking-setup-toggle-icon {
    transition: transform 0.3s ease;
}

/* Docking Poses Viewer Styles */
.docking-ligand-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.docking-ligand-tab {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docking-ligand-tab:hover {
    border-color: #6f42c1;
    background: #f3e8ff;
}

.docking-ligand-tab.active {
    border-color: #6f42c1;
    background: linear-gradient(135deg, #6f42c1 0%, #9b59b6 100%);
    color: white;
}

.docking-ligand-tab .ligand-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.docking-poses-viewer-wrapper {
    position: relative;
    margin-bottom: 15px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.docking-poses-viewer {
    width: 100%;
    max-width: 700px;
    height: 500px;
    background: #fff;
    border-radius: 5px;
    border: 2px solid #6f42c1;
    overflow: hidden;
    margin: 0 auto;
}

.pose-nav-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
    border-radius: 0 0 5px 5px;
}

.pose-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #6f42c1;
    background: white;
    color: #6f42c1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.pose-nav-btn:hover:not(:disabled) {
    background: #6f42c1;
    border-color: #6f42c1;
    color: white;
    transform: scale(1.1);
}

.pose-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pose-info-display {
    text-align: center;
    min-width: 200px;
}

.pose-mode-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.pose-energy-label {
    font-size: 0.95rem;
    color: #28a745;
    font-weight: 500;
}

.pose-color-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.85rem;
}

.pose-color-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.original {
    background: #00ff00;
}

.legend-dot.docked {
    background: #ff6b6b;
}

.docking-poses-selection {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
}

.docking-poses-selection h5 {
    margin-bottom: 10px;
    color: #495057;
    font-size: 0.95rem;
}

.pose-selection-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.pose-selection-row:last-child {
    margin-bottom: 0;
}

.pose-selection-label {
    font-weight: 500;
    min-width: 100px;
}

.pose-selection-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.pose-selection-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.pose-selection-option:hover {
    background: #e9ecef;
}

.pose-selection-option input[type="radio"] {
    accent-color: #6f42c1;
}

.pose-selection-option.selected {
    background: #f3e8ff;
    border: 1px solid #6f42c1;
}

.pose-selection-energy {
    font-size: 0.85rem;
    color: #28a745;
    font-weight: 500;
}
