/* CF-LMS — clean minimal dark-friendly CSS */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --border: #e0e0e0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --muted: #6b7280;
  --card-bg: #f9fafb;
  --header-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #f0f0f0;
    --border: #333;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --success: #34d399;
    --muted: #9ca3af;
    --card-bg: #262626;
    --header-bg: #1f1f1f;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* Header & Nav */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fg);
}

.logo:hover {
  text-decoration: none;
  opacity: 0.8;
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav a {
  font-size: 0.95rem;
}

/* Main content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 5rem);
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.course-card h3 {
  margin-bottom: 0.5rem;
}

.course-card .desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.course-card .progress-wrapper {
  margin-top: 1rem;
}

/* Progress bar */
.progress-bar {
  position: relative;
  width: 100%;
  height: 1.5rem;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  text-shadow: 0 0 2px var(--bg);
}

/* Outline (module-lesson tree) */
.outline {
  margin-top: 2rem;
}

.module {
  margin-bottom: 2rem;
}

.module-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.lesson-list {
  list-style: none;
  padding: 0;
}

.lesson-item {
  border-bottom: 1px solid var(--border);
}

.lesson-item:last-child {
  border-bottom: none;
}

.lesson-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.5rem;
  transition: background 0.2s;
}

.lesson-link:hover {
  background: var(--border);
  text-decoration: none;
}

.lesson-item.current .lesson-link {
  background: var(--card-bg);
  font-weight: 600;
}

.lesson-item.locked .lesson-link {
  color: var(--muted);
  cursor: not-allowed;
}

.lesson-item.locked .lesson-link:hover {
  background: transparent;
}

.check {
  color: var(--success);
  font-weight: bold;
  margin-right: 0.5rem;
}

.lock-icon {
  margin-right: 0.5rem;
  opacity: 0.6;
}

/* Attachments */
.attachments {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.attachments h3 {
  margin-bottom: 1rem;
}

.attachment-list {
  list-style: none;
  padding: 0;
}

.attachment-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.attachment-list li:last-child {
  border-bottom: none;
}

.file-size {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Forms */
.form-field {
  margin-bottom: 1.5rem;
}

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

.required {
  color: #ef4444;
  margin-left: 0.25rem;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkbox-field label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-field input {
  width: auto;
  margin-right: 0.5rem;
}

button,
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--muted);
}

.btn-secondary:hover {
  background: #4b5563;
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--border);
  font-weight: 600;
}

.admin-table tbody tr:hover {
  background: var(--border);
}

.admin-table .actions {
  display: flex;
  gap: 0.5rem;
}

/* Video player */
video {
  width: 100%;
  max-width: 100%;
  background: #000;
  border-radius: 8px;
}

.video-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 90%;
}

/* Lesson page */
.lesson-content {
  margin-top: 2rem;
}

.lesson-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .site-header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    width: 100%;
    justify-content: center;
  }

  .admin-table {
    font-size: 0.85rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.5rem;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}
