.admin-page {
  min-height: 100vh;
  background: #f4f0e8;
  color: #1f2933;
}

.admin-header {
  position: sticky;
  background: #1a1e21;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-nav a,
.admin-nav button,
.admin-actions button,
.editor-panel button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fd8f44;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 10px;
}

.admin-nav a {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.32);
}

.admin-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 32px auto;
}

.admin-locked .admin-shell,
.admin-locked #saveFileButton {
  display: none;
}

.login-panel {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 90px);
  padding: 32px 16px;
}

.login-box {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d6dce3;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(31, 41, 51, 0.16);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.login-box h1 {
  color: #1f2933;
  font-family: "Poppins", sans-serif;
  font-size: 28px;
  text-align: left;
  text-shadow: none;
}

.login-box label {
  color: #344054;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
}

.login-box input {
  border: 1px solid #c8d0d9;
  border-radius: 8px;
  font: 15px/1.45 "Poppins", sans-serif;
  padding: 11px 12px;
  width: 100%;
}

.login-box button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fd8f44;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 14px;
}

.login-box p {
  color: #d64545;
  min-height: 20px;
}

.admin-unlocked .login-panel {
  display: none;
}

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

.admin-toolbar h1 {
  color: #1f2933;
  font-family: "Poppins", sans-serif;
  font-size: 32px;
  text-align: left;
  text-shadow: none;
}

.admin-toolbar p {
  color: #667085;
  margin-top: 6px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-actions input {
  border: 1px solid #c8d0d9;
  border-radius: 8px;
  font: 14px/1.4 "Poppins", sans-serif;
  min-width: 210px;
  padding: 8px 10px;
}

.admin-actions .danger {
  background: #d64545;
}

.admin-actions .ghost {
  background: #fff;
  border-color: #c8d0d9;
  color: #344054;
}

.admin-file-input {
  display: none;
}

.admin-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 340px) 1fr;
}

.post-browser,
.editor-panel,
.preview-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d6dce3;
  border-radius: 8px;
}

.post-browser {
  max-height: calc(100vh - 190px);
  overflow: hidden;
  padding: 14px;
  position: sticky;
  top: 98px;
}

.post-browser input {
  border: 1px solid #c8d0d9;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
  padding: 11px 12px;
  width: 100%;
}

#adminPostList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 265px);
  overflow: auto;
  padding-right: 4px;
}

.admin-post-item {
  border: 1px solid #d6dce3;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px;
  transition: 0.2s ease;
}

.admin-post-item:hover,
.admin-post-item.active {
  border-color: #fd8f44;
  box-shadow: 0 6px 18px rgba(253, 143, 68, 0.18);
}

.admin-post-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.admin-post-item span {
  color: #667085;
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.editor-panel {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  padding: 18px;
}

#postForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#postForm label {
  color: #344054;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
}

#postForm .checkbox-row {
  align-items: center;
  flex-direction: row;
  font-weight: 600;
  gap: 10px;
}

#postForm .checkbox-row input {
  height: 18px;
  width: 18px;
}

#postForm input,
#postForm select,
#postForm textarea {
  border: 1px solid #c8d0d9;
  border-radius: 8px;
  font: 15px/1.45 "Poppins", sans-serif;
  padding: 11px 12px;
  width: 100%;
}

.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#postForm .format-toolbar button {
  align-items: center;
  background: #fff;
  border: 1px solid #c8d0d9;
  border-radius: 8px;
  color: #344054;
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  min-height: 34px;
  min-width: 42px;
  padding: 7px 7px;
}

#postForm .format-toolbar button:hover {
  border-color: #fd8f44;
  color: #fd8f44;
}

#postForm textarea {
  min-height: 420px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 140px 1fr;
}

.preview-panel {
  max-height: calc(100vh - 225px);
  overflow: auto;
  padding: 16px;
}

.preview-panel h2 {
  font-family: "Poppins", sans-serif;
  font-size: 20px;
  margin-bottom: 12px;
  text-align: left;
  text-shadow: none;
}

#postPreview {
  color: #1f2933;
  font-size: 16px;
  line-height: 1.55;
}

#postPreview ul,
#postPreview ol {
  margin: 10px 0 10px 28px;
  padding-left: 18px;
}

#postPreview ul li,
#postPreview ol li {
  border: 0;
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  list-style: disc;
  line-height: 1.55;
  margin: 4px 0;
  padding: 0;
  text-align: justify;
}

#postPreview img {
  height: auto;
  max-width: 100%;
}

#postPreview .youtube-embed {
  background: #111827;
  border-radius: 8px;
  margin: 18px 0;
  overflow: hidden;
  padding-top: 56.25%;
  position: relative;
  width: 100%;
}

#postPreview .youtube-embed iframe {
  border: 0;
  display: block;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

#postPreview .table-wrap {
  border: 1px solid #d6dce3;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
  margin: 18px 0;
  overflow-x: auto;
}

#postPreview table {
  background: #fff;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  line-height: 1.45;
  margin: 18px 0;
  min-width: 560px;
  width: 100%;
}

#postPreview .table-wrap table {
  margin: 0;
}

#postPreview th,
#postPreview td {
  border-bottom: 1px solid #e3e8ef;
  border-right: 1px solid #e3e8ef;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

#postPreview th:last-child,
#postPreview td:last-child {
  border-right: 0;
}

#postPreview tbody tr:last-child td {
  border-bottom: 0;
}

#postPreview th {
  background: #1a1e21;
  color: #fff;
  font-weight: 700;
}

#postPreview tbody tr:nth-child(even) {
  background: #f8fafc;
}

#postPreview tbody tr:hover {
  background: #fff5ed;
}
.video-mark-form {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.video-mark-form input {
    padding: 5px;
}

#markTime {
    width: 80px;
}

#markText {
    flex: 1;
}

@media (max-width: 980px) {
  .admin-toolbar,
  .admin-layout,
  .editor-panel {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    align-items: flex-start;
    display: grid;
  }

  .post-browser,
  .preview-panel {
    max-height: none;
    position: static;
  }
}

@media (max-width: 560px) {
  .admin-shell {
    width: min(100% - 20px, 1400px);
  }

  .admin-nav {
    align-items: stretch;
    flex-direction: column;
  }

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