:root {
  --mdavp-accent-color: #503ced;
  --mdavp-accent-hover-color: #3f2ec4;
  --mdavp-bg: #f6f7fb;
  --mdavp-panel: #ffffff;
  --mdavp-text: #1d2327;
  --mdavp-muted: #6b7280;
  --mdavp-border: #e5e7eb;
  --mdavp-radius: 14px;
}

/* Keep styles scoped to our admin page */
.mdavp-admin {
  color: var(--mdavp-text);
  overflow-x: hidden;
  max-width: 100%;
}

.mdavp-admin #mdavp-admin-root {
  min-height: calc(100vh - 140px);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* Basic layout shell the React app will use */
.mdavp-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.mdavp-sidebar {
  background: var(--mdavp-panel);
  border: 1px solid var(--mdavp-border);
  border-radius: var(--mdavp-radius);
  padding: 14px;
  position: sticky;
  top: 32px;
}

.mdavp-sidebar__title {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 8px 14px;
}

.mdavp-nav {
  display: grid;
  gap: 6px;
}

.mdavp-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--mdavp-text);
  text-decoration: none;
}

.mdavp-nav__item:hover {
  background: #f3f4f6;
}

.mdavp-nav__item--active {
  background: color-mix(in srgb, var(--mdavp-accent-color) 12%, white);
  color: var(--mdavp-text);
  border: 1px solid color-mix(in srgb, var(--mdavp-accent-color) 20%, white);
}

.mdavp-main {
  background: var(--mdavp-panel);
  border: 1px solid var(--mdavp-border);
  border-radius: var(--mdavp-radius);
  padding: 18px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.mdavp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.mdavp-header__title {
  font-size: 22px;
  font-weight: 750;
  margin: 0;
}

.mdavp-header__subtitle {
  margin: 6px 0 0;
  color: var(--mdavp-muted);
}

/* Universal notice banner */
.mdavp-notice {
  margin: 10px auto 14px;
  max-width: 780px;
  border-radius: 12px;
  border: 1px solid var(--mdavp-border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mdavp-notice--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.mdavp-notice--warning {
  background: #fffbeb;
  border-color: #fde68a;
}
.mdavp-notice--error {
  background: #fef2f2;
  border-color: #fecaca;
}
.mdavp-notice--info {
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* Block other plugins' global WP admin notices on our dashboard only */
body.toplevel_page_mdavp #wpbody-content > .notice,
body.toplevel_page_mdavp #wpbody-content > .updated,
body.toplevel_page_mdavp #wpbody-content > .update-nag {
  display: none !important;
}

/* Channels */
.mdavp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mdavp-input {
  min-width: 380px;
  max-width: 680px;
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--mdavp-border);
  background: #fff;
}

.mdavp-btn {
  background: #fff;
  border: 1px solid var(--mdavp-border);
  color: var(--mdavp-text);
  height: 40px;
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
  padding: 0 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  vertical-align: top;
  margin: 0;
  outline: none;
  box-shadow: none;
  cursor: pointer;
}

.mdavp-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: color-mix(in srgb, var(--mdavp-accent-color) 35%, white);
  color: var(--mdavp-text);
}

.mdavp-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mdavp-btn--primary {
  background: var(--mdavp-accent-color);
  border-color: var(--mdavp-accent-color);
  color: #fff;
}

.mdavp-btn--primary:hover:not(:disabled) {
  background: var(--mdavp-accent-hover-color);
  border-color: var(--mdavp-accent-hover-color);
  color: #fff;
}

.mdavp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  border: 1px solid var(--mdavp-border);
  border-radius: 14px;
  overflow: hidden;
}

.mdavp-table th,
.mdavp-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--mdavp-border);
  vertical-align: middle;
}

.mdavp-table thead th {
  background: #f9fafb;
  font-size: 12px;
  color: var(--mdavp-muted);
  font-weight: 700;
}

.mdavp-table tr:last-child td {
  border-bottom: none;
}

.mdavp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--mdavp-border);
  background: #fff;
}

.mdavp-pill--active {
  border-color: color-mix(in srgb, var(--mdavp-accent-color) 35%, white);
  background: color-mix(in srgb, var(--mdavp-accent-color) 10%, white);
}

