/* Video editor page */

body.page-editor{
  margin:0;
  background:#0b0b0b !important;
  color: rgba(255,255,255,.92) !important;
  font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100vh;
  --editor-max: 860px;
}

.editor-topbar{
  height: 52px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.editor-topbar__left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.editor-back{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  color: rgba(255,255,255,.82);
  text-decoration:none;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.editor-back:hover{ color: #fff; }

.editor-title{
  font-weight: 700;
  font-size: 14px;
}

.editor-subtitle{
  font-size: 12px;
  color: rgba(255,255,255,.60);
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 44vw;
}

.editor-code{
  font-size: 12px;
  color: rgba(255,255,255,.55);
}

.editor-main{
  display:flex;
  flex-direction:column;
  /* The editor should behave like a normal section (not fill the whole viewport) */
  min-height: auto;
}

.editor-stage{
  position: relative;
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px 14px 12px;
}

.editor-video-wrap{
  width: min(var(--editor-max), 96vw);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  position: relative;
}

.editor-video-wrap video{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: contain;
  background:#000;
  transform-origin: center center;
}

.editor-play{
  position:absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.55);
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.editor-play i{ font-size: 30px; }

.editor-controls{
  /* Keep the page background visible; the actual controls live in a centered card */
  padding: 16px 0 22px;
  background: transparent;
  border-top: none;
  display:flex;
  justify-content:center;
}

.editor-controls__card{
  width: min(var(--editor-max), 96vw);
  padding: 14px 18px 16px;
  background: rgba(20,20,20,.92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}

.timeline{
  position: relative;
  height: 26px;
  margin-bottom: 14px;
  user-select:none;
}

.timeline__track{
  position:absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}

.timeline__range{
  position:absolute;
  top: 11px;
  height: 4px;
  border-radius: 999px;
  background: #1f8cff;
}

.timeline__handle{
  position:absolute;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #0b0b0b;
  border: 3px solid rgba(255,255,255,.95);
  box-shadow: 0 4px 10px rgba(0,0,0,.45);
  cursor: ew-resize;
}

.timeline__playhead{
  position:absolute;
  top: 18px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid rgba(255,255,255,.88);
  transform: translateX(-7px);
  pointer-events:none;
  opacity: .75;
}

.time-row{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 12px;
  margin-bottom: 12px;
}

.timebox{
  background: rgba(0,0,0,.36);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 14px;
}

.timebox__input{
  width: 72px;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255,255,255,.92);
  font-weight: 700;
  font-size: 18px;
  text-align:center;
}

.time-sep{
  color: rgba(255,255,255,.55);
  font-weight: 600;
}

.action-row{
  display:flex;
  align-items:center;
  gap: 18px;
}

.action{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.80);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor:pointer;
}

.action:hover{ background: rgba(255,255,255,.06); color:#fff; }
.action i{ font-size: 16px; }
.action.is-active{ background: rgba(31,140,255,.14); color:#fff; }

.spacer{ flex: 1; }

.save{
  border: none;
  background: #1f8cff;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor:pointer;
}

.save:disabled{
  opacity: .65;
  cursor: not-allowed;
}

.editor-alert{
  margin-top: 10px;
  min-height: 18px;
  text-align:center;
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

/* Crop overlay */
.crop{
  position:absolute;
  inset:0;
  pointer-events:none;
}

.crop__shade{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.35);
}

.crop__box{
  position:absolute;
  left: 10%;
  top: 10%;
  width: 80%;
  height: 80%;
  border: 2px solid rgba(255,255,255,.95);
  border-radius: 6px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,.35);
  pointer-events:auto;
  cursor: move;
}

.crop__handle{
  position:absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  border: 2px solid rgba(0,0,0,.65);
}

.crop__handle--nw{ left:-8px; top:-8px; cursor:nwse-resize; }
.crop__handle--ne{ right:-8px; top:-8px; cursor:nesw-resize; }
.crop__handle--sw{ left:-8px; bottom:-8px; cursor:nesw-resize; }
.crop__handle--se{ right:-8px; bottom:-8px; cursor:nwse-resize; }

@media (max-width: 680px){
  .editor-subtitle{ display:none; }
  /* Topbar: make it fit nicely on mobile */
  .editor-topbar{ height: 56px; }
  .editor-back span{ display:none; }
  .editor-title{ font-size: 13px; }
  .editor-code{ font-size: 11px; }

  /* Controls: prevent overflow and keep everything inside the card */
  .action-row{
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
  }
  .spacer{ display:none; }
  .action{
    flex: 1 1 30%;
    justify-content: center;
    padding: 10px 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
  }
  .action span{ font-size: 12px; }
  .save{
    width: 100%;
    margin-top: 10px;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
  }
  .timebox__input{ width: 64px; }
}
