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

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

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

.section-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;

  @media (max-width: 767px) {
    flex-direction: column;
    align-items: stretch;

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

.section-header-text {
  flex: 1;
}

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

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

.section-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

// 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;
  }
}

// Provider list
.providers-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.provider-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;
  padding: 1rem;
  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%);
  }

  &.is-default {
    border-left-color: var(--p-primary-color);
  }
}

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

  @media (max-width: 767px) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
}

.provider-info {
  flex: 1;
  min-width: 0;
}

.provider-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

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

.name-input {
  width: 200px;
  max-width: 100%;
}

.shared-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: color-mix(in srgb, var(--p-green-600) 20%, transparent);
  color: var(--p-green-400);
  border-radius: 4px;
  font-size: 0.75rem;

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

.default-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: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.provider-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;

  @media (max-width: 767px) {
    justify-content: flex-end;
  }
}

// Provider details grid
.provider-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;

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

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;

  &.detail-item-wide {
    grid-column: span 2;

    @media (max-width: 767px) {
      grid-column: span 1;
    }
  }

  input {
    width: 100%;
  }
}

.detail-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: settings.$settings-description-size;
  font-weight: 500;
  color: var(--p-text-muted-color);

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

.detail-value {
  font-size: settings.$settings-section-description-size;
  color: var(--p-text-color);
  word-break: break-word;

  &.password-hidden {
    color: var(--p-text-muted-color);
    font-style: italic;
    letter-spacing: 2px;
  }
}

// Toggle options
.toggle-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--p-content-border-color);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-label {
  font-size: settings.$settings-description-size;
  color: var(--p-text-color);
  cursor: pointer;
}