.mdavp-scan-bar {
  margin-top: 8px;
}

.mdavp-scan-bar__track {
  width: 50vw;
  max-width: 100%;
  height: 10px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
}

.mdavp-scan-bar__fill {
  width: 0;
  height: 10px;
  background: var(--mdavp-accent-color);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.mdavp-scan-bar__fill--complete {
  width: 50vw;
  max-width: 100%;
  background: #16a34a;
}

.mdavp-scan-complete {
  margin-top: 8px;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
}

.mdavp-scan-stats {
  margin-top: 8px;
  color: var(--mdavp-muted);
  font-size: 12px;
}

.mdavp-timeslot-form {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--mdavp-border);
  border-radius: var(--mdavp-radius);
  background: #fafbff;
}

.mdavp-timeslot-form__title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.mdavp-timeslot-form__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
}

.mdavp-timeslot-form__grid .mdavp-field {
  min-width: 0;
}

.mdavp-timeslot-form__grid .mdavp-input {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  box-sizing: border-box;
}

.mdavp-segment {
  display: inline-flex;
  border: 1px solid var(--mdavp-accent-color);
  border-radius: 10px;
  overflow: hidden;
}

.mdavp-segment__btn {
  border: 0;
  border-right: 1px solid var(--mdavp-accent-color);
  background: #fff;
  color: var(--mdavp-accent-color);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mdavp-segment__btn:last-child {
  border-right: 0;
}

.mdavp-segment__btn--active {
  background: var(--mdavp-accent-color);
  color: #fff;
}

.mdavp-segment__btn:hover:not(.mdavp-segment__btn--active) {
  background: color-mix(in srgb, var(--mdavp-accent-color) 10%, white);
}

.mdavp-day-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.mdavp-day-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--mdavp-border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.mdavp-day-grid label:has(input:checked) {
  border-color: color-mix(in srgb, var(--mdavp-accent-color) 40%, white);
  background: color-mix(in srgb, var(--mdavp-accent-color) 10%, white);
}

/* Cards (Phase 7) */
.mdavp-cards {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.mdavp-card {
  border: 1px solid var(--mdavp-border);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.mdavp-card__thumb {
  width: 100%;
  display: block;
  border-radius: 12px;
  background: #f3f4f6;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.mdavp-card__title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}

.mdavp-card__meta {
  font-size: 11px;
  color: var(--mdavp-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mdavp-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 14px;
}

.mdavp-tab {
  border: 1px solid var(--mdavp-border);
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.mdavp-tab--active {
  border-color: color-mix(in srgb, var(--mdavp-accent-color) 40%, white);
  background: color-mix(in srgb, var(--mdavp-accent-color) 12%, white);
}

.mdavp-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--mdavp-accent-color);
  vertical-align: middle;
}

/* Modal */
.mdavp-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 100000;
}

.mdavp-modal {
  width: min(980px, 96vw);
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--mdavp-border);
  overflow: hidden;
}

.mdavp-modal__body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  padding: 14px;
}

.mdavp-modal__video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 14px;
  background: #000;
}

.mdavp-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin: 8px 0 6px;
}

.mdavp-textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--mdavp-border);
}

.mdavp-field--description-toggle {
  margin: 4px 0 8px;
}

.mdavp-description-toggle {
  display: inline-block;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: inherit;
  line-height: inherit;
}

.mdavp-description-toggle:hover {
  color: var(--mdavp-primary, #2563eb);
}

.mdavp-field--description .mdavp-description-toggle {
  margin-bottom: 8px;
}

.mdavp-modal__footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--mdavp-border);
  background: #fafafa;
}

.mdavp-modal__body--review {
  grid-template-columns: 1.4fr 1fr;
  align-items: start;
}

.mdavp-modal__review-panel {
  display: grid;
  gap: 4px;
}

.mdavp-modal__video-title {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
}

.mdavp-modal__video-channel {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--mdavp-muted);
}

.mdavp-reject-reason-display {
  padding: 10px 12px;
  border: 1px solid var(--mdavp-border);
  border-radius: 12px;
  background: #fafafa;
  font-size: 13px;
}

.mdavp-btn--danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

