/* Animation timeline panel styles.
   Uses CSS custom properties from base.css so it adapts to dark/light mode. */

#method-draw {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--z1);
}

#editor-area {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#timeline-panel {
  flex: 0 0 30%;
  min-height: 150px;
  background-color: var(--z0);
  border-top: 1px solid var(--z3);
  display: flex;
  flex-direction: column;
  color: var(--z9);
  font-size: 12px;
  transition: flex-basis 150ms ease, min-height 150ms ease;
}

#timeline-panel.minimized {
  flex: 0 0 auto;
  min-height: 0;
}

#timeline-panel.minimized .timeline-body {
  display: none;
}

#timeline-panel .timeline-toolbar {
  background-color: var(--z2);
  padding-left: 0;
  height: 36px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#timeline-panel .timeline-body {
  flex: 1 1 auto;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

#timeline-panel .outline {
  width: 250px;
  min-width: 150px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--z0);
}

#timeline {
  box-sizing: border-box;
  flex: 1;
  width: 100%;
  height: 100%;
  background-color: var(--z0);
  position: relative;
}

/* Timeline toolbar buttons scoped to avoid overriding editor buttons */
#timeline-panel .button {
  padding: 0px;
  width: 44px;
  min-width: 44px;
  margin-right: 5px;
  color: var(--z9);
  background: transparent;
  border: none;
}

#timeline-panel .button:focus {
  outline: 0;
  border: none;
}

#timeline-panel .button:hover {
  background: var(--z3);
}

#timeline-panel .button.active {
  background: var(--accent7);
  color: var(--z15);
}

#timeline-panel .outline-header {
  height: 45px;
}

#timeline-panel .outline-scroll-container {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

#timeline-panel .outline-node {
  padding-left: 20px;
  font-size: 12px !important;
  display: flex;
  align-items: center;
  width: 100%;
  font-family: Roboto, 'Helvetica Neue', sans-serif;
  color: var(--z15);
  -webkit-user-select: none;
  user-select: none;
  height: 30px;
}

#timeline-panel .outline-node:hover {
  background-color: var(--accent7);
}

#timeline-panel .links {
  display: flex;
  align-items: center;
}

#timeline-panel a {
  font-family: Roboto, 'Helvetica Neue', sans-serif;
  color: var(--z15);
  margin-right: 30px;
}

/* Timeline toolbar separator adapts to theme */
.timeline-separator {
  width: 1px;
  background: var(--z3);
  height: 100%;
}

/* Duration input adapts to theme */
#timeline_duration_input {
  width: 70px;
  background: var(--z0);
  color: var(--z9);
  border: 1px solid var(--z3);
  border-radius: 3px;
  padding: 2px 4px;
}

/* Override animation-timeline-js internal colors to use CSS variables */
.animation-timeline-control {
  background: var(--z0) !important;
  color: var(--z9) !important;
}

.animation-timeline-control .header {
  background: var(--z2) !important;
}

.animation-timeline-control .content .labels .label {
  background: var(--z2) !important;
  color: var(--z15) !important;
}

.animation-timeline-control .content .rows-container .rows .row {
  border-bottom: 1px solid var(--z3) !important;
}

.animation-timeline-control .content .rows-container .rows .row .keyframes .keyframe {
  background: var(--z3) !important;
}

.animation-timeline-control .content .rows-container .rows .row .keyframes .keyframe.selected {
  background: var(--accent7) !important;
}

.animation-timeline-control .current-time-marker,
.animation-timeline-control .current-time-marker .handle {
  background: var(--accent7) !important;
}

.animation-timeline-control ::-webkit-scrollbar {
  background: var(--z0) !important;
}

.animation-timeline-control ::-webkit-scrollbar-thumb {
  background: var(--z3) !important;
}

.animation-timeline-control ::-webkit-scrollbar-corner {
  background: var(--z0) !important;
}

/* Override inline styles from animation-timeline-js canvas/scroll container */
.animation-timeline-control canvas {
  background: transparent !important;
}

.animation-timeline-control .scroll-container {
  background: var(--z0) !important;
}

.animation-timeline-control .scroll-container > div {
  background: transparent !important;
}


/*
.animation-timeline-control .scroll-container canvas{
  color: var(--z3) !important;
  background:  var(--z1) !important;
}
*/

