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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  color: #2d3748;
}

.subtitle {
  color: #718096;
  font-size: 1.1em;
  margin-bottom: 20px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

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

.btn-primary:hover {
  background: #5a67d8;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #cbd5e0;
}

.btn-success {
  background: #48bb78;
  color: white;
}

.btn-success:hover {
  background: #38a169;
}

.btn-danger {
  background: #f56565;
  color: white;
}

.btn-danger:hover {
  background: #e53e3e;
}

.controls {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-stock h2 {
  margin-bottom: 15px;
  color: #2d3748;
  font-size: 1.3em;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.search-box input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.search-box input:focus {
  outline: none;
  border-color: #667eea;
}

.search-results {
  margin-top: 15px;
}

.search-result-item {
  padding: 12px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

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

.stock-info {
  display: flex;
  flex-direction: column;
}

.stock-code {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
}

.stock-name {
  color: #718096;
  font-size: 0.9em;
}

.hidden {
  display: none;
}

#addStockInput {
  margin-top: 15px;
  padding: 15px;
  background: #f7fafc;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

#addStockInput input {
  padding: 10px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
}

.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.stock-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.stock-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.stock-title h3 {
  font-size: 1.4em;
  color: #2d3748;
  margin-bottom: 5px;
}

.stock-title .code {
  color: #718096;
  font-size: 0.9em;
}

.delete-btn {
  background: transparent;
  border: none;
  color: #e53e3e;
  cursor: pointer;
  font-size: 20px;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.2s;
}

.delete-btn:hover {
  background: #fed7d7;
}

.stock-price {
  display: flex;
  align-items: baseline;
  gap: 15px;
  margin-bottom: 15px;
}

.price {
  font-size: 2em;
  font-weight: 700;
  color: #2d3748;
}

.change {
  font-size: 1.1em;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.change.positive {
  color: #38a169;
  background: #f0fff4;
}

.change.negative {
  color: #e53e3e;
  background: #fff5f5;
}

.market-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 15px 0;
  border-top: 1px solid #e2e8f0;
  margin-bottom: 15px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 0.8em;
  color: #718096;
  margin-bottom: 4px;
}

.info-value {
  font-size: 1em;
  font-weight: 600;
  color: #2d3748;
}

.news-section {
  margin-top: 20px;
}

.news-section h4 {
  font-size: 1.1em;
  color: #2d3748;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.news-item {
  padding: 15px;
  margin-bottom: 12px;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 4px solid #cbd5e0;
  transition: background 0.2s;
}

.news-item:hover {
  background: #edf2f7;
}

.news-item.positive {
  border-left-color: #38a169;
}

.news-item.negative {
  border-left-color: #e53e3e;
}

.news-item.neutral {
  border-left-color: #718096;
}

.news-title {
  font-size: 0.95em;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-title a {
  color: inherit;
  text-decoration: none;
}

.news-title a:hover {
  color: #667eea;
}

.news-content {
  font-size: 0.85em;
  color: #718096;
  margin-bottom: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8em;
  color: #a0aec0;
}

.impact-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75em;
}

.impact-badge.positive {
  background: #c6f6d5;
  color: #22543d;
}

.impact-badge.negative {
  background: #fed7d7;
  color: #742a2a;
}

.impact-badge.neutral {
  background: #e2e8f0;
  color: #4a5568;
}

footer {
  background: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  color: #718096;
  font-size: 0.9em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#lastUpdate {
  color: #667eea;
  font-weight: 600;
}

.loading {
  text-align: center;
  padding: 40px;
  color: white;
  font-size: 1.2em;
  grid-column: 1 / -1;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: white;
  font-size: 1.1em;
  grid-column: 1 / -1;
}

.search-input-group {
  display: flex;
  gap: 10px;
}

.search-input-group input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
}

.search-input-group input:focus {
  outline: none;
  border-color: #667eea;
}

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

  header h1 {
    font-size: 1.8em;
  }

  .price {
    font-size: 1.6em;
  }
}