/* 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: 1200px;
  margin: 0 auto;
  padding: 20px;
}

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

.header-content h1 {
  font-size: 3.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-content p {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 20px;
}

.health-indicator {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.health-indicator.healthy {
  background: rgba(40, 167, 69, 0.3);
}

.health-indicator.unhealthy {
  background: rgba(220, 53, 69, 0.3);
}

/* Navigation Menu */
.main-navigation {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  color: white;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.nav-link i {
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .main-navigation {
    gap: 0.5rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Main content */
.main-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
  margin-bottom: 40px;
}

/* Input section */
.input-section {
  margin-bottom: 40px;
}

.input-container h2 {
  color: #4a5568;
  margin-bottom: 30px;
  font-size: 1.8rem;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 30px;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 1rem;
  color: #718096;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-button:hover {
  color: #4299e1;
  background: rgba(66, 153, 225, 0.05);
}

.tab-button.active {
  color: #4299e1;
  border-bottom-color: #4299e1;
  background: rgba(66, 153, 225, 0.05);
}

.tab-content {
  display: none;
}

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

/* Input groups */
.input-group {
  margin-bottom: 30px;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 8px;
}

textarea, select, input[type="text"] {
  width: 100%;
  padding: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  resize: vertical;
}

textarea:focus, select:focus, input[type="text"]:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.input-info {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #718096;
}

/* File upload */
.file-upload-area {
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.file-upload-area:hover {
  border-color: #4299e1;
  background: rgba(66, 153, 225, 0.05);
}

.file-upload-area.drag-over {
  border-color: #4299e1;
  background: rgba(66, 153, 225, 0.1);
}

.file-upload-area input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-content {
  pointer-events: none;
}

.file-upload-content i {
  color: #a0aec0;
  margin-bottom: 15px;
}

.file-upload-content p {
  margin-bottom: 10px;
  color: #4a5568;
}

.file-link {
  color: #4299e1;
  text-decoration: underline;
}

.file-list {
  margin-top: 15px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: #f7fafc;
  border-radius: 8px;
  margin-bottom: 5px;
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-remove {
  background: none;
  border: none;
  color: #e53e3e;
  cursor: pointer;
  padding: 5px;
}

/* Style selection */
.style-selection {
  background: #f7fafc;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
}

.style-selection h3 {
  color: #4a5568;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Style search */
.style-search {
  margin-bottom: 25px;
}

.search-input-container {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.search-input-container input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
}

.search-btn {
  background: #4299e1;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-btn:hover {
  background: #3182ce;
}

.style-search-results {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  display: none;
}

.style-search-results.show {
  display: block;
}

.search-result-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result-item:hover {
  background: #f8fafc;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-info h4 {
  margin: 0 0 4px 0;
  color: #2d3748;
  font-size: 0.95rem;
  font-weight: 600;
}

.search-result-info p {
  margin: 0;
  color: #718096;
  font-size: 0.85rem;
}

.search-result-actions {
  display: flex;
  gap: 8px;
}

.install-btn {
  background: #38a169;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.install-btn:hover {
  background: #2f855a;
}

.install-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.available-badge {
  background: #48bb78;
  color: white;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Popular styles */
.popular-styles {
  margin-bottom: 25px;
}

.popular-styles h4 {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.popular-styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.popular-style-item {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.popular-style-item:hover {
  border-color: #4299e1;
  background: #ebf8ff;
}

.popular-style-item.selected {
  border-color: #4299e1;
  background: #ebf8ff;
}

.popular-style-item h5 {
  margin: 0 0 6px 0;
  color: #2d3748;
  font-size: 0.9rem;
  font-weight: 600;
}

.popular-style-item p {
  margin: 0;
  color: #718096;
  font-size: 0.8rem;
}

/* Selected style */
.selected-style {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-style label {
  color: #4a5568;
  font-weight: 600;
  white-space: nowrap;
}

.selected-style select {
  flex: 1;
}

.icon-btn {
  background: #718096;
  color: white;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.icon-btn:hover {
  background: #4a5568;
}

/* Style categories */
.style-category {
  display: inline-block;
  background: #edf2f7;
  color: #4a5568;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-left: 8px;
}

.style-category.author-date {
  background: #bee3f8;
  color: #2c5aa0;
}

.style-category.numeric {
  background: #c6f6d5;
  color: #2f855a;
}

.style-category.note {
  background: #fbb6ce;
  color: #97266d;
}

/* Process button */
.process-btn {
  width: 100%;
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: white;
  border: none;
  padding: 18px 30px;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.process-btn:hover {
  background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(65, 153, 225, 0.3);
}

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

.process-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Results section */
.results-section {
  border-top: 3px solid #e2e8f0;
  padding-top: 40px;
}

.results-section h2 {
  color: #2d3748;
  margin-bottom: 30px;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.processing-info {
  background: #e6fffa;
  border-left: 4px solid #38b2ac;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 30px;
  color: #234e52;
}

.citation-group {
  margin-bottom: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.citation-group h3 {
  background: #f7fafc;
  padding: 20px;
  color: #2d3748;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  margin: 0;
}

.citation-group h3 i {
  margin-right: 10px;
}

.citation-content {
  padding: 25px;
  background: white;
  min-height: 80px;
}

.citation-item {
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 4px solid #4299e1;
}

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

/* Copy and export buttons */
.copy-btn, .export-btn {
  background: #4299e1;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn:hover, .export-btn:hover {
  background: #3182ce;
  transform: translateY(-1px);
}

.export-options {
  background: #f7fafc;
  padding: 25px;
  border-radius: 12px;
  margin-top: 30px;
}

.export-options h3 {
  color: #2d3748;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.export-btn {
  background: #38a169;
}

.export-btn:hover {
  background: #2f855a;
}

/* Loading spinner */
.spinner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  color: #4a5568;
}

.spinner-content i {
  color: #4299e1;
  margin-bottom: 20px;
}

.spinner-content p {
  font-size: 1.2rem;
  font-weight: 500;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
}

.toast {
  background: #48bb78;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

.toast.error {
  background: #e53e3e;
}

.toast.warning {
  background: #d69e2e;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Footer */
.footer {
  text-align: center;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
}

.footer a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .header-content h1 {
    font-size: 2.5rem;
  }
  
  .main-content {
    padding: 25px;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab-button {
    flex: 1;
    min-width: 120px;
  }
  
  .export-buttons {
    justify-content: center;
  }
  
  .toast {
    min-width: auto;
    max-width: calc(100vw - 40px);
  }
}

@media (max-width: 480px) {
  .header-content h1 {
    font-size: 2rem;
  }
  
  .main-content {
    padding: 20px;
  }
  
  .tab-button {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}
