.admin-main {
  padding: 36px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-form, .admin-list, .admin-comments {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.admin-form h2, .admin-list h2, .admin-comments h2 {
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 700;
}

/* Раздел модерации комментариев растягивается на всю ширину сетки, под остальными блоками */
.admin-comments {
  grid-column: 1 / -1;
}

#add-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.tmdb-search {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--border);
}

.tmdb-search label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.tmdb-search-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.tmdb-search-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tmdb-search-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tmdb-search-row button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tmdb-search-row button:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

#tmdb-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 10px;
}

.tmdb-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.tmdb-result:hover {
  background: var(--surface-2);
}

.tmdb-result img {
  width: 34px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.tmdb-result-noposter {
  width: 34px;
  height: 50px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
}

.tmdb-result-title {
  font-size: 13px;
  font-weight: 600;
}

.tmdb-result-year {
  font-size: 12px;
  color: var(--text-dim);
}

#tmdb-message {
  margin-top: 8px;
  font-size: 13px;
  min-height: 16px;
}

#tmdb-poster-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: -10px 0 14px;
}

#add-form input, #add-form textarea, #add-form select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#add-form input:focus, #add-form textarea:focus, #add-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#add-form input[type="file"] {
  padding: 8px 0;
  border: none;
  background: none;
}

.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone-text {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
}

.drop-zone-file {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
}

.video-source-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.video-source-tab {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.video-source-tab:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.video-source-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
}

.video-url-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  margin: 6px 0 10px;
}

#video-url-message {
  font-size: 12.5px;
  margin-top: 6px;
  min-height: 16px;
}

.upload-progress {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.upload-progress.show {
  display: flex;
}

.upload-progress-bar {
  height: 6px;
  width: 0%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  transition: width 0.15s ease;
  flex: 1;
}

#upload-progress-text {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 34px;
  text-align: right;
}

#movies-table .edit-title, #movies-table .edit-year, #movies-table .edit-genre {
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

#movies-table .edit-desc {
  width: 100%;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.save-edit-btn, .cancel-edit-btn, .edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.save-edit-btn:hover, .edit-btn:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

#poster-preview {
  display: none;
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  margin: -4px 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#add-form button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #17130c;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  width: 100%;
  transition: filter 0.15s ease, transform 0.1s ease;
}

#add-form button:hover:not(:disabled) {
  filter: brightness(1.08);
}

#add-form button:active:not(:disabled) {
  transform: translateY(1px);
}

#add-form button:disabled {
  opacity: 0.55;
  cursor: default;
}

#form-message {
  margin-top: 12px;
  font-size: 13px;
  color: #8bd18f;
  min-height: 18px;
}

#movies-table, #comments-table {
  width: 100%;
  border-collapse: collapse;
}

#movies-table th, #movies-table td,
#comments-table th, #comments-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

#movies-table tbody tr, #comments-table tbody tr {
  transition: background 0.12s ease;
}

#movies-table tbody tr:hover, #comments-table tbody tr:hover {
  background: var(--surface-2);
}

#movies-table th, #comments-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Ячейка с текстом комментария — переносим длинный текст, не растягивая таблицу */
#comments-table .comment-cell {
  max-width: 360px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-dim);
}

.delete-btn {
  background: transparent;
  border: 1px solid #e08080;
  color: #e08080;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.delete-btn:hover {
  background: #e08080;
  color: var(--bg);
}
