:root {
  --primary-color: #1e293b;
  --accent-color: #d81b60;
  --bg-light: #f8f9fa;
  --text-dark: #333333;
  --text-light: #ffffff;
  --success-color: #2e7d32;
  --danger-color: #c62828;
}

* {
  box-sizing: border-box;
  font-family: "Assistant", sans-serif;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.btn {
  align-items: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  padding: 8px 15px;
  transition: background 0.2s;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

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

.btn-primary:hover:not(:disabled) {
  background: #b0154d;
}

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

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

.btn-danger {
  background: var(--danger-color);
  color: #ffffff;
}

.btn-danger:hover {
  background: #a81d1d;
}

.btn-success {
  background: #16875b;
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #116c49;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid #ffffff;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.btn-outline:hover {
  background: #ffffff;
  color: var(--primary-color);
  text-shadow: none;
}

.full-width {
  width: 100%;
}

#toast {
  background: #333333;
  border-radius: 8px;
  bottom: 20px;
  color: #ffffff;
  opacity: 0;
  padding: 15px 25px;
  pointer-events: none;
  position: fixed;
  right: 20px;
  transition: opacity 0.3s;
  z-index: 10000;
}

#toast.show {
  opacity: 1;
}

.file-mode-warning {
  align-items: center;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #7c2d12;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 10px 16px;
  position: relative;
  text-align: center;
  z-index: 850;
}

.file-mode-warning strong {
  color: #9a3412;
}

.file-mode-warning a {
  color: #b0154d;
  direction: ltr;
  font-weight: 800;
}

#initial-loader {
  align-items: center;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 9999;
}

#loader-text {
  color: var(--primary-color);
}

.spinner {
  animation: spin 1s linear infinite;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 4px solid var(--accent-color);
  height: 50px;
  margin-bottom: 20px;
  width: 50px;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

#auth-section {
  align-items: center;
  background-image: url("/public/hero.jpg");
  background-position: center;
  background-size: cover;
  display: none;
  flex-grow: 1;
  justify-content: center;
  padding: 20px;
  position: relative;
  width: 100%;
}

#auth-section::before {
  background: rgba(0, 0, 0, 0.5);
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.auth-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  padding: 40px;
  position: relative;
  text-align: center;
  width: 100%;
  z-index: 5;
}

.auth-card h2 {
  color: var(--primary-color);
  margin-bottom: 25px;
}

.auth-brand-title {
  color: var(--accent-color);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 10px;
}

.input-group {
  margin-bottom: 15px;
  text-align: right;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.input-group input {
  border: 1px solid #dddddd;
  border-radius: 6px;
  font-size: 1rem;
  padding: 10px;
  width: 100%;
}

#login-submit-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
}

.login-button-loading {
  align-items: center;
  display: none;
  gap: 8px;
  white-space: nowrap;
}

#login-submit-button.is-loading .login-button-label {
  display: none;
}

#login-submit-button.is-loading .login-button-loading {
  display: inline-flex;
}

.login-mini-spinner {
  animation: spin 0.8s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  border-top-color: #ffffff;
  height: 18px;
  width: 18px;
}

#app-section {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.site-header-container {
  background-image: url("/public/hero.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
  color: #ffffff;
  position: relative;
  width: 100%;
}

.site-header-container::before {
  background: rgba(0, 0, 0, 0.4);
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 1;
}

.app-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1200px;
  padding: 30px 40px;
  position: relative;
  width: 100%;
  z-index: 2;
}

.app-header h1 {
  color: #fca311;
  font-size: 2.5rem;
  font-weight: 800;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.user-controls {
  align-items: center;
  display: flex;
  gap: 15px;
}

.refresh-data-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-radius: 50%;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  width: 34px;
}

.refresh-data-button:hover {
  background: #ffffff;
  transform: rotate(25deg);
}