/* Custom keyframe overlay rendered on top of the library canvas */
.timeline-keyframe-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Sidebar (outline) rows: parent object + linked child property tracks */
#timeline-panel .outline-row {
  box-sizing: border-box;
  display: flex; align-items: center;
  font-size: 12px; color: var(--z15);
  border-bottom: 1px solid var(--z3);
  padding-left: 8px; padding-right: 4px;
  user-select: none;
}
#timeline-panel .outline-row.parent { cursor: pointer; font-weight: 600; background: var(--z1); }
#timeline-panel .outline-row.parent:hover { background: var(--z3); }
#timeline-panel .outline-row .toggle {
  display: inline-block; width: 14px; transition: transform 120ms ease;
  color: var(--accent9); cursor: pointer;
}
#timeline-panel .outline-row.parent.collapsed .toggle { transform: rotate(-90deg); }
#timeline-panel .outline-row.child { padding-left: 22px; color: var(--z9); font-size: 11px; }
#timeline-panel .outline-row.child .elbow { color: var(--z3); margin-right: 5px; }
#timeline-panel .outline-row .dot { width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; flex-shrink: 0; }
#timeline-panel .outline-row .row-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

#timeline-panel .row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
#timeline-panel .icon-btn {
  width: 18px; height: 18px; line-height: 18px; text-align: center;
  font-size: 11px; border-radius: 3px; border: none; background: transparent;
  color: var(--z9); cursor: pointer; padding: 0; flex-shrink: 0;
}
#timeline-panel .icon-btn:hover { background: var(--z12); color: var(--z15); }
#timeline-panel .icon-btn.del-btn:hover,
#timeline-panel .icon-btn.del-row-btn:hover { background: var(--b6); color: var(--z15); }
#timeline-panel .icon-btn.add-btn {
  background: var(--accent7);
  color: var(--z15);
  border-radius: 50%;
  font-weight: 700;
}
#timeline-panel .icon-btn.add-btn:hover { background: var(--accent9); }
#timeline-panel .icon-btn.lock-btn.is-locked { color: var(--b7); }

/* Custom vertical scrollbar thumb/track colours for the outline panel, so
   it matches the app's dark/light theme instead of the browser default. */
#timeline-panel .outline-scroll-container::-webkit-scrollbar-thumb {
  background: var(--z3);
}
#timeline-panel .outline-scroll-container::-webkit-scrollbar-track {
  background: var(--z0);
}
#timeline-panel .outline-row.locked .add-btn,
#timeline-panel .outline-row.locked .del-btn,
#timeline-panel .outline-row.locked .del-row-btn,
#timeline-panel .outline-row.locked .rename-btn,
#timeline-panel .outline-row.locked .row-ease-btn { opacity: .3; pointer-events: none; }

/* Inline rename input for an Animation Object's name */
#timeline-panel .outline-row .row-title-input {
  flex: 1 1 auto; min-width: 0; font: inherit; color: inherit;
  background: var(--z0); border: 1px solid var(--accent9); border-radius: 3px;
  padding: 1px 4px; margin: 0;
}

/* Right-click context menu on the timeline canvas */
.timeline-context-menu {
  position: fixed; display: none; background: var(--z2); border: 1px solid var(--z3);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 4px; z-index: 120;
  min-width: 190px; font-size: 12px;
}
.timeline-context-menu button {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--z15); padding: 7px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
  font-weight: 400; line-height: 140%;
}
.timeline-context-menu button:hover { background: var(--accent7); }
.timeline-context-menu button:disabled { opacity: .4; cursor: default; }
.timeline-context-menu button:disabled:hover { background: transparent; }
.timeline-context-menu .ctx-label {
  padding: 6px 10px 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--z9);
}
.timeline-context-menu .ctx-sep { height: 1px; background: var(--z3); margin: 4px 2px; }

/* Floating easing-edit button positioned at the selected keyframe */
.timeline-floating-icon-btn {
  position: fixed; display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--z3);
  background: var(--accent7); color: var(--z15); font-size: 10px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.4); z-index: 50; padding: 0;
}
.timeline-floating-icon-btn:hover { background: var(--accent9); }

