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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
    min-height: 800px;
    color: #1d1d1f;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.logo {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 50%, #FF2D92 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: none;
    letter-spacing: -0.03em;
    line-height: 1;
    font-feature-settings: "liga" 1, "kern" 1;
}

.subtitle {
    font-size: 1.2rem;
    color: #86868b;
    margin-bottom: 20px;
    font-weight: 400;
}

.links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 0 20px;
}

.links a {
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 2px solid #007AFF;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(0, 122, 255, 0.05);
}

.links a:hover {
    background: #007AFF;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

/* ---- AUTH BAR (top-right) ---- */
.auth-bar {
    position: absolute; top: 16px; right: 16px; display: flex; gap: 10px; align-items: center;
}
.auth-chip {
    display: none; align-items: center; gap: 8px; padding: 6px 10px;
    border: 1px solid #e5e5ea; border-radius: 999px; background: #fff; font-size: 0.9rem;
}
.auth-chip img { width: 22px; height: 22px; border-radius: 50%; }
.auth-btn {
    background: linear-gradient(45deg, #007AFF, #5856D6); color:#fff; border:none;
    padding: 8px 14px; border-radius: 8px; cursor:pointer; font-weight: 500;
}
.auth-btn:hover { box-shadow: 0 8px 25px rgba(0, 122, 255, 0.25); transform: translateY(-1px); }

/* Popover (no overlay) */
.auth-popover {
    position: absolute; top: 48px; right: 0; width: min(360px, 92vw);
    background: #fff; border: 1px solid rgba(0,0,0,.08); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.12); padding: 14px; display: none; z-index: 50;
}
.auth-popover.show { display: block; }
.auth-popover h4 { margin: 4px 0 8px; font-size: 1.05rem; }
.auth-popover p { color: #555; font-size: .9rem; margin: 6px 0 12px; }
.auth-popover .sep { height:1px; background:#eee; margin:12px 0; }
.request-area textarea {
    width: 100%; min-height: 80px; resize: vertical; border:1px solid #d2d2d7; border-radius:8px; padding:10px;
}
.close-x {
    position:absolute; top:8px; right:10px; cursor:pointer; font-weight:700; color:#8e8e93;
}

/* ---- DISABLE MAIN APP UNTIL AUTH ----
.auth-locked .main-content,
.auth-locked .results-card,
.auth-locked .links a,
.auth-locked .container .btn,
.auth-locked .container input,
.auth-locked .container select,
.auth-locked .container textarea {
    pointer-events: none !important;
}

.auth-locked .main-content,
.auth-locked .results-card {
    filter: grayscale(.1) opacity(.95);
} */

.auth-warning {
    margin-top: 10px;
    color: #D70015;
    font-size: .9rem;
    display: none;
}

.auth-warning {
    display: block;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    min-width: 0;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card h2 {
    color: #1d1d1f;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #007AFF;
    padding-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d1d1f;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

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

.btn {
    background: linear-gradient(45deg, #007AFF, #5856D6);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.25);
}

.stop-btn {
    background: linear-gradient(45deg, #FF3B30, #FF453A) !important;
}

.stop-btn:hover {
    box-shadow: 0 8px 25px rgba(255, 59, 48, 0.25) !important;
}

.print-btn {
    background: linear-gradient(45deg, #34C759, #30D158) !important;
}

.print-btn:hover {
    box-shadow: 0 8px 25px rgba(52, 199, 89, 0.25) !important;
}

.print-options {
    display: inline-block;
}

.print-options .btn {
    margin-right: 10px;
}

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

.btn-secondary {
    background: linear-gradient(45deg, #8E8E93, #636366);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(142, 142, 147, 0.25);
}

.results-card {
    grid-column: 1 / -1;
}

.results-content {
    background: #f5f5f7;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    color: #1d1d1f;
}

.sequence-item {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.protein-sequence {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    margin: 8px 0;
    border: 1px solid #dee2e6;
    word-break: break-all;
    max-width: 100%;
    overflow-x: auto;
}

.sequence-info {
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 5px;
    font-style: italic;
}

.config-info {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    border-left: 4px solid #2196f3;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.progress-section {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f7;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
}

.progress-log {
    background: #1d1d1f;
    color: #f5f5f7;
    padding: 15px;
    border-radius: 5px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.4;
}

.progress-log .stage {
    color: #007AFF;
    font-weight: bold;
}

.progress-log .success {
    color: #34C759;
}

.progress-log .error {
    color: #FF3B30;
}

.progress-log .info {
    color: #FF9500;
}



.spinner {
    border: 4px solid #f5f5f7;
    border-top: 4px solid #007AFF;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.example-prompts {
    margin-top: 20px;
}

.example-btn {
    background: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin: 5px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
}

.example-btn:hover {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

.error {
    background: #FFE5E5;
    color: #D70015;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #FFB3B3;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

.success {
    background: #E5F9E5;
    color: #248A3D;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #B3E5B3;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

.real-time-logs {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.real-time-logs h3 {
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    letter-spacing: 0.5px;
}

.logs-container {
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.log-entry {
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f8f9fa;
    border-left: 3px solid #dee2e6;
    transition: all 0.2s ease;
}

.log-entry:hover {
    background: #e9ecef;
    border-left-color: #6c757d;
}

.log-info {
    color: #0d6efd;
    font-weight: 500;
}

.log-success {
    color: #198754;
    font-weight: 600;
}

.log-error {
    color: #dc3545;
    font-weight: 600;
}

.log-warning {
    color: #fd7e14;
    font-weight: 600;
}



@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .logo {
        font-size: 2.5rem;
    }
}

/* Structure viewer styles */
.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

#structureViewer {
    background: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 1;
}

#structureSelector {
    width: 100%;
    padding: 8px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

#structureInfo p {
    margin: 5px 0;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    overflow-wrap: anywhere;
}

#structureInfo strong {
    color: #007AFF;
}

/* make long sequences wrap inside the Structure Information panel */
#structureInfo { 
    overflow-wrap: anywhere;   /* modern */
    word-wrap: break-word;     /* legacy fallback */
}

#sequenceInfo {
    display: inline-block;     /* lets width/wrapping apply properly */
    max-width: 100%;
    white-space: normal;       /* ensure it's not prevented from wrapping */
    overflow-wrap: anywhere;   /* prefer breaking between any characters */
    word-break: break-word;    /* additional fallback */
}

/* Maintenance banner (fixed so it always shows) */
.maintenance-banner {
position: fixed;
top: 0; left: 0; right: 0;
z-index: 9999;
background: linear-gradient(90deg, #FF3B30, #FF9F0A);
color: #fff;
display: flex;
gap: 10px;
align-items: center;
justify-content: center;
padding: 12px 16px;
font-weight: 600;
letter-spacing: .2px;
box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
border-bottom: 1px solid rgba(0,0,0,.1);
}
body.has-maintenance { padding-top: 56px; } /* avoid overlap with header */

#adminModelCard h2::after {
    content: "admin";
    font-size: .7rem;
    color: #fff;
    background: linear-gradient(45deg,#ff7a18,#af002d 70%);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}

#adminModelSelectGroup label::after {
    content: " admin";
    font-size: .7rem;
    color: #fff;
    background: linear-gradient(45deg,#ff7a18,#af002d 70%);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

/* admin upload progress */
.progress { background:#eee; height:10px; border-radius:6px; overflow:hidden; margin-top:8px; }
.progress > span { display:block; height:100%; width:0%; background: linear-gradient(45deg,#007AFF,#5856D6); transition: width .15s ease; }
#adminUploadStatus .mini { width:24px; height:24px; border-width:3px; margin:8px auto; }
#adminUploadStatus .center { text-align:center; font-size:.9rem; color:#666; }

/* --- Modal styles --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 9997;
}
.modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(960px, 95vw); max-height: 80vh; overflow: hidden;
    background: #fff; border: 1px solid rgba(0,0,0,.08); border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0,0,0,.2); z-index: 9998;
    display: none;
}
.modal-header, .modal-footer {
    padding: 12px 16px; border-bottom: 1px solid #eee; display:flex; align-items:center; justify-content:space-between;
}
.modal-footer { border-top: 1px solid #eee; border-bottom: none; }
.modal-body { padding: 12px 16px; overflow: auto; max-height: calc(80vh - 110px); }
.modal-close {
    background: transparent; border: none; font-size: 20px; cursor: pointer; color: #666; border-radius: 6px;
}
.modal-close:hover { background: #f5f5f7; }
.table-scroll { overflow: auto; border: 1px solid #e9ecef; border-radius: 8px; }
.table {
    width: 100%; border-collapse: collapse; font-size: 0.92rem;
    font-family: 'SF Pro Text','Helvetica Neue',Arial,sans-serif;
}
.table th, .table td {
    padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top;
}
.table th { background: #f8f9fa; font-weight: 600; white-space: nowrap; }
.table tr:hover { background: #fafafa; }
.code-cell {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: .85rem; background: #f8f9fa; border: 1px solid #eee; border-radius: 4px; padding: 4px 6px;
}
/* Checkbox row */
.checkbox-field {
    display: flex;
    align-items: flex-start;    /* keeps the box aligned with title top */
    gap: 10px;
}

.checkbox-field input[type="checkbox"] {
    width: 18px; height: 18px; margin-top: 2px;   /* tidy sizing */
}

.checkbox-copy { line-height: 1.35; }

.checkbox-title {
    font-weight: 600;
    color: #1d1d1f;
    display: inline-block;      /* lets the label sit on its own line */
    margin-bottom: 4px;
}

.checkbox-help {
    color: #666;
    font-size: .85rem;
    max-width: 48ch;            /* wraps nicely in your two-column layout */
}