:root {
    --primary-color: #3b82f6;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    margin: 0 1rem;
    font-weight: 500;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-right: 2rem;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Level Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* Article Cards & Newspaper Layout */
.article-section {
    max-width: 800px;
    margin: 0 auto;
}

.article-card {
    border: none;
    box-shadow: none;
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-bottom: 0;
    border-radius: 0;
}

.article-card:last-child {
    border-bottom: none;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.badge-technology { background: #dbeafe; color: #1e40af; }
.badge-business { background: #fef3c7; color: #92400e; }
.badge-entertainment { background: #fce7f3; color: #9d174d; }
.badge-default { background: #f1f5f9; color: #475569; }

.article-title {
    font-size: 2rem;
    font-family: 'Georgia', serif;
    margin-bottom: 1rem;
    color: #0f172a;
    line-height: 1.2;
}

.article-brief {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 1.5rem;
}

/* Vocab Section */
.vocab-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.vocab-header {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vocab-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vocab-item {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.vocab-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.vocab-word-row {
    margin-bottom: 0.25rem;
}

.vocab-word {
    font-weight: 700;
    font-size: 1.05rem;
}

.vocab-pos {
    color: #64748b;
    font-style: italic;
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

.vocab-def {
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.vocab-example {
    font-style: italic;
    color: #475569;
    font-size: 0.95rem;
}

/* Source Link */
.source-link {
    font-size: 0.8rem;
    color: #94a3b8;
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

/* Archive Grid */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.archive-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.archive-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.archive-date {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.archive-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-badges {
    display: flex;
    gap: 0.25rem;
}

.level-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: #e2e8f0;
    border-radius: 4px;
    font-weight: 600;
}

.article-count {
    font-size: 0.85rem;
    color: #64748b;
}

.btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    filter: brightness(0.9);
}

.btn-secondary {
    background: #64748b;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* WaveSurfer Player */
.ws-player {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.ws-waveform {
  margin-bottom: 0.75rem;
}
.ws-controls, .ws-ab-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ws-ab-controls {
  margin-top: 0.5rem;
}
.ws-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.ws-btn:hover { background: #f1f5f9; }
.ws-btn.ws-play {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  font-weight: 600;
}
.ws-btn.ws-play:hover { background: #1d4ed8; }
.ws-btn.ws-ab-a { color: #059669; border-color: #059669; }
.ws-btn.ws-ab-b { color: #7c3aed; border-color: #7c3aed; }
.ws-btn.ws-ab-clear { color: #dc2626; border-color: #dc2626; }
.ws-speed {
  padding: 0.3rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
}
.ws-time {
  font-size: 0.8rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.ws-ab-label {
  font-size: 0.8rem;
  color: #475569;
  font-family: monospace;
}

/* Admin Status Badges */
.badge-running { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-failure { background: #fee2e2; color: #991b1b; }

/* Log Terminal Box */
.terminal-box {
    background-color: #0d1117;
    color: #e6edf3;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85rem;
    padding: 1rem;
    border-radius: 6px;
    height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    border: 1px solid #30363d;
}

/* Sidebar Update */
.admin-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

/* Forms in Admin */
.admin-main form .form-group {
    margin-bottom: 1.5rem;
}

.admin-main form .description {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.admin-menu a:hover, .admin-menu a.active {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: bold;
}
