/* Protein Structure Explorer - Styles */

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

:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #475569;
  --text-bright: #1e293b;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --green: #22c55e;
  --orange: #f97316;
  --yellow: #eab308;
  --purple: #8b5cf6;
  --success: #22c55e;
  --error: #ef4444;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
nav {
  background: #ffffff;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-bright);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text-bright);
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  color: var(--text-bright);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.header p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.panel h2 {
  color: var(--text-bright);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* Input Panel */
.input-panel {
  display: flex;
  flex-direction: column;
}

/* Example Selector */
.example-selector {
  margin-bottom: 16px;
}

.example-selector label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.example-selector select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-bright);
  cursor: pointer;
}

.example-selector select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Sequence Input */
.sequence-input {
  margin-bottom: 16px;
}

.sequence-input label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.sequence-input textarea {
  width: 100%;
  padding: 12px;
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Consolas', monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-bright);
  resize: vertical;
  min-height: 120px;
}

.sequence-input textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.sequence-input textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.sequence-info {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
}

#sequence-length {
  color: var(--muted);
}

#sequence-validity {
  font-weight: 500;
}

#sequence-validity.valid {
  color: var(--success);
}

#sequence-validity.invalid {
  color: var(--error);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary);
}

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

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

.btn-icon {
  font-size: 1.1rem;
}

/* Viewer Panel */
.viewer-panel {
  display: flex;
  flex-direction: column;
}

.viewer-container {
  flex: 1;
  min-height: 500px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.viewer-header h2 {
  margin: 0;
  padding: 0;
  border: none;
}

.viewer-controls select {
  padding: 6px 10px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

#mol-viewer {
  width: 100%;
  height: 450px;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* Viewer Legend */
.viewer-legend {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}

.legend-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.legend-bar {
  margin-bottom: 4px;
}

.legend-gradient {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(to right,
    #ef4444 0%,
    #f59e0b 25%,
    #eab308 50%,
    #84cc16 75%,
    #22c55e 100%
  );
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}

.legend-description {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-top: 4px;
}

.legend-low {
  color: #ef4444;
}

.legend-high {
  color: #22c55e;
}

/* Results Content */
#results-content,
#similarity-content,
#structure-info-content {
  font-size: 0.9rem;
}

.result-item {
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 10px;
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.result-value {
  color: var(--text-bright);
  font-weight: 500;
}

.result-value.good {
  color: var(--success);
}

.result-value.medium {
  color: var(--orange);
}

.result-value.poor {
  color: var(--error);
}

/* Similar Protein Cards */
.similar-protein {
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 3px solid var(--primary);
}

.similar-protein-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.similar-protein-name {
  font-weight: 500;
  color: var(--text-bright);
}

.similar-protein-score {
  font-size: 0.8rem;
  padding: 2px 8px;
  background: rgba(96, 165, 250, 0.2);
  color: var(--primary);
  border-radius: 12px;
}

.similar-protein-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.similar-protein-id {
  font-family: monospace;
  color: var(--purple);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

#loading-message {
  color: var(--text-bright);
  font-size: 1rem;
}

/* Error Message */
.error-message {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: var(--error);
  font-size: 0.9rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

footer a:hover {
  text-decoration: underline;
}

.disclaimer {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #64748b;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .nav-links {
    display: none;
  }

  #mol-viewer {
    height: 350px;
  }
}
