// Variables matching reader styling
$dialog-bg: #1a1a1a;
$text-primary: rgba(255, 255, 255, 0.95);
$text-secondary: rgba(255, 255, 255, 0.6);
$text-muted: rgba(255, 255, 255, 0.4);
$border-color: rgba(255, 255, 255, 0.08);
$hover-bg: rgba(255, 255, 255, 0.08);
$active-color: #818cf8;
$active-bg: rgba(129, 140, 248, 0.15);
$transition-fast: 150ms ease;
$transition-normal: 200ms ease;

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 13000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn $transition-normal;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dialog {
  background: $dialog-bg;
  border: 1px solid $border-color;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.dialog-header {
  padding: 16px 20px;
  border-bottom: 1px solid $border-color;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);

  h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: $text-primary;
    letter-spacing: -0.3px;
  }
}

.close-btn {
  background: none;
  border: none;
  color: $text-muted;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background $transition-fast, color $transition-fast;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;

  &:hover {
    background: $hover-bg;
    color: $text-primary;
  }
}

.dialog-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;

    &:hover {
      background: rgba(255, 255, 255, 0.25);
    }
  }
}

.section-label {
  display: block;
  color: $text-muted;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.selected-text-section {
  .selected-text {
    margin: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid $active-color;
    border-radius: 0 8px 8px 0;
    color: $text-secondary;
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
    max-height: 100px;
    overflow-y: auto;
  }
}

.note-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.note-input {
  flex: 1;
  min-height: 120px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid $border-color;
  border-radius: 8px;
  color: $text-primary;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color $transition-fast, box-shadow $transition-fast;

  &::placeholder {
    color: $text-muted;
  }

  &:focus {
    outline: none;
    border-color: $active-color;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
  }
}

.color-section {
  .color-buttons {
    display: flex;
    gap: 10px;
  }
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--color);
  cursor: pointer;
  transition: transform $transition-fast, border-color $transition-fast, box-shadow $transition-fast;
  position: relative;

  &:hover {
    transform: scale(1.1);
  }

  &.selected {
    border-color: $text-primary;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);

    &::after {
      content: '✓';
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 14px;
      font-weight: bold;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
  }
}

.dialog-footer {
  padding: 16px 20px;
  border-top: 1px solid $border-color;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background $transition-fast, transform $transition-fast, opacity $transition-fast;
  border: none;

  &:active {
    transform: scale(0.98);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }
}

.btn-secondary {
  background: $hover-bg;
  color: $text-primary;

  &:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
  }
}

.btn-primary {
  background: $active-color;
  color: white;

  &:hover:not(:disabled) {
    background: #9ba3fa;
  }
}
