@use '../../../styles/_globals.scss' as *;

.page-settings {
  text-align: start;

  .settings-container {
    max-width: 100%;
  }

  .settings-tabs {
    // Prevent focus-induced scroll jumps: Material tab body containers default to
    // overflow:auto/hidden, which makes the browser's focus-scrolling algorithm
    // treat them as scroll boundaries and reset the parent scroll position.
    ::ng-deep .mat-mdc-tab-body-wrapper,
    ::ng-deep .mat-mdc-tab-body-active,
    ::ng-deep .mat-mdc-tab-body-content {
      overflow: visible !important;
    }

    ::ng-deep .mat-mdc-tab-header {
      border-bottom: 1px solid var(--divider-color);
      margin-bottom: var(--s2);
    }

    ::ng-deep .mat-mdc-tab {
      min-width: 120px;

      @include mq(md, max) {
        min-width: 48px;
        padding: 0 12px;
      }
    }

    .tab-icon {
      margin-inline-end: 8px;
      font-size: 20px;
      width: 20px;
      height: 20px;

      @include mq(md, max) {
        margin-inline-end: 0;
        font-size: 24px;
        width: 24px;
        height: 24px;
      }
    }

    .tab-label {
      @include mq(md, max) {
        display: none;
      }
    }
  }

  .tab-content {
    padding-top: var(--s2);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
  }

  collapsible {
    position: relative;
  }

  .config-section {
    border: 1px solid var(--divider-color);
    break-inside: avoid;
    margin-bottom: 10px;
    border-radius: var(--card-border-radius);
    background: var(--card-bg);

    background-color: var(--card-bg);

    .md-title {
      margin-top: 0;
    }

    ::ng-deep .collapsible-header {
      border-bottom: 1px solid transparent;
    }

    ::ng-deep .isExpanded .collapsible-header {
      font-weight: bold;

      border-color: var(--extra-border-color);
    }
  }

  .settings-col {
    margin-bottom: 30px;

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

  @include mq(xs, max) {
    .keyboard-settings {
      display: none;
    }
  }
}

.sync-summary {
  padding: var(--s2);

  &__intro {
    margin: 0 0 var(--s2);
    color: var(--text-color-muted);
  }

  &__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s2);
    margin-bottom: var(--s2);
  }

  &__provider {
    display: inline-flex;
    align-items: center;
    gap: var(--s-half);
    font-weight: 500;

    mat-icon {
      font-size: 20px;
      width: 20px;
      height: 20px;
    }
  }

  &__pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s-half);
    padding: var(--s-half) var(--s);
    border: 1px solid var(--divider-color);
    border-radius: 999px;
    font-size: 12px;

    mat-icon {
      font-size: 14px;
      width: 14px;
      height: 14px;
    }

    &--warn {
      border-color: var(--color-warning);
      color: var(--color-warning);
    }
  }

  &__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s);
  }
}

.version-footer {
  margin-top: auto;
  text-align: center;
  font-style: italic;
  padding: var(--s3);

  a[href] {
    color: inherit;
  }

  // Monospace + upright so the channel suffix (I / l / 1 / L) stays readable
  // — the version is what we ask users for in triage.
  .version {
    font-family: var(--font-mono-stack);
    font-style: normal;

    mat-icon {
      font-size: 1em;
      width: 1em;
      height: 1em;
      vertical-align: middle;
      margin-left: var(--s-quarter);
      opacity: var(--muted-alpha);
    }
  }
}

:host .config-section ::ng-deep {
  $this-panel-padding-left-right: 12px;

  .collapsible-header {
    font-size: 16px;
    margin-top: 0;
    padding: 10px $this-panel-padding-left-right;
  }

  .collapsible-panel {
    overflow: visible;

    > * {
      padding: 0 $this-panel-padding-left-right;
    }
  }
}
