* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  grid-template-rows: 1fr auto;
  height: 100vh;
  background: #f5f6f8;
}

.panel {
  padding: 12px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  box-sizing: border-box;
}


#left {
  grid-column: 1;
  grid-row: 1;
}

#right {
  grid-column: 3;
  grid-row: 1;
  border-left: 1px solid #e0e0e0;
  border-right: none;
}

main {
  grid-column: 2;
  grid-row: 1;
  padding: 12px;
}

#videoInput{
  border-radius: 5px;
  background-color: #e7e7e7;
  padding: 14px 20px;
}

.card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* 16:9 video */
#videoContainer {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 1050px;
  margin-left: auto;
  margin-right: auto;
  /*background: #000;*/
}

#videoContainer.dragover {
  outline: 3px dashed #1976d2;
  outline-offset: -6px;
  background: rgba(25, 118, 210, 0.05);
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

#overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  cursor: crosshair;
}

#loadVideoOverlay {
  position: absolute;
  top: calc(70% + 14px);
  left: calc(50%);
  margin: auto;
  width: 180px;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: #1976d2;
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%) translateY(-50%);
  transition: transform 0.15s ease, background 0.15s ease;
}

#loadVideoOverlay:hover {
  background: #1565c0;
  transform: translateX(-50%) translateY(-50%) scale(1.05);
}

#loadVideoOverlay.hidden {
  display: none;
}




/* Annotations */
.annotation {
  position: absolute;
  border: 2px solid #ff5252;
  border-radius: 4px;
  translate: -50% -50%;
  cursor: move;
  z-index: 9999;
}

.annotation .label {
  position: absolute;
  top: -18px;
  left: 0;
  background: #ff5252;
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #ff5252;
  border-radius: 50%;
  cursor: nwse-resize;
}

/* Buttons */
button {
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px;
  margin-top: 6px;
  cursor: pointer;
}

button:hover {
  background: #1565c0;
}

input, select {
  width: 100%;
  padding: 6px;
  margin-top: 4px;
}

/*zinput Slider*/
#zInput{
  width: 80px;
  vertical-align: middle;
  writing-mode: vertical-lr;
  direction: rtl;
  margin-left: 20px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
}

/* Annotation list */
.selectable-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.selectable-list li {
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
}

.selectable-list li:hover {
  background: #e3f2fd;
}

.selectable-list li.selected {
  background: #1976d2;
  color: white;
}

/* Timeline */
#timeline {
  grid-column: 1 / span 3;
  grid-row: 2;
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 8px;
  position: relative;
}

#timelineScroll {
  overflow-x: auto;
  border: 1px solid #ccc;
}

#timelineCanvas {
  height: 180px;
  min-width: 100%;
  background-color: #dae1e8;
}

.timeline-controls {
  margin-top: 8px;
}

/* Info button */
#info {
  position: absolute;
  top: -53px;
  right: 16px;
  background: #1976d2;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#infoTooltip {
  display: none;
  position: absolute;
  right: 44px;
  bottom: 0;
  background: white;
  color: #333;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 13px;
  width: 220px;
}

#info:hover #infoTooltip {
  display: block;
}

.delete-handle {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 16px;
  height: 16px;
  background: #d32f2f;
  color: white;
  font-size: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.delete-handle:hover {
  background: #b71c1c;
}

.resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: #ff5252;
  border-radius: 50%;
  cursor: nwse-resize;
}

.selectable-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.selectable-list li {
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.selectable-list li:hover {
  background: #e3f2fd;
}

.selectable-list li.selected {
  background: #1976d2;
  color: white;
}


/*###############  Timeline Cursor  ##################*/
.timeline-resize {
  cursor: ew-resize;
}

.timeline-move {
  cursor: grab;
}

.timeline-move:active {
  cursor: grabbing;
}






/*###############  KEYFRAMES  ##################*/
#keyframeCanvas {
  width: 100%;
  background: #1e1e1e;
  border-radius: 4px;
  cursor: pointer;
}

.keyframe-hover {
  cursor: pointer;
}

.keyframe-delete {
  cursor: not-allowed;
}




/*#########################################################*/
/*#########################################################*/
/*#######################    TABLET    ####################*/
/*#########################################################*/
/*#########################################################*/
@media (max-width: 1023px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }

  #main {
    grid-row: 1;
  }

  #left,
  #right {
    grid-column: 1;
    grid-row: auto;
    display: flex;
    gap: 16px;
    padding: 8px;
  }

  #left {
    order: 2;
  }

  #right {
    order: 3;
  }

  #timeline {
    order: 4;
  }
}




/*#########################################################*/
/*#########################################################*/
/*#######################    MOBILE    ####################*/
/*#########################################################*/
/*#########################################################*/
@media (max-width: 767px) {
  #left,
  #right {
    flex-direction: column;
  }

  #videoContainer {
    aspect-ratio: 16 / 9;
  }

  .panel {
    max-height: none;
  }

  #timelineCanvas {
    height: 100px;
  }
}