/* French Notes - main stylesheet */

:root {
  --bleu: #002654;
  --bleu-light: #1a3f6e;
  --rouge: #ce1126;
  --ink: #1c1f26;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

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

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

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bleu);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand-link {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.brand-link:hover { text-decoration: none; opacity: 0.9; }
.brand-flag { font-size: 20px; }

.lesson-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.lesson-nav-title {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  padding: 0 20px 8px;
}

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

.lesson-nav li a {
  display: block;
  padding: 9px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 14.5px;
  border-left: 3px solid transparent;
}

.lesson-nav li a:hover {
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}

.lesson-nav li.active a {
  background: rgba(255,255,255,0.12);
  border-left-color: var(--rouge);
  font-weight: 600;
  color: #fff;
}

.lesson-nav li.empty {
  padding: 9px 20px;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-style: italic;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-admin-link {
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
}

/* Main column */
.main-col { flex: 1; min-width: 0; }

.content {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 28px;
  margin: 0 0 6px;
}

.page-header .meta {
  color: var(--muted);
  font-size: 14px;
}

.lesson-desc {
  color: var(--muted);
  margin-top: 8px;
}

/* Note cards */
.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: box-shadow 0.15s ease;
}

.note-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.note-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.note-card h2 a { color: var(--ink); }
.note-card h2 a:hover { color: var(--bleu); text-decoration: none; }

.note-card .meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.note-card .excerpt {
  color: #3a3f4b;
  font-size: 14.5px;
}

.note-media-badges {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: #eef2f7;
  color: var(--bleu-light);
  padding: 3px 9px;
  border-radius: 999px;
}

/* Single note */
.note-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  font-size: 16px;
}

.note-body h2 { font-size: 21px; margin-top: 28px; }
.note-body h3 { font-size: 18px; margin-top: 22px; }
.note-body blockquote {
  border-left: 3px solid var(--rouge);
  margin: 16px 0;
  padding: 4px 16px;
  color: var(--muted);
  background: #fafafa;
}
.note-body ul, .note-body ol { padding-left: 22px; }

.media-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.media-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 14px;
}

.media-item { margin-bottom: 18px; }
.media-item .media-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.media-item video, .media-item audio { width: 100%; max-width: 640px; border-radius: 8px; }

.back-link { margin-bottom: 18px; display: inline-block; font-size: 14px; }

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

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  justify-content: center;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink);
}
.pagination .current { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.pagination a:hover { background: #f0f2f5; text-decoration: none; }

/* ---------------- Admin ---------------- */

.admin-body { background: var(--bg); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 4px;
  text-align: center;
}
.login-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=number],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--bleu-light);
}
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 7px;
  border: 1px solid var(--bleu);
  background: var(--bleu);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--bleu-light); text-decoration: none; }
.btn-block { width: 100%; text-align: center; }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
}
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger {
  background: #fff;
  color: var(--rouge);
  border-color: #f3c6cb;
}
.btn-danger:hover { background: #fdf1f2; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.alert {
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-error { background: #fdecee; color: #a4243b; border: 1px solid #f5c2cb; }
.alert-success { background: #eaf7ee; color: #206238; border: 1px solid #bfe6cc; }

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

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #101828;
  color: #fff;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}
.admin-sidebar .brand {
  padding: 22px 20px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar nav { padding: 14px 0; flex: 1; }
.admin-sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: rgba(255,255,255,0.8);
  font-size: 14.5px;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.admin-sidebar nav a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--rouge);
}
.admin-sidebar .logout {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar .logout a { color: rgba(255,255,255,0.7); font-size: 13.5px; }

.admin-main { flex: 1; padding: 36px 40px; max-width: 980px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.admin-header h1 { font-size: 24px; margin: 0; }

.stats-row { display: flex; gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  flex: 1;
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--bleu); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 2px; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
table.admin-table th {
  background: #fafbfc;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table .actions { display: flex; gap: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

/* Rich text editor */
.editor-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  padding: 6px;
  background: #fafbfc;
}
.editor-toolbar button {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.editor-toolbar button:hover { background: #eef1f5; }

.editor-content {
  border: 1px solid var(--border);
  border-radius: 0 0 7px 7px;
  min-height: 280px;
  padding: 16px;
  font-size: 15px;
  background: #fff;
}
.editor-content:focus { outline: none; border-color: var(--bleu-light); }
.editor-content ul, .editor-content ol { padding-left: 22px; }
.editor-content blockquote {
  border-left: 3px solid var(--rouge);
  margin: 10px 0;
  padding: 4px 14px;
  color: var(--muted);
}

.media-upload-row {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 10px;
}

.existing-media-list { list-style: none; padding: 0; margin: 10px 0 0; }
.existing-media-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13.5px;
}

.form-actions { margin-top: 22px; display: flex; gap: 10px; }

@media (max-width: 800px) {
  .sidebar, .admin-sidebar { display: none; }
  .content, .admin-main { padding: 24px 18px; }
}
