// Variables matching sidebar 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: 12000;
  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: 800px;
  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);

  @media (max-width: 768px) {
    width: 95%;
    max-height: 90vh;
    margin: 20px;
  }
}

@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;
  font-size: 18px;
  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;
  }

  &:focus-visible {
    outline: 2px solid $active-color;
    outline-offset: 2px;
  }
}

.dialog-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;

  @media (max-width: 768px) {
    padding: 16px;
  }

  &::-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);
    }
  }
}

.metadata-container {
  display: flex;
  gap: 24px;

  @media (max-width: 768px) {
    flex-direction: column;
    gap: 20px;
  }
}

.cover-section {
  flex-shrink: 0;
  width: 200px;

  @media (max-width: 768px) {
    width: 100%;
    max-width: 160px;
    margin: 0 auto;
  }
}

.book-cover {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-height: 300px;
  object-fit: cover;

  @media (max-width: 768px) {
    max-height: 240px;
  }
}

.cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;

  @media (max-width: 768px) {
    max-height: 240px;
  }

  .placeholder-icon {
    font-size: 56px;
    opacity: 0.3;

    @media (max-width: 768px) {
      font-size: 44px;
    }
  }
}

.metadata-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.metadata-group {
  animation: fadeIn $transition-normal;

  &:not(:last-child) {
    padding-bottom: 16px;
    border-bottom: 1px solid $border-color;
  }
}

.section-title {
  color: $text-muted;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 12px 0;
}

.metadata-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  margin-bottom: 10px;
  align-items: start;

  &:last-child {
    margin-bottom: 0;
  }

  @media (max-width: 768px) {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.label {
  color: $text-secondary;
  font-size: 13px;
  font-weight: 500;
}

.value {
  color: $text-primary;
  font-size: 13px;
  word-break: break-word;
  line-height: 1.5;

  &.file-name {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 12px;
    color: $text-secondary;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 8px;
    border-radius: 4px;
  }
}

.review-count {
  color: $text-muted;
  font-size: 12px;
  margin-left: 4px;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: $active-bg;
  color: $text-primary;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(129, 140, 248, 0.2);
  transition: background $transition-fast;

  &:hover {
    background: rgba(129, 140, 248, 0.25);
  }
}

.description {
  color: $text-secondary;
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  white-space: pre-wrap;
}
