/* Container and Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Section */
.header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 3px solid #e9ecef;
}

.header-section h2 {
  margin: 0;
  color: #2c3e50;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Button Styles */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px);
}

/* Advanced 3D Viewer Section */
.viewers-section {
  margin-bottom: 40px;
}

.viewer-card {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.viewer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.viewer-card.full-width {
  width: 100%;
}

.viewer-header {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #dee2e6;
}

.viewer-header h4 {
  margin: 0;
  color: #495057;
  font-size: 1.3rem;
  font-weight: 600;
}

.viewer-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.control-btn {
  background: white;
  color: #28a745;
  border: 2px solid #28a745;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: #28a745;
  color: white;
  transform: scale(1.05);
}

.expand-btn {
  background: white;
  color: #007bff;
  border: 2px solid #007bff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.expand-btn:hover {
  background: #007bff;
  color: white;
  transform: scale(1.05);
}

/* Mol* Container Styling */
.molstar-container {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.molstar-container.main-viewer {
  height: 500px;
}

.molstar-container.modal-viewer {
  height: calc(100vh - 140px);
}

.viewer-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-size: 1rem;
  font-weight: 500;
  color: #495057;
}

.viewer-footer {
  padding: 15px 25px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.viewer-info {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.info-item .label {
  font-weight: 600;
  color: #6c757d;
  font-size: 0.9rem;
}

.info-item .value {
  color: #495057;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.9rem;
}

/* Enhanced Analysis Section */
.analysis-section {
  margin-bottom: 50px;
  position: relative;
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding: 0;
  border: none;
}

.analysis-title {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0;
}

.analysis-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 2px solid #dee2e6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #495057;
  font-size: 1.2rem;
}

.analysis-title h4 {
  color: #2d3748;
  font-weight: 600;
  margin: 0;
  font-size: 1.3rem;
}

.analysis-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: #495057;
}

.action-btn:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #212529;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn.btn-outline-primary:hover {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.analysis-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.analysis-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-color: #adb5bd;
}

.analysis-content {
  padding: 30px;
  line-height: 1.6;
  color: #495057;
  font-size: 1rem;
}

.analysis-content p {
  margin-bottom: 16px;
}

.analysis-content p:last-child {
  margin-bottom: 0;
}

.analysis-stats {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.stat-item {
  flex: 1;
  text-align: center;
  padding: 15px;
  background: #f7fafc;
  border-radius: 8px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: #718096;
  font-weight: 500;
}

/* Docking Section */
.docking-section {
  margin-bottom: 40px;
}

.docking-form {
  display: flex;
  gap: 15px;
  align-items: end;
  flex-wrap: wrap;
}

.docking-form .form-select {
  flex: 1;
  min-width: 250px;
  padding: 12px 16px;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.95rem;
}

.docking-form .btn {
  white-space: nowrap;
}

/* Enhanced Visuals Section */
.visuals-section {
  margin-bottom: 50px;
  position: relative;
}

.visuals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding: 20px 0 15px 0;
  border-bottom: 2px solid #f0f2f5;
}

.visuals-title {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0;
}

.visuals-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
  animation: pulse-glow 2s infinite;
}

.visuals-title h4 {
  color: #2d3748;
  font-weight: 700;
  margin: 0;
  font-size: 1.4rem;
}

.view-toggle {
  display: flex;
  background: #f7fafc;
  border-radius: 10px;
  padding: 4px;
  border: 2px solid #e2e8f0;
}

.toggle-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.85rem;
  color: #718096;
}

.toggle-btn.active {
  background: white;
  color: #4facfe;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px solid #e9ecef;
}

.filter-tabs {
  display: flex;
  gap: 8px;
}

.filter-tab {
  padding: 6px 12px;
  border: 2px solid #dee2e6;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c757d;
}

.filter-tab.active {
  background: #4facfe;
  color: white;
  border-color: #4facfe;
}

.filter-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-info {
  margin-left: auto;
  color: #6c757d;
  font-size: 0.85rem;
  font-weight: 500;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.image-gallery.filtering {
  opacity: 0.6;
}

.image-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
}

.image-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  border-color: #4facfe;
}

.image-card[data-category] {
  animation: fadeInUp 0.5s ease-out;
}

.image-card.hidden {
  display: none;
}

.image-wrapper {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.image-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  z-index: 1;
  pointer-events: none;
}

.image-card:hover .image-wrapper::before {
  transform: translateX(100%);
}

.image-wrapper img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  padding: 20px;
  transition: all 0.4s ease;
}

.image-card:hover .image-wrapper img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.9), rgba(0, 242, 254, 0.9));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s ease;
  color: white;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

.image-card:hover .image-overlay {
  opacity: 1;
}

.image-overlay .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  animation: bounce 2s infinite;
}

.image-overlay .overlay-text {
  font-size: 1.1rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-caption {
  padding: 20px;
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa, #ffffff);
  border-top: 1px solid #e9ecef;
  position: relative;
}

.image-caption::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  transform: translateX(-50%);
  border-radius: 2px;
}

