:root {
  --bg: #f0f4f8;
  --sidebar: #1a2332;
  --sidebar-text: #a8b8cc;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --review: #8b5cf6;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

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

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 300px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  font-size: 36px;
  line-height: 1;
}

.brand h1 {
  font-size: 16px;
  font-weight: 600;
}

.brand p {
  font-size: 12px;
  color: var(--sidebar-text);
  margin-top: 4px;
}

.progress-card {
  margin: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--sidebar-text);
  margin-bottom: 10px;
}

.progress-header strong {
  color: var(--success);
  font-size: 18px;
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 4px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-stats {
  margin-top: 8px;
  font-size: 12px;
  color: var(--sidebar-text);
  text-align: center;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  margin-bottom: 8px;
}

.nav-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.day-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.day-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 2px;
}

.day-item:hover {
  background: rgba(255,255,255,0.06);
}

.day-item.active {
  background: var(--primary);
}

.day-item.done .day-num::after {
  content: "✓";
  position: absolute;
  right: -2px;
  top: -2px;
  background: var(--success);
  color: #fff;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-num {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.day-item.active .day-num {
  background: rgba(255,255,255,0.2);
}

.day-item.review .day-num {
  background: rgba(139, 92, 246, 0.3);
}

.day-info {
  flex: 1;
  min-width: 0;
}

.day-info .title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-info .meta {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.sidebar-footer a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

/* Main */
.main {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

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

.day-label {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.main-header h2 {
  font-size: 26px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card p {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 15px;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.lesson-item .info h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.lesson-item .info span {
  font-size: 12px;
  color: var(--text-muted);
}

.lesson-links {
  display: flex;
  gap: 8px;
}

.lesson-links a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
}

.link-video {
  background: #eff6ff;
  color: var(--primary);
}

.link-homework {
  background: #ecfdf5;
  color: var(--success);
}

/* Form */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.video-input-row {
  display: flex;
  gap: 8px;
}

.video-input-row input {
  flex: 1;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.video-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 20px;
  font-size: 13px;
}

.video-tag button {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.form-row {
  display: flex;
  gap: 24px;
  margin-bottom: 18px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-area p {
  font-size: 14px;
  margin-bottom: 4px;
}

.upload-area span {
  font-size: 12px;
  color: var(--text-muted);
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

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

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-item {
  padding: 18px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.history-item .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-item .header h4 {
  font-size: 15px;
}

.history-item .header .date {
  font-size: 13px;
  color: var(--text-muted);
}

.history-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge.done {
  background: #d1fae5;
  color: #065f46;
}

.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.history-videos {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.history-note {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.6;
}

.history-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-images img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: #dc2626;
}

.toast.success {
  background: var(--success);
}

/* Scrollbar */
.day-list::-webkit-scrollbar {
  width: 4px;
}

.day-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}
