/* ===== MOLECULE VISUALIZER STYLES ===== */

/* === LOADING SCREEN === */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

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

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* === APP HEADER === */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 0;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #1f2937;
}

.app-title i {
  font-size: 1.5rem;
  color: #667eea;
}

.app-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* === MAIN LAYOUT === */
.app-main {
  display: flex;
  height: 100vh;
  margin-top: 80px;
}

/* === CONTROLS PANEL === */
.controls-panel {
  width: 320px;
  min-width: 320px;
  height: calc(100vh - 80px);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  overflow-y: auto;
  transition: transform 0.3s ease;
  position: relative;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
}

.controls-panel.collapsed {
  transform: translateX(-290px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.25);
  z-index: 10;
}

.panel-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

.panel-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  color: #6b7280;
}

.panel-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #1f2937;
}

.controls-panel.collapsed .panel-toggle i {
  transform: rotate(180deg);
}

.panel-content {
  padding: 1rem;
}

/* === CONTROL GROUPS === */
.control-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.control-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.control-group > label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #1f2937;
}

/* === SEARCH CONTAINER === */
.search-container {
  display: flex;
  gap: 0.5rem;
}

.search-container input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: #1f2937;
  font-size: 0.875rem;
}

.search-container input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-container input::placeholder {
  color: #9ca3af;
}

/* === MOLECULE GRID === */
.molecule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.molecule-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.molecule-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.molecule-item.active {
  background: rgba(102, 126, 234, 0.2);
  border-color: #667eea;
  color: #667eea;
}

.molecule-icon {
  width: 40px;
  height: 40px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #667eea;
  font-size: 1.125rem;
}

.molecule-name {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  color: #1f2937;
}

.molecule-formula {
  font-size: 0.625rem;
  color: #6b7280;
  text-align: center;
  font-family: 'Courier New', monospace;
}

/* === BUTTON GROUPS === */
.button-group {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.button-group .btn {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.5rem 0.25rem;
}

.button-group .btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* === SELECT INPUTS === */
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: #1f2937;
  font-size: 0.875rem;
}

select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === SLIDER CONTAINER === */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #6b7280;
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
  width: auto;
}

.slider-input {
  margin-bottom: 0.75rem;
}

.slider-input label {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.slider-input input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.slider-input input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-input input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* === VIEWER CONTAINER === */
.viewer-container {
  flex: 1;
  position: relative;
  background: #f8fafc;
  overflow: hidden;
}

.molecule-viewer {
  width: 100%;
  height: 100%;
  position: relative;
}

.molecule-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* === VIEWER INFO === */
.viewer-info {
  position: absolute;
  top: 1rem;
  left: 1rem;
  min-width: 250px;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

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

.info-label {
  font-weight: 500;
  color: #6b7280;
  font-size: 0.875rem;
}

.info-value {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.875rem;
}

/* === VIEWER CONTROLS === */
.viewer-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #1f2937;
}

.control-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.05);
}

/* === MODAL STYLES === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.3s ease;
  padding: 0.5rem;
  border-radius: 0.5rem;
}

.modal-close:hover {
  color: #1f2937;
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

/* === HELP SECTIONS === */
.help-section {
  margin-bottom: 1.5rem;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.help-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-section li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.875rem;
  color: #374151;
}

.help-section li:last-child {
  border-bottom: none;
}

.help-section strong {
  color: #667eea;
  font-weight: 600;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  background: transparent;
}

.btn-primary {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.btn-primary:hover {
  background: #5a67d8;
  border-color: #5a67d8;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #1f2937;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #667eea;
}

.btn-ghost {
  color: #6b7280;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #1f2937;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
  .controls-panel {
    width: 280px;
    min-width: 280px;
  }
  
  .molecule-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-main {
    flex-direction: column;
    margin-top: 70px;
  }
  
  .controls-panel {
    width: 100%;
    height: 250px;
    order: 2;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
  }
  
  .controls-panel.collapsed {
    transform: translateY(200px);
  }
  
  .viewer-container {
    order: 1;
    height: calc(100vh - 320px);
  }
  
  .viewer-info {
    position: relative;
    top: 0;
    left: 0;
    margin: 1rem;
    width: auto;
  }
  
  .viewer-controls {
    position: relative;
    bottom: 0;
    right: 0;
    flex-direction: row;
    justify-content: center;
    margin: 1rem;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .app-title h1 {
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 0.5rem 0;
  }
  
  .app-main {
    margin-top: 60px;
  }
  
  .panel-content {
    padding: 0.75rem;
  }
  
  .control-group {
    margin-bottom: 1rem;
  }
  
  .molecule-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
  
  .modal-body {
    padding: 1rem;
  }
}

/* === ANIMATIONS === */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.molecule-item {
  animation: fadeInUp 0.3s ease-out;
}

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

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* === PRINT STYLES === */
@media print {
  .controls-panel,
  .viewer-controls,
  .app-header {
    display: none !important;
  }
  
  .viewer-container {
    width: 100%;
    height: 100vh;
  }
  
  .viewer-info {
    position: static;
    margin: 0;
    background: white;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}