.mdavp-btn--danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* Category tree */
.mdavp-cat-tree {
  border: 1px solid var(--mdavp-border);
  border-radius: 12px;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
}

.mdavp-cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
}

.mdavp-cat-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  flex: 0 0 16px;
  flex-shrink: 0;
  accent-color: var(--mdavp-primary, #2563eb);
  cursor: pointer;
  vertical-align: middle;
}

.mdavp-cat-item span {
  cursor: pointer;
  user-select: none;
}

.mdavp-cat-children {
  margin-left: 18px;
  border-left: 1px dashed var(--mdavp-border);
  padding-left: 10px;
}

/* Timeline (Phase 10) */
.mdavp-timeline-review {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--mdavp-border);
  border-radius: 12px;
  background: #fafafa;
}

.mdavp-timeline-review__label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--mdavp-muted);
}

.mdavp-timeline-review__strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.mdavp-timeline-source-card {
  flex: 0 0 120px;
  border: 1px solid var(--mdavp-border);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  cursor: grab;
  display: grid;
  gap: 6px;
}

.mdavp-timeline-source-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f4f6;
}

.mdavp-timeline-source-card span {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}

.mdavp-timeline-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.mdavp-timeline-nav__label {
  font-size: 13px;
  font-weight: 700;
}

.mdavp-timeline-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--mdavp-border);
  border-radius: 12px;
  background: #fff;
}

.mdavp-timeline-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.mdavp-timeline-grid th,
.mdavp-timeline-grid td {
  border: 1px solid var(--mdavp-border);
  vertical-align: top;
  padding: 6px;
}

.mdavp-timeline-grid thead th {
  background: #fafafa;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.mdavp-timeline-grid thead th:not(:first-child) {
  min-width: 110px;
  max-width: 110px;
  width: 110px;
}

.mdavp-timeline-grid thead th:first-child {
  left: 0;
  z-index: 3;
}

.mdavp-timeline-day--today {
  background: color-mix(in srgb, var(--mdavp-accent-color) 10%, white);
}

.mdavp-timeline-day--past {
  color: var(--mdavp-muted);
}

.mdavp-timeline-row-label {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: #fafafa;
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 88px;
  box-shadow: 1px 0 0 var(--mdavp-border);
}

.mdavp-timeline-cell {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  min-height: 88px;
  overflow: hidden;
  background: #fff;
  transition: background 0.15s ease;
}

.mdavp-timeline-cell--disabled {
  background: #eceff3;
}

.mdavp-timeline-cell--locked {
  background: #f5f5f5;
}

.mdavp-timeline-cell--droppable.mdavp-timeline-cell--over {
  background: color-mix(in srgb, var(--mdavp-accent-color) 12%, white);
  outline: 2px dashed var(--mdavp-accent-color);
  outline-offset: -2px;
}

.mdavp-timeline-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--mdavp-border);
  border-radius: 10px;
  padding: 6px;
  background: #fff;
  cursor: grab;
  display: grid;
  gap: 4px;
  box-sizing: border-box;
}

.mdavp-timeline-card--draft {
  opacity: 0.5;
  filter: grayscale(0.35);
}

.mdavp-timeline-card--scheduled {
  border-color: color-mix(in srgb, var(--mdavp-accent-color) 35%, var(--mdavp-border));
}

.mdavp-timeline-card__badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: var(--mdavp-accent-color);
}

.mdavp-modal__scheduled-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mdavp-accent-color);
  background: color-mix(in srgb, var(--mdavp-accent-color) 10%, white);
}

.mdavp-modal__draft-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--mdavp-muted);
  background: #f9fafb;
}

.mdavp-timeline-card--locked {
  opacity: 0.85;
  cursor: default;
}

.mdavp-timeline-card__lock {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 12px;
  line-height: 1;
}

.mdavp-timeline-card__thumb {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
}

.mdavp-timeline-card__title {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}

.mdavp-dragging {
  opacity: 0.5;
  transform: rotate(1deg);
}

/* Frontend: responsive 16:9 YouTube embed in post content */
/* .yt-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.25em;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: 10px;
}

.yt-container iframe, .yt-container object, .yt-container embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
} */