.refresh-data-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.refresh-data-button.is-refreshing i {
  animation: refresh-spin 0.8s linear infinite;
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

.user-name {
  font-size: 1.2rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.logout-btn {
  background: none;
  border: none;
  color: #eeeeee;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.logout-btn:hover {
  color: var(--accent-color);
}

.hero-banner {
  backdrop-filter: blur(2px);
  background-color: rgba(30, 41, 59, 0.84);
  color: #ffffff;
  padding: 20px 40px;
  position: relative;
  width: 100%;
  z-index: 2;
}

.hero-banner-content {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

.hero-banner h2 {
  font-size: 1.6rem;
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
}

.course-admin-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-start;
}

.module-filter-bar {
  align-items: end;
  display: flex;
  gap: 10px;
}

.module-filter-field {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.module-filter-field label {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.1;
}

.module-filter-bar input,
.module-filter-bar select {
  background: transparent;
  border: 1px solid rgba(226, 232, 240, 0.62);
  border-radius: 6px;
  color: #ffffff;
  font: inherit;
  font-size: 0.9rem;
  height: 34px;
  padding: 5px 9px;
}

.module-filter-bar input {
  width: 210px;
}

.module-filter-bar select {
  min-width: 145px;
}

.module-filter-bar input::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.module-filter-bar input:focus,
.module-filter-bar select:focus {
  border-color: rgba(255, 255, 255, 0.9);
  outline: none;
}

.module-filter-bar select option {
  background: #1e293b;
  color: #ffffff;
}

.course-container {
  margin: 0 auto;
  max-width: 1200px;
  padding: 40px 20px;
  width: 100%;
}

.topic-section {
  margin-bottom: 50px;
}

.topic-header {
  align-items: center;
  border-bottom: 1px solid var(--accent-color);
  display: flex;
  gap: 15px;
  justify-content: space-between;
  margin-bottom: 25px;
  padding-bottom: 8px;
}

.topic-title-group {
  align-items: center;
  display: flex;
  gap: 8px;
}

.topic-collapse-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--primary-color);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.25rem;
  justify-content: center;
  padding: 3px 5px;
  transition: transform 0.2s ease;
}

.topic-section.is-collapsed .topic-collapse-toggle {
  transform: rotate(90deg);
}

.topic-collapsed-summary {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 3px 5px;
}

.topic-collapsed-summary:hover,
.topic-collapsed-summary:focus-visible {
  color: var(--accent-color);
  text-decoration: underline;
}

.topic-section.is-collapsed .modules-grid {
  display: none;
}

.topic-title {
  color: var(--primary-color);
  cursor: pointer;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

.modules-view-controls {
  direction: ltr;
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  margin: 0 auto;
  max-width: 1200px;
  padding: 10px 20px 0;
  width: 100%;
}

.topic-bulk-link {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  direction: rtl;
  font-size: 0.8rem;
  padding: 2px 0;
  text-decoration: underline;
}

.topic-bulk-link:hover,
.topic-bulk-link:focus-visible {
  color: var(--accent-color);
}

.topic-manage-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  transition: 0.2s;
  width: 30px;
}

.topic-manage-button:hover {
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

.order-controls {
  display: flex;
  gap: 5px;
}

.order-btn {
  background: #e2e8f0;
  border: none;
  border-radius: 4px;
  color: #475569;
  cursor: pointer;
  padding: 4px 8px;
  transition: 0.2s;
}

.order-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.modules-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-bottom: 50px;
}

.module-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.module-img {
  background: #eeeeee;
  height: 160px;
  width: 100%;
}

.module-content {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  padding: 20px;
}

.module-tag {
  align-self: flex-start;
  background: #e0e0e0;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
  padding: 3px 8px;
}

.module-title {
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.module-desc {
  color: #666666;
  flex-grow: 1;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.module-footer {
  align-items: center;
  border-top: 1px solid #eeeeee;
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 15px;
}

.admin-card-tools {
  align-items: center;
  background: #f8fafc;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 20px;
}

.admin-action-group {
  align-items: center;
  display: flex;
  gap: 5px;
}

.module-updated-at {
  color: #64748b;
  font-size: 0.78rem;
  white-space: nowrap;
}

.module-updated-at.is-today {
  color: #16a34a;
}

.admin-card-tools .btn {
  font-size: 0.85rem;
  padding: 4px 8px;
}

.inactive-card {
  filter: grayscale(0.8);
  opacity: 0.6;
}

#settings-management-view {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  display: none;
  left: 50%;
  margin: 0;
  max-width: 700px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 25px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  z-index: 950;
}

.settings-backdrop {
  background: rgba(15, 23, 42, 0.42);
  inset: 0;
  position: fixed;
  z-index: 900;
}

body.settings-open .site-header-container,
body.settings-open #course-view {
  filter: grayscale(0.15);
  pointer-events: none;
  user-select: none;
}

.settings-window-title {
  color: var(--primary-color);
  margin: 0 0 22px;
  padding-left: 44px;
}

.settings-section {
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 25px;
  padding-bottom: 25px;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h2 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.settings-section p {
  color: #555555;
  font-size: 0.95rem;
  margin-bottom: 15px;
}

.settings-collapse {
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  padding: 0;
}

.settings-section.settings-collapse {
  margin-bottom: 14px;
  padding: 0;
}

.settings-collapse summary {
  color: var(--primary-color);
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 800;
  list-style: none;
  padding: 16px 18px;
}

.settings-collapse summary::-webkit-details-marker {
  display: none;
}

.settings-collapse summary::before {
  color: #64748b;
  content: "▾";
  display: inline-block;
  margin-left: 10px;
  transform: rotate(90deg);
  transition: transform 0.2s;
}

.settings-collapse[open] summary::before {
  transform: rotate(0deg);
}

.settings-collapse-body {
  border-top: 1px solid #dbe4ee;
  padding: 0 18px 18px;
}

.settings-collapse-body > :first-child {
  margin-top: 16px;
}

.settings-collapse form {
  padding: 0;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.system-action-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-action-bucket {
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.system-action-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  padding: 14px;
}

.system-action-card strong {
  color: var(--primary-color);
  font-size: 1.2rem;
  font-weight: 800;
}

.system-action-card p {
  color: #64748b;
  flex: 1;
  font-size: 0.86rem;
  line-height: 1.35;
  margin: 0;
}

.system-action-card .btn {
  min-height: 42px;
  width: 100%;
}

.system-action-card-danger {
  background: #fff7ed;
  border-color: #fed7aa;
}

.system-action-status {
  color: #64748b;
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  min-height: 34px;
}

.system-action-status.is-disabled {
  color: #94a3b8;
}

.cloud-restore-panel {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  margin-top: 16px;
  padding: 18px;
}

.cloud-restore-panel h4 {
  color: var(--primary-color);
  margin-bottom: 6px;
}

.cloud-restore-panel p {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.cloud-restore-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.cloud-restore-item .snapshot-details span {
  line-height: 1.35;
}

.confirm-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.52);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 1300;
}

.confirm-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  max-width: 520px;
  padding: 26px;
  width: 100%;
}

.confirm-card h2 {
  color: var(--primary-color);
  margin: 0 0 10px;
}

.confirm-card p {
  color: #475569;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 18px;
}

.confirm-password-preview {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  padding: 14px;
}

.confirm-password-preview strong {
  color: var(--primary-color);
  direction: ltr;
  font-size: 1.2rem;
  text-align: left;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

.school-password-row {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  margin-bottom: 12px;
}

.school-password-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.school-password-row {
  margin-bottom: 0;
}

.school-password-row .form-group {
  margin-bottom: 0;
}

.school-password-input.is-saved {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--primary-color);
  font-weight: 700;
}

.school-password-empty {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  padding: 12px;
}

.school-password-save,
.school-password-remove,
#add-school-password-button {
  height: 45px;
}