/* Popovers (easing editor + add-property) */
.timeline-popover {
  position: fixed; display: none; background: var(--z2); border: 1px solid var(--z3);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); padding: 10px;
  font-size: 11px; color: var(--z15); z-index: 100; width: 280px;
}
.timeline-popover .popover-title {
  font-weight: 600; font-size: 11px; color: var(--z9); text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 8px; padding: 0 2px;
}
.timeline-popover .property-list { display: flex; flex-direction: column; gap: 1px; max-height: 200px; overflow-y: auto; }
.timeline-popover .property-item {
  display: flex; align-items: center; gap: 7px; background: transparent; border: none;
  color: var(--z15); text-align: left; padding: 5px 6px; border-radius: 4px;
  font-size: 12px; cursor: pointer; width: 100%;
}
.timeline-popover .property-item:hover { background: var(--z3); }
.timeline-popover .property-item .dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

.timeline-popover .pivot-grid { display: grid; grid-template-columns: repeat(3, 32px); gap: 5px; }
.timeline-popover .pivot-choice { width: 32px; height: 32px; padding: 0; border: 1px solid var(--z3); border-radius: 3px; background: var(--z1); cursor: pointer; display: grid; place-items: center; }
.timeline-popover .pivot-choice:hover, .timeline-popover .pivot-choice.selected { border-color: var(--accent9); background: var(--accent14); }
.timeline-popover .pivot-choice span { width: 7px; height: 7px; border-radius: 50%; background: var(--z9); }
.timeline-popover .pivot-choice.selected span { background: var(--accent9); box-shadow: 0 0 0 2px var(--z15); }

/* Custom select dropdown with previews */
.timeline-popover .custom-select-container { position: relative; width: 100%; margin-bottom: 8px; user-select: none; }
.timeline-popover .custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--z0); border: 1px solid var(--z3); border-radius: 4px;
  padding: 6px 10px; cursor: pointer; color: var(--z15); font-size: 11px;
}
.timeline-popover .custom-select-trigger:hover { border-color: var(--accent9); }
.timeline-popover .custom-select-options {
  position: absolute; top: 100%; left: 0; right: 0; background: var(--z2);
  border: 1px solid var(--z3); border-radius: 4px; margin-top: 4px;
  max-height: 190px; overflow-y: auto; display: none; z-index: 110;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.timeline-popover .custom-select-options.open { display: block; }
.timeline-popover .custom-option {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer;
  border-bottom: 1px solid var(--z1);
}
.timeline-popover .custom-option:hover { background: var(--z3); }
.timeline-popover .custom-option.selected { background: var(--accent14); }
.timeline-popover .option-preview { width: 28px; height: 28px; background: var(--z0); border: 1px solid var(--z3); border-radius: 3px; flex-shrink: 0; }
.timeline-popover .option-text { font-size: 11px; color: var(--z15); flex-grow: 1; }

/* Live motion preview block inside the dropdown option lists */
.timeline-popover .motion-preview-box {
  width: 24px; height: 12px; background: var(--z0); border: 1px solid var(--z3);
  border-radius: 2px; position: relative; overflow: hidden; flex-shrink: 0;
}
.timeline-popover .motion-preview-dot {
  width: 6px; height: 6px; background: var(--accent9); border-radius: 50%;
  position: absolute; top: 3px; left: 0;
}

/* Big interactive bezier curve editor */
.timeline-popover .curve-preview-wrap { margin-bottom: 8px; }
.timeline-popover .curve-big { width: 100%; height: 140px; display: block; background: var(--z1); border: 1px solid var(--z3); border-radius: 4px; }
.timeline-popover .curve-grid { stroke: var(--z3); stroke-width: 1; }
.timeline-popover .curve-diagonal { stroke: var(--z3); stroke-width: 1; stroke-dasharray: 3,3; }
.timeline-popover .curve-path { fill: none; stroke: var(--accent9); stroke-width: 2.2; }
.timeline-popover .handle-line { stroke: var(--z9); stroke-width: 1; stroke-dasharray: 2,2; }
.timeline-popover .handle { fill: var(--accent7); stroke: var(--z15); stroke-width: 1.5; cursor: grab; touch-action: none; }
.timeline-popover .handle:hover { fill: var(--accent9); }
.timeline-popover .handle.disabled { opacity: 0.15; cursor: not-allowed; pointer-events: none; }
.timeline-popover .handle-line.disabled { opacity: 0.15; }
.timeline-popover .bezier-readout { font-size: 10px; color: var(--z9); font-variant-numeric: tabular-nums; text-align: center; }
