* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-top: 0.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid #333;
}

.tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab:hover {
  color: #ccc;
}

.tab-content {
  margin-bottom: 1rem;
}

/* Search */
.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-results {
  background: #16213e;
  border-radius: 8px;
  margin-top: 0.5rem;
}

.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #2a2a4a;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #1f3460;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item .title {
  font-weight: 600;
  color: #667eea;
}

.search-result-item .description {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Inputs */
input[type="text"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #eee;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #667eea;
}

.language-select {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.language-select label {
  color: #888;
  white-space: nowrap;
}

.language-select select {
  width: auto;
  min-width: 150px;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #2a2a4a;
  color: #ccc;
}

.btn-secondary:hover {
  background: #3a3a5a;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: #c0392b;
}

#generate-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem;
  font-size: 1.1rem;
}

/* Loading */
#loading {
  text-align: center;
  padding: 3rem 0;
}

.loader {
  width: 50px;
  height: 50px;
  border: 4px solid #333;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* Result */
#result {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #16213e;
  border-radius: 12px;
  border: 1px solid #2a2a4a;
}

.result-header {
  margin-bottom: 1rem;
}

.result-header h2 {
  color: #667eea;
}

.source-link {
  color: #888;
  font-size: 0.85rem;
  text-decoration: none;
}

.source-link:hover {
  color: #667eea;
}

.podcast-text {
  white-space: pre-wrap;
  line-height: 1.8;
  padding: 1rem 0;
  border-top: 1px solid #2a2a4a;
  border-bottom: 1px solid #2a2a4a;
}

.audio-controls {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.audio-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.audio-top select {
  width: auto;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  color: #888;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.speed-control input[type="range"] {
  width: auto;
  flex: 1;
  padding: 0;
  border: none;
  background: none;
  accent-color: #667eea;
}

#speed-label {
  font-size: 0.85rem;
  color: #888;
  min-width: 2.5rem;
  text-align: right;
}

audio {
  width: 100%;
  margin-top: 0.5rem;
}

/* Saved Articles */
.saved-section {
  margin-top: 3rem;
}

.saved-section h2 {
  margin-bottom: 1rem;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #16213e;
  border-radius: 8px;
  border: 1px solid #2a2a4a;
  cursor: pointer;
  transition: border-color 0.2s;
}

.saved-item:hover {
  border-color: #667eea;
}

.saved-item-info {
  flex: 1;
}

.saved-item-info .title {
  font-weight: 600;
  color: #ccc;
}

.saved-item-info .date {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.25rem;
}

.saved-item-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  color: #666;
  text-align: center;
  padding: 2rem;
}

/* Auth Screen */
.auth-screen {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
  padding: 2rem;
  text-align: center;
}

.auth-box h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.auth-error {
  color: #e74c3c;
  font-size: 0.9rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .search-box {
    flex-direction: column;
  }
}