.header-image-preview {
  background-image: url("/public/hero.jpg");
  background-position: center;
  background-size: cover;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  height: 120px;
  margin-top: 8px;
  overflow: hidden;
}

.range-label-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.range-label-row output {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 800;
  min-width: 52px;
  padding: 2px 10px;
  text-align: center;
}

#header-position-y {
  accent-color: var(--accent-color);
  cursor: pointer;
  padding: 0;
}

.range-hints {
  color: #64748b;
  display: flex;
  font-size: 0.82rem;
  justify-content: space-between;
  margin-top: 2px;
}

.settings-window-actions {
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 24px;
  padding-top: 18px;
}

.backup-zone {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  margin-top: 15px;
  padding: 20px;
  text-align: center;
}

.sync-zone {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-top: 16px;
  padding: 20px;
  text-align: center;
}

.snapshot-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 8px 0 18px;
  padding: 16px;
}

.asset-migration-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 8px 0 18px;
  padding: 16px;
}

.system-check-report {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 16px;
}

.system-check-report h4,
.asset-migration-panel h4 {
  color: var(--primary-color);
  margin-bottom: 6px;
}

.system-check-report p,
.asset-migration-panel p {
  color: #475569;
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.asset-migration-report {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-top: 14px;
  padding: 14px;
  text-align: right;
}

.asset-migration-report ul {
  margin: 6px 20px 12px 0;
}

.system-check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.system-check-pill {
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
}

.system-check-pill span {
  font-size: 0.78rem;
  font-weight: 700;
}

.system-check-pill strong {
  font-size: 0.95rem;
}

.system-check-pill.is-ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.system-check-pill.is-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.snapshot-panel h4 {
  color: var(--primary-color);
  margin-bottom: 6px;
}

.snapshot-panel p {
  color: #475569;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.snapshot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snapshot-empty {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  color: #64748b !important;
  margin: 0 !important;
  padding: 10px;
}

.snapshot-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px;
}

