/* ============================================
   新闻聚合系统 - 全局样式
   ============================================ */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --accent: #ea4335;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(60, 64, 67, 0.1);
  --shadow-hover: 0 4px 16px rgba(60, 64, 67, 0.15);
  --highlight-bg: #fff3cd;
  --highlight-border: #ffc107;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* News List */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.news-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: var(--border);
}

.news-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-card-summary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.news-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.news-source {
  background: #e8f0fe;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.news-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* News Detail */
.news-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.news-detail-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.news-detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
}

.news-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.news-detail-source {
  background: #e8f0fe;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
}

/* TTS Controls */
.tts-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  padding: 16px;
  background: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tts-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tts-btn-play {
  background: var(--primary);
  color: white;
}

.tts-btn-play:hover {
  background: var(--primary-dark);
}

.tts-btn-pause {
  background: #fbbc04;
  color: #333;
}

.tts-btn-stop {
  background: var(--accent);
  color: white;
}

.tts-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tts-status {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.tts-status.speaking {
  color: var(--primary);
  font-weight: 600;
}

/* News Content */
.news-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.news-content p {
  margin-bottom: 16px;
}

/* Highlighted Keywords */
mark.highlight {
  background: var(--highlight-bg);
  border-bottom: 2px solid var(--highlight-border);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 500;
  color: #856404;
}

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Error */
.error-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--accent);
}

.error-message button {
  margin-top: 12px;
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  .news-detail {
    padding: 20px;
  }

  .news-detail-title {
    font-size: 1.3rem;
  }

  .tts-controls {
    flex-wrap: wrap;
  }
}
