/* History Panel */
#history-accordion .odt-accordion-header {
  position: relative;
  cursor: pointer;
  user-select: none;
}

#history-accordion .odt-accordion-header::after {
  content: '›';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  font-size: 24px;
  color: #94a3b8;
  transition: transform 0.2s ease-in-out;
}

#history-accordion .odt-accordion-header.expanded::after {
  transform: translateY(-50%) rotate(-90deg);
}

.odt-accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease-in-out;
}

.odt-accordion-body.expanded {
  grid-template-rows: 1fr;
}

.odt-accordion-body > div {
  overflow: hidden;
}

/* Controls container: keep buttons inline, centered, and spaced */
#history-accordion .odt-accordion-header .history-controls {
  display: flex; /* Ensure flex display */
  gap: 0.5rem;
  margin-left: auto;
  align-items: center;
  flex-direction: row; /* Ensure row direction */
  flex-wrap: nowrap; /* Prevent buttons from wrapping */
  min-width: 80px; /* Ensure enough space for two buttons */
  flex-shrink: 0; /* Prevent the controls container from shrinking */
  position: absolute;
  right: 40px; /* Adjust this value to create space for the arrow */
  top: 50%;
  transform: translateY(-50%);
}

#history-accordion .odt-accordion-header {
  position: relative;
  flex-wrap: nowrap; /* Prevent header content from wrapping */
}

/* Icon buttons: slightly larger, rounded, soft background and subtle shadow */
#history-accordion .history-controls .odt-btn.icon-btn {
  padding: 0;
  height: 36px;
  min-width: 36px;
  width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 2px 6px rgba(2, 6, 23, 0.06);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Make the SVGs punchier */
#history-accordion .history-controls .odt-btn.icon-btn svg {
  width: 20px; /* Slightly larger icons */
  height: 20px;
  stroke-width: 1.8; /* Slightly thicker stroke for better visibility */
  color: #0f172a;
}

/* Hover / active affordances */
#history-accordion .history-controls .odt-btn.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.09);
  background: linear-gradient(180deg, #eef2ff, #e0f2ff);
}

/* Disabled appearance */
#history-accordion .history-controls .odt-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: #f3f4f6;
}

/* Keep buttons slightly smaller on very narrow screens */
@media (max-width: 480px) {
  #history-accordion .history-controls .odt-btn.icon-btn {
    height: 34px;
    width: 34px;
  }
}

#history-counter {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.35rem;
}
#history-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  background: #fff;
}
.odt-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
}
.odt-history-item:hover {
  background: #f8fafc;
}
.odt-history-item.active {
  background: #eef2ff;
}
.odt-history-item .title {
  font-size: 0.85rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.odt-history-item .meta {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-left: 0.5rem;
}

@media (min-width: 900px) {
  #history-list {
    max-height: 320px;
  }
}

/* Undo/Redo Animations on the canvas container */
@keyframes odt-undo-pop {
  0% { transform: scale(0.985); filter: saturate(0.9); opacity: 0.85; }
  100% { transform: scale(1); filter: saturate(1); opacity: 1; }
}
@keyframes odt-redo-slide {
  0% { transform: translateX(6px); opacity: 0.85; }
  100% { transform: translateX(0); opacity: 1; }
}
.odt-canvas-inner.animate-undo {
  animation: odt-undo-pop 0.24s ease-out;
}
.odt-canvas-inner.animate-redo {
  animation: odt-redo-slide 0.24s ease-out;
}