.snapshot-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.snapshot-details strong {
  color: var(--primary-color);
}

.snapshot-details span {
  color: #64748b;
  font-size: 0.85rem;
}

.snapshot-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.snapshot-actions .btn {
  font-size: 0.85rem;
  padding: 6px 10px;
}

.backup-zone h4,
.sync-zone h4 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.backup-zone p,
.sync-zone p {
  color: var(--danger-color);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.backup-report,
.sync-preview-report {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-top: 16px;
  padding: 14px;
  text-align: right;
}

.backup-report ul,
.sync-preview-report ul {
  margin-right: 20px;
}

.sync-preview-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0;
}

.restore-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412 !important;
  margin-top: 12px;
  padding: 10px;
}

.restore-backup-button {
  margin-top: 14px;
}

#module-view {
  background: #ffffff;
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.module-view-header {
  align-items: center;
  background: var(--primary-color);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  padding: 15px 30px;
  position: relative;
  width: 100%;
}

.module-view-header::before {
  background: linear-gradient(to right, rgba(15, 23, 42, 0.38), rgba(15, 23, 42, 0));
  content: "";
  height: 100%;
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: min(380px, 52vw);
  z-index: 1;
}

.module-header-cover {
  display: none;
  height: 100%;
  left: 0;
  object-fit: cover;
  object-position: center;
  opacity: 0.9;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: min(360px, 48vw);
  z-index: 0;
  -webkit-mask-image: linear-gradient(to right, #000000 0%, #000000 50%, transparent 100%);
  mask-image: linear-gradient(to right, #000000 0%, #000000 50%, transparent 100%);
}

.module-header-cover.is-visible {
  display: block;
}

.module-view-header h2,
.module-view-actions {
  position: relative;
  z-index: 2;
}

.module-view-header h2 {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
}

.module-view-actions {
  display: flex;
  gap: 10px;
}

.module-view-actions .btn {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.42);
}

.module-view-actions .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.72);
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.42);
}

#course-iframe {
  background: #ffffff;
  border: none;
  flex-grow: 1;
  min-height: calc(100vh - 70px);
  width: 100%;
}

#editor-modal {
  background: #ffffff;
  display: none;
  flex-direction: column;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 2000;
}

.editor-toolbar {
  align-items: center;
  background: var(--primary-color);
  color: #ffffff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 24px;
}

.editor-toolbar h2 {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.editor-toolbar p {
  color: #cbd5e1;
  font-size: 0.85rem;
  margin: 0;
}

.editor-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

#visual-editor-canvas {
  direction: ltr;
  flex: 1;
  min-height: 0;
}

.empty-state {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  padding: 28px;
  text-align: center;
}

