:host {
  display: block;
  width: 100%;
  position: relative;
}

.timeline-component-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  box-sizing: border-box;
}

.timeline-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.control-btn {
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  outline: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition:
    background-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
  &:hover {
    background-color: #fff;
    color: #111;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  }
  mat-icon {
    font-size: 20px;
    width: 20px;
    height: 20px;
  }
}

.search-container {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid #ccc;
  border-radius: 18px;
  height: 36px;
  box-sizing: border-box;
  transition:
    background-color 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

  &.expanded {
    background-color: #fff;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  }

  .control-btn {
    background: transparent;
    border: none;
    box-shadow: none;
    &:hover {
      background: transparent;
      box-shadow: none;
      color: #111;
    }
  }
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  padding: 0 0 0 12px;
  font-size: 13px;
  width: 150px;
  color: #333;
  font-family: Roboto, sans-serif;
  box-sizing: border-box;
}

.timeline-chart-area {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.y-axis-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 11px;
  color: #666;
  font-weight: 500;
  margin-right: 6px;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.x-axis-label {
  text-align: center;
  font-size: 11px;
  color: #666;
  font-weight: 500;
  margin-top: 6px;
  user-select: none;
}

.canvas-container {
  flex-grow: 1;
  height: 400px;
  position: relative;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  background-color: #fafafa;
}

canvas:active {
  cursor: grabbing;
}

// Fullscreen Styles
:host {
  .timeline-component-wrapper:fullscreen,
  .timeline-component-wrapper.fullscreen {
    background-color: #fff;
    padding: 24px;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;

    .timeline-chart-area {
      flex-grow: 1;
      min-height: 60vh;
    }

    .canvas-container {
      height: 100%;
    }

    .selected-block-card {
      margin: 20px 0 0 0;
      flex-shrink: 0;
    }
  }
}

.timeline-tooltip {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  font-family: Roboto, sans-serif;
  font-size: 11px;
  color: #333;
  max-width: 350px;
  z-index: 100;
  box-sizing: border-box;
}

.tooltip-row {
  display: flex;
  margin-bottom: 2px;
  align-items: flex-start;
}

.tooltip-title {
  font-weight: bold;
  word-break: break-all;
  color: #111;
  font-size: 12px;
}

.tooltip-label {
  font-weight: bold;
  margin-right: 4px;
  color: #555;
  flex-shrink: 0;
}

.tooltip-value {
  word-break: break-all;
}

.tooltip-divider {
  border: 0;
  border-top: 1px solid #e0e0e0;
  margin: 4px 0;
}

.selected-block-card {
  position: sticky;
  bottom: 0;
  background-color: var(--mat-card-background-color, #fff);
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 20px;
  padding: 16px;
  z-index: 10;

  .card-header {
    border-bottom: 1px solid #eee;
    margin-bottom: 12px;
    padding-bottom: 8px;
    h3 {
      margin: 0;
      font-size: 16px;
      font-weight: 500;
      word-break: break-all;
    }
  }

  .metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
  }

  .metadata-item {
    display: flex;
    flex-direction: column;
  }

  .metadata-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    margin-bottom: 2px;
  }

  .metadata-value {
    font-size: 14px;
    color: #333;
    word-break: break-all;
    a {
      color: #1a73e8;
      text-decoration: none;
      &:hover {
        text-decoration: underline;
      }
    }
  }

  .full-width-metadata-item {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
  }
}
