/* ===========================================
   Accounts Pages
   ===========================================
   BEM: .account-show, .details, etc.
   =========================================== */

@layer pages {
  .account-show {
    max-width: 60rem;
    margin: 0 auto;
  }

  /* ===========================================
     Details Definition List
     =========================================== */

  .details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-3) var(--space-8);
    margin-bottom: var(--space-6);

    dt {
      font-weight: var(--font-medium);
      color: var(--color-text-muted);
    }

    dd {
      margin: 0;
    }
  }

  .details__breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }

  @media (max-width: 480px) {
    .details {
      display: block;

      dt {
        margin-bottom: var(--space-1);
        font-size: var(--text-sm);
      }

      dd {
        margin-bottom: var(--space-4);
        padding-bottom: var(--space-4);
        border-bottom: 1px solid var(--color-border);
      }

      dd:last-of-type {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
      }
    }
  }

  /* ===========================================
     Selected Plan Card (Billing Page)
     =========================================== */

  .card.is-selected {
    position: relative;
    border: 2px solid var(--color-text);
    box-shadow: none;
  }

  .card.is-selected::before {
    content: "Current plan";
    position: absolute;
    top: 0;
    right: 0;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-white);
    background-color: var(--color-text);
    border-bottom-left-radius: var(--radius-sm);
  }

  .btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
  }

  /* ===========================================
     Account Tabs Navigation (underlined, like .tabs)
     =========================================== */

  .account-tabs {
    margin-bottom: var(--space-6);
  }

  .account-tabs__list {
    display: flex;
    gap: var(--space-6);
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
  }

  .account-tabs__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 2.75rem;
    margin-bottom: -1px;
    font-weight: var(--font-medium);
    white-space: nowrap;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;

    &:hover {
      color: var(--color-text);
      border-bottom-color: var(--color-gray-400);
    }

    &.is-active {
      font-weight: var(--font-semibold);
      color: var(--color-text);
      border-bottom-color: var(--color-text);
    }
  }
}

@layer pages {
  .billing-plans {
    th[scope="row"] {
      font-weight: var(--font-normal);
    }

    .billing-plans__name {
      display: block;
      font-weight: var(--font-semibold);
    }

    .billing-plans__features {
      display: block;
      max-width: 36ch;
      font-size: var(--text-sm);
      color: var(--color-text-muted);
    }

    .billing-plans__price {
      font-weight: var(--font-bold);
    }

    .billing-plans__action {
      text-align: right;
    }

    .billing-plans__current {
      font-weight: var(--font-semibold);
    }

    tr.is-current th,
    tr.is-current td {
      border-bottom-color: var(--color-text);
    }
  }

  .billing-plans .billing-plans__note {
    display: block;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }

  .billing-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-6);

    a {
      color: var(--color-text);
      text-decoration: underline;
      text-underline-offset: 0.2em;
    }
  }

  /* Irreversible account actions: separated by a rule, outline button, no red box */
  .danger-zone {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);

    h2 {
      margin: 0 0 var(--space-2);
      font-size: var(--text-lg);
      font-weight: var(--font-semibold);
    }

    p {
      margin: 0 0 var(--space-4);
      color: var(--color-text-muted);
    }
  }

  .notification-settings {
    margin: 0 0 var(--space-4);
    padding: 0;
    border: 0;

    .form__checkbox-label {
      font-size: var(--text-base);
    }
  }

  .danger-zone p {
    max-width: 60ch;
  }
}