#module-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  max-height: 90vh;
  max-width: 800px;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  width: 90%;
}

.modal-close {
  background: none;
  border: none;
  color: #666666;
  cursor: pointer;
  font-size: 1.5rem;
  left: 20px;
  position: absolute;
  top: 15px;
}

.topic-manager-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.58);
  display: none;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1100;
}

.topic-manager-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  max-height: 90vh;
  max-width: 760px;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  width: min(92vw, 760px);
}

.topic-manager-card h2 {
  color: var(--primary-color);
  margin-bottom: 8px;
}

.topic-manager-note {
  color: #64748b;
  line-height: 1.45;
  margin-bottom: 18px;
}

.topic-manager-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.topic-manager-empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  margin: 0;
  padding: 18px;
  text-align: center;
}

.topic-manager-row {
  align-items: end;
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  display: grid;
  gap: 8px 10px;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  padding: 12px;
}

.topic-manager-row.is-delete-requested {
  background: #fff7ed;
  border-color: #fed7aa;
}

.topic-manager-row.is-delete-confirmed {
  background: #f0fdf4;
  border-color: #86efac;
}

.topic-manager-row label {
  color: #334155;
  font-weight: 700;
}

.topic-manager-row input,
.topic-transfer-panel select {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 1rem;
  padding: 10px;
}

.topic-row-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.topic-row-small-button {
  min-width: 70px;
  padding: 8px 12px;
}

.topic-transfer-panel {
  background: #ffffff;
  border: 1px dashed #f59e0b;
  border-radius: 8px;
  color: #92400e;
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 10px;
}

.topic-manager-row.is-delete-confirmed .topic-transfer-panel {
  border-color: #22c55e;
  color: #166534;
}

.topic-transfer-panel p {
  margin: 0;
}

.topic-delete-confirm-button {
  justify-self: start;
  margin-top: 2px;
}

.topic-manager-add-button {
  margin-bottom: 16px;
}

#modal-title {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  gap: 15px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 15px;
  text-align: right;
}

.form-group label {
  font-weight: 600;
}

.form-group input,
.form-group select {
  border: 1px solid #cccccc;
  border-radius: 6px;
  font-size: 1rem;
  padding: 10px;
}

.field-with-action {
  align-items: stretch;
  display: flex;
  gap: 6px;
}

.field-with-action input,
.field-with-action select {
  flex: 1;
  min-width: 0;
}

.field-trash-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dce3;
  border-radius: 6px;
  color: var(--danger-color);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 42px;
  font-size: 0.95rem;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.field-manage-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dce3;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 42px;
  justify-content: center;
}

.field-manage-button:hover {
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

.field-trash-button:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fecaca;
}

.field-trash-button:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.6;
}

.module-warning-box {
  align-items: flex-start;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #7c2d12;
  display: flex;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.module-warning-icon {
  align-items: center;
  background: #ffedd5;
  border-radius: 999px;
  color: #ea580c;
  display: inline-flex;
  flex: 0 0 34px;
  height: 34px;
  justify-content: center;
  margin-top: 2px;
  width: 34px;
}

.module-warning-content {
  flex: 1;
}

.module-warning-content strong {
  color: #9a3412;
  display: block;
  font-size: 1rem;
  margin-bottom: 3px;
}

.module-warning-content p {
  color: #7c2d12;
  line-height: 1.45;
  margin: 0;
}

.module-warning-close {
  background: none;
  border: none;
  color: #9a3412;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
}

#form-topic-custom,
#form-tag-custom {
  margin-top: 10px;
}

#form-tag-select {
  min-height: 42px;
}

.form-selected-tags {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 7px;
}

.form-selected-tags-empty {
  color: #94a3b8;
  font-size: 0.9rem;
}

.form-tag-chip {
  align-items: center;
  background: #e11d68;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.85rem;
  gap: 5px;
  padding: 5px 9px;
}

.form-tag-chip-remove {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

.new-tag-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.new-tag-row input {
  flex: 1;
}

.form-help {
  color: #64748b;
  display: block;
  font-size: 0.8rem;
  margin-top: 6px;
}

.module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 20px;
}

