@use '../../../shared/styles/settings-shared' as settings;

.file-naming-container {
  @include settings.settings-page-container;
}

@include settings.settings-page-header;
@include settings.settings-section-divider;

.settings-title {
  @include settings.settings-page-title;
  margin-bottom: 0.75rem;
}

.settings-description {
  @include settings.settings-page-description;
}

.warning-notice {
  margin-top: -2rem;
  margin-bottom: 1rem;
  @include settings.settings-warning-notice;
}

.settings-card {
  @include settings.settings-card;
}

.section-header {
  @include settings.settings-section-header;
}

.section-title {
  @include settings.settings-section-title;
}

.section-description {
  @include settings.settings-section-description;
}

.section-body {
  @include settings.settings-section-body;
}

// Empty state
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--p-text-muted-color);
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border-radius: 6px;

  .pi {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
  }

  .empty-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--p-text-color);
  }

  .empty-subtitle {
    font-size: settings.$settings-section-description-size;
    margin: 0;
  }
}

// Default pattern card
.default-pattern-card {
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border: 1px solid var(--p-content-border-color);
  border-left: 3px solid var(--p-primary-color);
  border-radius: 6px;
  padding: 1rem;
}

.pattern-input-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pattern-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;

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

    p-button {
      align-self: flex-end;
    }
  }
}

.pattern-input {
  flex: 1;
  width: 100%;
}

.error-text {
  @include settings.settings-error-text;
}

.preview-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;

  @media (max-width: 768px) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

.preview-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--p-text-muted-color);
  font-size: settings.$settings-section-description-size;
  white-space: nowrap;

  .pi {
    font-size: 0.75rem;
  }
}

.preview-value {
  color: var(--p-green-400);
  font-size: settings.$settings-section-description-size;
  background: transparent;
  padding: 0;
  word-break: break-all;
}

// Libraries list
.libraries-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.library-item {
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border: 1px solid var(--p-content-border-color);
  border-left: 3px solid var(--p-content-border-color);
  border-radius: 6px;
  transition: border-color 0.2s ease, background 0.2s ease;

  &:hover {
    background: color-mix(in srgb, var(--ground-background) 40%, var(--p-surface-800) 60%);
  }

  &.has-pattern {
    border-left-color: var(--p-primary-color);
  }
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px dashed var(--p-content-border-color);

  @media (max-width: 600px) {
    flex-wrap: wrap;
  }
}

.library-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.library-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
  color: var(--p-primary-color);
  border-radius: 6px;
  flex-shrink: 0;

  .pi {
    font-size: 0.875rem;
  }
}

.library-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--p-text-color);
}

.custom-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
  color: var(--p-primary-color);
  border-radius: 12px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
}

.default-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background: color-mix(in srgb, #6b7280 15%, transparent);
  color: #6b7280;
  border-radius: 12px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
}

.library-body {
  padding: 0.75rem 1rem;
}

.actions-row {
  @include settings.settings-actions-row;
  margin-top: 0.5rem;
}

// Placeholders Reference Section
.placeholders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;

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

.placeholder-group {
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border-radius: 6px;
  padding: 1rem;
  border-left: 3px solid var(--p-primary-color);

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

.group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: settings.$settings-label-size;
  font-weight: 600;
  color: var(--p-text-color);
  margin: 0 0 0.75rem 0;

  .pi {
    color: var(--p-primary-color);
    font-size: 0.875rem;
  }
}

.group-description {
  font-size: settings.$settings-section-description-size;
  line-height: 1.5;
  color: var(--p-text-muted-color);
  margin: 0 0 0.75rem 0;

  code {
    color: var(--p-orange-400);
    font-size: settings.$settings-description-size;
  }
}

.placeholder-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.placeholder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: settings.$settings-section-description-size;

  code {
    color: var(--p-orange-400);
    font-size: settings.$settings-description-size;
    min-width: 130px;
  }

  span {
    color: var(--p-text-muted-color);
  }
}

.example-block {
  background: color-mix(in srgb, var(--p-surface-800) 30%, transparent);
  border-radius: 4px;
  padding: 0.75rem;
}

.example-pattern {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;

  .pattern-prefix {
    font-size: settings.$settings-description-size;
    color: var(--p-text-muted-color);
  }

  code {
    color: var(--p-orange-400);
    font-size: settings.$settings-section-description-size;
  }
}

.example-results {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: settings.$settings-section-description-size;

  .result-prefix {
    font-size: settings.$settings-description-size;
    color: var(--p-text-muted-color);
    min-width: 70px;
  }

  code {
    color: var(--p-green-400);
    font-size: settings.$settings-description-size;
  }
}

// Pattern Examples Section
.examples-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.metadata-reference {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;

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

.metadata-panel {
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  border-left: 3px solid var(--p-content-border-color);

  &.metadata-panel-full {
    border-left-color: var(--p-green-400);
  }

  &.metadata-panel-partial {
    border-left-color: var(--p-orange-400);
  }
}

.metadata-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: settings.$settings-label-size;
  font-weight: 600;
  color: var(--p-text-color);
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid color-mix(in srgb, var(--p-content-border-color) 50%, transparent);

  .pi {
    font-size: 0.875rem;
  }
}

.metadata-icon-full {
  color: var(--p-green-400);
}

.metadata-icon-partial {
  color: var(--p-orange-400);
}

.metadata-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.75rem;
  font-size: settings.$settings-section-description-size;
  align-items: baseline;
}

.metadata-key {
  color: var(--p-text-muted-color);
  font-weight: 500;
  white-space: nowrap;

  &::after {
    content: ':';
  }
}

.metadata-val {
  color: var(--p-text-color);
  font-size: settings.$settings-description-size;

  &.not-set {
    opacity: 0.5;
    font-style: italic;
    color: var(--p-text-muted-color);
  }
}

.example-category {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: settings.$settings-label-size;
  font-weight: 600;
  color: var(--p-text-color);
  margin: 0;

  .pi {
    font-size: 0.875rem;
    color: var(--p-primary-color);
  }
}

.example-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.example-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border-radius: 4px;
  font-size: settings.$settings-section-description-size;
  align-items: center;

  @media (max-width: 1024px) {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }
}

.example-row-conditional {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
  border-radius: 4px;
  font-size: settings.$settings-section-description-size;
  align-items: start;

  @media (max-width: 1024px) {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }
}

.pattern-label {
  color: var(--p-text-muted-color);
  font-size: settings.$settings-section-description-size;
  white-space: nowrap;

  @media (max-width: 1024px) {
    font-weight: 500;
    color: var(--p-text-color);
  }
}

.pattern-col {
  code {
    color: var(--p-orange-400);
    font-size: settings.$settings-description-size;
    word-break: break-all;
  }

  @media (max-width: 1024px) {
    padding-left: 0.5rem;
  }
}

.result-col {
  code {
    color: var(--p-green-400);
    font-size: settings.$settings-description-size;
    word-break: break-all;
  }

  @media (max-width: 1024px) {
    padding-left: 0.5rem;
    border-left: 2px solid var(--p-green-400);
  }
}

.result-col-dual {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;

  code {
    font-size: settings.$settings-description-size;
    word-break: break-all;
  }

  .pi {
    font-size: 0.625rem;
    margin-right: 0.25rem;
  }
}

.result-with {
  color: var(--p-green-400);

  .pi {
    color: var(--p-green-400);
  }

  code {
    color: var(--p-green-400);
  }
}

.result-without {
  color: var(--p-orange-400);

  .pi {
    color: var(--p-orange-400);
  }

  code {
    color: var(--p-orange-400);
  }
}
