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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.search-box input {
  flex: 1;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: #4a6cf7;
}

.search-box button {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: #4a6cf7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-box button:hover {
  background: #3651d4;
}

.search-box button:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Author Results */
.author-results {
  max-width: 600px;
  margin: 1rem auto 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1rem;
}

.author-results h3 {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.author-results ul {
  list-style: none;
}

.author-results li {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #eee;
}

.author-results li:last-child {
  border-bottom: none;
}

.author-results li:hover {
  background: #f0f4ff;
}

.author-results .author-name {
  font-weight: 600;
  color: #1a1a2e;
}

.author-results .author-meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #eee;
  border-top-color: #4a6cf7;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

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

/* Error */
.error {
  text-align: center;
  padding: 2rem;
  background: #fff0f0;
  border-radius: 8px;
  color: #c53030;
}

.error button {
  margin-top: 1rem;
  padding: 0.5rem 1.5rem;
  background: #c53030;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Results */
.results {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 2rem;
}

.citeiq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #eee;
}

.citeiq-header h2 {
  font-size: 1.5rem;
  color: #1a1a2e;
}

.citeiq-scores {
  display: flex;
  gap: 2rem;
}

.citeiq-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
}

.citeiq-score.primary {
  background: #f0f4ff;
  border-radius: 8px;
}

.citeiq-score.comparison {
  background: #f5f7fa;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.citeiq-score .label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.citeiq-score .value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #4a6cf7;
}

.citeiq-score.primary .value {
  color: #2d3a8c;
}

.citeiq-score.comparison .value {
  color: #666;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #f5f7fa;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.stat-card.warning .stat-value {
  color: #c53030;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a2e;
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
}

/* Papers Table */
.papers-section h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.toggle-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  background: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#papers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#papers-table th,
#papers-table td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

#papers-table th {
  font-weight: 600;
  color: #666;
  font-size: 0.8rem;
  text-transform: uppercase;
}

#papers-table tr.retracted {
  background: #fff5f5;
}

#papers-table tr.deindexed {
  background: #fffbeb;
  text-decoration: line-through;
  color: #999;
}

#papers-table .status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  font-weight: 600;
}

#papers-table .status-badge.ok {
  background: #d4edda;
  color: #155724;
}

#papers-table .status-badge.retracted {
  background: #f8d7da;
  color: #721c24;
}

#papers-table .status-badge.deindexed {
  background: #fff3cd;
  color: #856404;
}

.paper-title {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Meta Info */
.meta-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #666;
}

.meta-info button {
  padding: 0.4rem 1rem;
  background: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Methodology Section */
.methodology {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin: 3rem 0;
}

.methodology h2 {
  font-size: 2rem;
  color: #1a1a2e;
  margin-bottom: 1.5rem;
  text-align: center;
}

.methodology-content {
  max-width: 800px;
  margin: 0 auto;
}

.methodology-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

.methodology-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.methodology-section h3 {
  font-size: 1.3rem;
  color: #2d3a8c;
  margin-bottom: 1rem;
}

.methodology-section p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.methodology-section ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.methodology-section li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.formula {
  background: #f0f4ff;
  border-left: 4px solid #4a6cf7;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
}

.formula strong {
  color: #2d3a8c;
}

.formula em {
  color: #4a6cf7;
  font-style: italic;
}

.formula-example {
  background: #f5f7fa;
  border-left: 4px solid #999;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.8;
}

.comparison-example {
  background: #fffbeb;
  border-left: 4px solid #fbbf24;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.8;
}

.methodology-section a {
  color: #4a6cf7;
  text-decoration: none;
}

.methodology-section a:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #ddd;
  color: #666;
  font-size: 0.85rem;
  line-height: 1.8;
}

footer p {
  margin: 0.25rem 0;
}

footer a {
  color: #4a6cf7;
  text-decoration: none;
}

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

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .search-box {
    flex-direction: column;
  }

  .citeiq-header {
    flex-direction: column;
    text-align: center;
  }

  .citeiq-score {
    align-items: center;
  }

  #papers-table {
    font-size: 0.8rem;
  }

  #papers-table th,
  #papers-table td {
    padding: 0.5rem 0.25rem;
  }

  .methodology {
    padding: 1.5rem 1rem;
  }

  .methodology h2 {
    font-size: 1.5rem;
  }

  .methodology-section h3 {
    font-size: 1.1rem;
  }

  .formula,
  .formula-example,
  .comparison-example {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}