.remove-image-button {
  display: none;
  font-size: 0.85rem;
  margin-top: 5px;
  padding: 4px 10px;
  width: max-content;
}

.preview-container {
  background: #eeeeee;
  border: 1px solid #dddddd;
  border-radius: 8px;
  display: none;
  height: 160px;
  margin: 10px 0 24px auto;
  overflow: hidden;
  width: 300px;
}

#form-image-preview {
  display: block;
  height: 100%;
  width: 100%;
}

.lesson-upload-zone {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  margin-top: 15px;
  padding: 15px;
}

.lesson-upload-zone label {
  color: var(--accent-color);
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.lesson-upload-zone p {
  color: #555555;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.lesson-assets-label {
  margin-top: 16px;
}

.lesson-upload-zone input {
  border: 1px solid #cccccc;
  border-radius: 6px;
  font-size: 1rem;
  padding: 10px;
  width: 100%;
}

.existing-lesson-file {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin: 12px 0;
}

.existing-lesson-file span {
  color: #555555;
  font-weight: 600;
}

.existing-lesson-download {
  font-size: 0.88rem;
  font-weight: 700;
}

.lesson-validation-report {
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 14px;
  overflow-wrap: anywhere;
  padding: 12px 14px;
  text-align: right;
}

.lesson-validation-report strong {
  display: block;
  margin-bottom: 6px;
}

.lesson-validation-report ul {
  margin: 0;
  padding-right: 18px;
}

.lesson-validation-report.is-pass {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

.lesson-validation-report.is-warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.lesson-validation-report.is-block {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

@media (max-width: 900px) {
  .app-header,
  .hero-banner-content {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .app-header {
    aspect-ratio: 1983 / 488;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    padding: 24px 20px;
  }

  .site-header-container {
    min-height: 0;
    background-position: center top !important;
    background-size: 100% auto;
    background-attachment: scroll;
  }

  .app-header h1 {
    align-self: center;
    font-size: 2rem;
    width: 100%;
    padding-top: 10px;
    text-align: center;
  }

  body.admin-mode .app-header {
    aspect-ratio: 1983 / 488;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
  }

  body.admin-mode .app-header h1 {
    padding-top: 10px;
  }

  body.admin-mode .site-header-container {
    min-height: 0;
  }

  .hero-banner {
    padding: 18px 20px;
  }

  .hero-banner h2 {
    font-size: 1.35rem;
  }

  .user-controls {
    align-items: center;
    direction: rtl;
    flex-direction: row;
    gap: 0;
    justify-content: space-between;
    left: 20px;
    position: absolute;
    right: 20px;
    top: 12px;
    width: auto;
  }

  .user-controls #btn-manage-settings {
    direction: rtl;
    height: 26px;
    left: 70px;
    padding: 2px 6px;
    position: absolute;
    top: -2px;
    transform: none;
    width: auto;
    white-space: nowrap;
    font-size: 0.7rem;
    gap: 3px;
  }

  .user-controls .user-name,
  .user-controls .logout-btn {
    width: auto;
  }

  .user-controls .logout-btn {
    padding: 0;
  }

  .user-controls .btn,
  .course-admin-actions,
  .module-filter-bar,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .module-filter-bar input,
  .module-filter-bar select {
    width: 100%;
  }

  .system-action-grid {
    grid-template-columns: 1fr;
  }

  .system-action-bucket {
    grid-template-columns: 1fr;
  }

  .school-password-row {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .topic-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topic-manager-row {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column;
  }

  .snapshot-item {
    align-items: stretch;
    flex-direction: column;
  }

  .snapshot-actions {
    flex-direction: column;
  }

  .system-check-grid {
    grid-template-columns: 1fr;
  }

  .sync-preview-grid {
    grid-template-columns: 1fr;
  }

  .preview-container {
    width: 100%;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .site-header-container {
    background-position: center top !important;
    background-size: 100% auto;
  }

  .app-header {
    aspect-ratio: 1983 / 488;
    height: auto;
    min-height: 0;
  }
}