.image-caption strong {
  color: #2d3748;
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

.image-meta {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.meta-item {
  color: #718096;
  display: flex;
  align-items: center;
  gap: 4px;
}

.image-category-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.95);
  color: #4facfe;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(79, 172, 254, 0.2);
}

/* Metrics Section */
.metrics-section {
  margin-bottom: 40px;
}

.metrics-section h4 {
  margin-bottom: 25px;
  color: #495057;
  font-weight: 600;
}

.metrics-grid {
  display: grid;
  gap: 20px;
}

.metric-card {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.metric-card:hover {
  border-color: #007bff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.metric-header {
  padding: 20px 25px;
  background: #f8f9fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.metric-header:hover {
  background: #e9ecef;
}

.metric-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.metric-icon {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.metric-title h6 {
  margin: 0;
  color: #495057;
  font-weight: 600;
  font-size: 1.1rem;
}

.metric-title small {
  color: #6c757d;
  font-size: 0.85rem;
}

.collapse-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.collapse-btn:hover {
  color: #495057;
  transform: scale(1.1);
}

.chevron {
  transition: transform 0.3s ease;
}

.collapsed .chevron {
  transform: rotate(-90deg);
}

.metric-body {
  padding: 25px;
  border-top: 1px solid #dee2e6;
}

.table-wrapper {
  max-height: 400px;
  overflow: auto;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8f9fa;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td {
  padding: 10px 15px;
  border-bottom: 1px solid #f1f3f4;
  color: #495057;
}

.data-table tr:hover {
  background: #f8f9fa;
}

.table-truncated td {
  text-align: center;
  font-style: italic;
  color: #6c757d;
  background: #f8f9fa !important;
}

.raw-data {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #495057;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

/* Simulation Section */
.simulation-section {
  margin-bottom: 40px;
}

.simulation-section h4 {
  margin-bottom: 25px;
  color: #495057;
  font-weight: 600;
}

.simulation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.simulation-card {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.simulation-card:hover {
  border-color: #28a745;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.sim-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px solid #dee2e6;
}

.sim-info {
  flex: 1;
}

.sim-info h6 {
  margin: 0 0 5px 0;
  color: #495057;
  font-weight: 600;
}

.sim-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
}

.sim-type {
  background: #e3f2fd;
  color: #1976d2;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.sim-size {
  color: #6c757d;
}

/* Viewer Expanded State - FIXED to work with sticky navbar */
.viewer-card.expanded {
  position: fixed;
  top: 70px;
  /* Account for navbar height (60px) + margin */
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 99998;
  /* Just below navbar but above everything else */
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: calc(100vh - 90px);
  /* Ensure it doesn't exceed viewport */
}

.viewer-card.expanded .molstar-container {
  height: calc(100vh - 220px) !important;
  /* Adjusted for navbar and card padding */
}

.viewer-card.expanded .expand-btn {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
  position: relative;
  z-index: 10;
  /* Ensure button stays clickable */
}

.viewer-card.expanded .expand-btn:hover {
  background: #c82333;
  border-color: #c82333;
}

.viewer-card.expanded .expand-btn::after {
  content: ' (Click to Close)';
  font-size: 0.7rem;
}

/* Ensure expanded viewer header is always visible */
.viewer-card.expanded .viewer-header {
  position: relative;
  z-index: 5;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* Add backdrop for expanded viewer */
.viewer-card.expanded::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
  backdrop-filter: blur(2px);
}

/* Professional Image Modal */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99999;
  /* Increased to be above navbar (which is typically 1030-1050) */
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.4s ease;
  padding: 20px;
  /* Reduced padding to account for navbar */
  padding-top: 80px;
  /* Extra top padding to clear the navbar */
  box-sizing: border-box;
}

.image-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: modalSlideIn 0.4s ease;
  max-height: calc(100vh - 80px);
  /* Ensure content doesn't exceed viewport minus navbar space */
}

.modal-image-info {
  position: absolute;
  top: 20px;
  /* Positioned relative to modal content, not viewport */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: #2d3748;
  padding: 12px 24px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 10;
}

.modal-header-controls {
  position: absolute;
  top: 20px;
  /* Positioned relative to modal content */
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 15;
  /* Ensure controls are above the image info */
}

.modal-control-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.modal-control-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.image-close {
  background: rgba(220, 53, 69, 0.8);
  border-color: rgba(220, 53, 69, 0.6);
}

.image-close:hover {
  background: rgba(220, 53, 69, 1);
  border-color: rgba(220, 53, 69, 0.8);
}

.modal-image-container {
  position: relative;
  width: 100%;
  height: calc(100% - 100px);
  /* Account for header space */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 80px;
  /* Space for header controls */
}

#modalImage {
  max-width: 90%;
  max-height: 85%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: white;
  transition: all 0.3s ease;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  z-index: 10;
}

.modal-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.modal-footer {
  position: absolute;
  bottom: 20px;
  /* Positioned relative to modal content */
  right: 30px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 500;
  z-index: 20;
  pointer-events: none;
}

/* Professional zoom effect on hover */
.modal-image-container:hover #modalImage {
  transform: scale(1.02);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Utility Classes */
.error-message {
  text-align: center;
  color: #dc3545;
  padding: 30px;
  background: #f8d7da;
  border: 2px solid #f5c6cb;
  border-radius: 12px;
  margin: 20px;
  font-weight: 600;
}

.text-muted {
  color: #6c757d !important;
}

/* Hide ONLY Mol* Expand/Fullscreen Buttons (Keep Other Controls) */
.molstar-container .msp-btn-expand,
.molstar-container .msp-btn-fullscreen,
.molstar-container button[title*="fullscreen"],
.molstar-container button[title*="Fullscreen"],
.molstar-container button[title*="expand"],
.molstar-container button[title*="Expand"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Preserve Other Mol* Controls */
.molstar-container .msp-plugin {
  border-radius: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.molstar-container .msp-plugin-content {
  border-radius: 0;
}

.molstar-container .msp-control-panel {
  background: rgba(248, 249, 250, 0.95) !important;
  backdrop-filter: blur(8px);
}

.molstar-container .msp-control-group-header {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  color: white !important;
  font-weight: 600 !important;
}

.molstar-container .msp-btn {
  border-radius: 6px !important;
  transition: all 0.3s ease !important;
}

.molstar-container .msp-btn:hover {
  transform: translateY(-1px) !important;
}

/* Animations */
@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }

  50% {
    box-shadow: 0 4px 25px rgba(102, 126, 234, 0.5);
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-10px);
  }

  60% {
    transform: translateY(-5px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .viewer-controls {
    gap: 6px;
  }

  .control-btn,
  .expand-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .image-modal {
    padding: 10px;
    padding-top: 70px;
    /* Adjust for mobile navbar height */
  }

  .header-section {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .viewer-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .viewer-controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  .molstar-container.main-viewer {
    height: 400px;
  }

  .viewer-info {
    flex-direction: column;
    gap: 10px;
  }

  .docking-form {
    flex-direction: column;
  }

  .docking-form .form-select {
    min-width: 100%;
  }

  .image-gallery {
    grid-template-columns: 1fr;
  }

  .simulation-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    top: 1%;
    left: 1%;
    width: 98%;
    height: 98%;
  }

  .modal-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .modal-controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  .analysis-header,
  .visuals-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .analysis-actions,
  .view-toggle {
    justify-content: center;
    flex-wrap: wrap;
  }

  .gallery-controls {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .filter-tabs {
    justify-content: center;
    flex-wrap: wrap;
  }

  .analysis-stats {
    flex-direction: column;
    gap: 10px;
  }



  .modal-image-info {
    top: 10px;
    font-size: 0.8rem;
    padding: 8px 16px;
  }

  .modal-header-controls {
    top: 10px;
    right: 10px;
    gap: 8px;
  }

  .modal-control-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .modal-image-container {
    margin-top: 60px;
    height: calc(100% - 80px);
  }

  #modalImage {
    max-width: 95%;
    max-height: 80%;
  }

  .modal-nav {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  .modal-nav.prev {
    left: 10px;
  }

  .modal-nav.next {
    right: 10px;
  }

  .modal-footer {
    bottom: 15px;
    right: 15px;
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .metric-title {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .simulation-card {
    flex-direction: column;
    text-align: center;
  }

  .sim-meta {
    justify-content: center;
  }

  .analysis-content {
    padding: 20px;
    font-size: 1rem;
  }

  .image-wrapper img {
    height: 220px;
  }

  .image-modal {
    padding: 5px;
    padding-top: 65px;
  }

  .modal-image-info {
    top: 5px;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 15px;
  }

  .modal-header-controls {
    top: 5px;
    right: 5px;
  }

  .modal-control-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .modal-image-container {
    margin-top: 50px;
    height: calc(100% - 70px);
  }

  .modal-nav {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

/* Focus States for Accessibility */
button:focus,
.btn:focus,
.control-btn:focus,
.expand-btn:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
}

/* Loading Animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.spinner-border {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(0, 123, 255, 0.2);
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  .molstar-container {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }

  .image-card img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark Mode Support (Future Enhancement) */
/* @media (prefers-color-scheme: dark) {
  .molstar-container {
    filter: invert(1) hue-rotate(180deg);
  }
} */

/* Print Styles */
@media print {

  .fullscreen-modal,
  .image-modal {
    display: none !important;
  }

  .viewer-controls,
  .header-actions {
    display: none;
  }

  .molstar-container {
    height: 400px !important;
    border: 2px solid #ddd;
  }

  .page-break {
    page-break-before: always;
  }
}

/* Performance Optimizations */
.molstar-container * {
  will-change: auto;
}

.image-card,
.metric-card,
.simulation-card {
  contain: layout style paint;
}

/* Advanced Visual Effects */
.viewer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
  z-index: 1;
}

.viewer-card:hover::before {
  transform: translateX(100%);
}

/* Custom Scrollbars */
.table-wrapper::-webkit-scrollbar,
.raw-data::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track,
.raw-data::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.raw-data::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.raw-data::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}