/* ==========================================================================
   Retirement
   ========================================================================== */

// This is your project's main SCSS file.
// Project-specific SCSS rules go after the imports.

@use 'sass:math';
@use '@cfpb/cfpb-design-system/src/abstracts' as *;

#claiming-social-security {
  .input-labels__block .cf-icon-svg {
    margin-top: 1px;
  }

  .canvas-container {
    position: relative;
  }

  .canvas-container .x-axis-label {
    position: relative;
    top: 0;
    left: 40px;
  }

  p.y-axis-label {
    position: absolute;
    top: 290px;
    left: -50px;
    transform: rotate(-90deg);
  }

  .step-one-hidden,
  .before-step-two,
  .step-two,
  .step-two + hr,
  .step-three {
    display: none;
  }

  .intro {
    margin-top: 15px;
    margin-bottom: 30px;

    .content-l__col + .content-l__col {
      margin-top: 0;
    }
  }

  // Desktop and above.
  @include respond-to-min($bp-med-min) {
    .intro {
      margin-bottom: 45px;

      .img {
        height: 200px;
        width: 200px;
        background-size: 200px;
        background-repeat: no-repeat;
        background-image: url('/static/apps/retirement/img/before-you-claim.png');
      }
    }
  }

  h1 span.header-line {
    display: block;
  }

  .intro p {
    max-width: 41.875rem;
  }

  .step-one {
    padding-bottom: 14px;
    padding-top: 45px;
  }

  .step-one h2 {
    margin-bottom: 30px;
  }

  .step-one label.input-labels .input-labels__block {
    display: block;
    margin-bottom: 8px;
  }

  .step-one .input-labels input {
    height: 32px;
    padding-left: 10px;
  }

  .estimated-benefits-description {
    margin: 1em 0 0;
    padding: 1em 0;
    border-top: 1px solid var(--gray-20);
    border-bottom: 1px solid var(--gray-20);

    p {
      margin-bottom: 0;
    }
  }

  .estimated-benefits-input {
    margin: 0;
    padding: 0 0 30px 40px;
  }

  #graph-container .content-l__col {
    margin-top: 0;
    padding: 30px 0 60px;
  }

  .step-one .content-l__col {
    vertical-align: bottom;
  }

  #claim-canvas {
    position: relative;
    left: 40px;

    #full-age-benefits-text {
      color: var(--gray-60);
    }

    .graph--bar {
      cursor: pointer;
    }

    .graph--element {
      position: absolute;
    }

    .graph--background {
      background: var(--gray-10);
      height: 1px;
      left: 0;
    }

    .graph__slider {
      width: 100%;
      position: absolute;
      bottom: 0;
      left: -2px;
      z-index: 100;
    }

    .age-text {
      color: var(--gray-60);
      cursor: pointer;
      position: absolute;
      top: 292px;
      height: 75px;
      text-align: center;

      &.selected-age {
        height: 25px;

        p {
          color: var(--black);
          font-weight: bolder;
        }
      }
    }
  }

  #benefits-text,
  #full-age-benefits-text {
    position: absolute;
    font-weight: bolder;
  }

  .claim-canvas__no-slider {
    .graph__slider {
      display: none;
    }

    & ~ .x-axis-label {
      margin-top: -45px;
    }
  }

  .lifetime-benefits-value {
    font-weight: bolder;
  }

  .estimated-benefits-input label {
    display: inline;
    margin-left: 15px;
  }

  input[type='text'] {
    border: 1px solid var(--gray-80);
    border-color: var(--gray-40);
  }

  .input-labels {
    display: inline;
  }

  .input-labels .label-text {
    display: block;
    text-indent: 100%;
    white-space: nowrap;
    overflow: hidden;
  }

  .input-labels input {
    display: inline;
    width: 15%;
    padding: 2px;
  }

  #bd-year {
    width: 30%;
  }

  #salary-input {
    width: 90%;
  }

  .step-one .estimate-info {
    vertical-align: bottom;
    margin-top: 0;
  }

  .step-one .estimate-info p {
    margin-bottom: -5px;
  }

  .step-one .step-one-instructions {
    margin-bottom: 60px;
  }

  #step-one-form {
    margin-top: 0;
    padding: 0;
  }

  .selected-retirement-age-container {
    margin-bottom: 30px;

    p {
      margin-bottom: 0;
    }
  }

  .selected-retirement-age {
    margin-bottom: 2px;
  }

  .total-benefits-text {
    font-weight: normal;
    line-height: 24px;
  }

  .total-benefits-container {
    margin-bottom: 30px;

    p {
      margin: 0;
    }
  }

  #age-selector-response {
    display: none;
  }

  #graph-container + hr {
    margin-top: 0;
  }

  .graph-content .content-container {
    display: none;
  }

  .graph-content .content-container ul {
    padding-left: 20px;
    list-style-position: outside;
  }

  .graph-content h3.retirement-age {
    font-size: 1em;
    font-weight: 500;
    margin: 0;
  }

  #graph-container p.learn-how {
    margin-bottom: 0;
  }

  hr.before-step-two {
    margin-bottom: 45px;
  }

  .content-l.step-two {
    margin-top: 60px;
  }

  .step-two .lifestyle-img {
    display: block;
    margin: 60px auto;
  }

  .step-two .lifestyle-response {
    display: none;
  }

  .step-two .lifestyle-btn--active {
    background-color: var(--navy);
  }

  .step-two + hr {
    margin: 50px 0;
  }

  .step-two .content-l__col.content-l__col-1-3 {
    height: 100%;
  }

  .step-two .lifestyle-question__container {
    margin-bottom: 30px;
  }

  .step-two .lifestyle-question__container hr {
    margin-top: 0;
  }

  .step-two .question,
  .step-three .hidden-content {
    display: none;
  }

  .step-three h2 {
    margin-bottom: 30px;
  }

  .step-three h3 {
    margin-bottom: 5px;
  }

  .step-three .step-three-note {
    margin-bottom: 30px;
  }

  #age-selector-response hr {
    margin-top: 40px;
    margin-bottom: 30px;
  }

  #age-selector-response .next-steps {
    padding-left: 0;
    padding-top: 20px;
    margin-bottom: 60px;

    li {
      background-repeat: no-repeat;
      background-position: 0 0;
      padding-left: 34px;
    }

    li.next-step-one,
    li.next-step-three {
      background-image: url('/static/apps/retirement/img/step_check.png');
    }
  }

  /* cf-notification */
  .m-notification {
    margin-bottom: 20px;
  }

  .step-one .notification-input-warning {
    border-color: var(--gold);
  }

  /* ====================================================================
     Medium and small screens
  ==================================================================== */

  // Tablet and below.
  @include respond-to-max($bp-sm-max) {
    #step-one-form {
      margin-bottom: 30px;
    }

    .step-one .step-one-instructions {
      margin-bottom: 30px;
    }

    .m-notification {
      margin-top: -10px;
    }

    .estimated-benefits-input {
      padding-left: 40px;

      & span {
        display: block;
      }

      & label {
        margin-left: 15px;

        &:first-of-type {
          margin-left: 0;
        }
      }
    }

    .step-two .lifestyle-response > p:last-child {
      margin-bottom: 0;
    }
  }

  /* ====================================================================
     Medium screens
  ==================================================================== */

  // Tablet only.
  @include respond-to-range($bp-sm-min, $bp-sm-max) {
    .step-one {
      padding-top: 30px;
    }

    .step-one .content-l__col-2-3,
    .estimate-info {
      width: 100%;
    }

    #graph-container .content-l__col-1-3 {
      width: 40%;
    }

    #graph-container .content-l__col-2-3 {
      width: 60%;
    }

    p.y-axis-label {
      top: 310px;
    }

    .content-l.step-two {
      margin-top: 0;
      margin-right: 15px;
      margin-left: 0;
    }

    .step-two .content-l__col {
      margin-right: 0;
      width: 100%;
    }

    .content-l.step-two h2 {
      margin-bottom: 0;
    }

    .content-l.step-two h2 + .question.h3 {
      margin-top: 15px;
      margin-bottom: 30px;
    }

    div.question {
      border-top: 1px solid var(--gray-20);
      margin-right: 25px;
      margin-left: 15px;
      padding-top: 30px;
      padding-bottom: 30px;
    }

    div.question.question-married {
      border-top: none;
    }

    div.question.question-longevity {
      padding-bottom: 10px;
    }

    .question::before,
    .question::after {
      display: table;
      content: '';
    }

    .question::after {
      clear: both;
    }

    .question hr {
      display: none;
    }

    .step-two .lifestyle-img {
      display: block !important;
      float: left;
      height: 200px !important;
      margin: 0;
      width: 200px !important;
    }

    .step-two .lifestyle-question__container,
    .step-two .lifestyle-response {
      margin-left: 230px;
    }

    hr.before-step-two {
      margin-bottom: 60px;
    }

    .content-l.step-two + hr {
      margin-top: 60px;
      margin-bottom: 60px;
    }
  }

  /* ====================================================================
     Small screens
  ==================================================================== */

  // Mobile only.
  @include respond-to-max($bp-xs-max) {
    .content-l {
      margin-left: 0;
      margin-right: 0;
    }

    .content-l__col {
      border: none;
      display: block;
      width: auto;
    }

    .step-one {
      padding-top: 30px;
    }

    #step-one-form .content-l__col-1-3 {
      max-width: 236px;
    }

    #salary-input {
      width: 65%;
    }

    .estimated-benefits-input {
      padding-left: 0;

      & label {
        display: block;
        margin-left: 0;
        height: 30px;

        &:first-of-type {
          margin-top: 8px;
          margin-left: 0;
        }
      }
    }

    #graph-container .content-l__col {
      padding-top: 30px;
      padding-bottom: 30px;
    }

    .graph__slider {
      bottom: -35px;
    }

    p.y-axis-label {
      top: 240px;
      left: -57px;
    }

    #step-one-form
      .content-l__col.content-l__col-1-3
      + .content-l__col.content-l__col-1-3 {
      margin-top: 1.875em;
    }

    .content-l__col.content-l__col-1-3 + .content-l__col.content-l__col-1-3 {
      margin-top: 0;
    }

    .canvas-container .x-axis-label {
      top: 30px;
    }

    .selected-retirement-age-container {
      height: auto;
      margin-top: 425px;
    }

    .canvas-container {
      position: absolute;
      top: 0;
      width: 100%;
    }

    .content-l.step-two {
      margin-top: 0;
    }

    .step-two .content-l__col {
      width: 100%;
    }

    .content-l.step-two h2 {
      margin-bottom: 0;
    }

    .content-l.step-two h3.lifestyle-question {
      font-size: 22px;
    }

    .question {
      border-bottom: 1px solid var(--gray-20);
      padding-top: 30px;
      padding-bottom: 30px;
    }

    .step-two .lifestyle-question__container {
      margin-bottom: 0;
    }

    .lifestyle-question__container hr {
      display: none;
    }

    .step-two .lifestyle-img {
      display: inline-block;
      margin-top: 0;
      margin-bottom: 15px;
      max-width: 200px;
    }

    .content-l.step-two h2 + .question.h3 {
      border-bottom: none;
      margin-top: 15px;
      margin-bottom: 0;
      padding-top: 0;
    }

    .question.question-married {
      border-top: none;
      padding-top: 0;
    }

    .question-longevity {
      border-bottom: none;
      padding-bottom: 0;
    }

    .question-longevity .lifestyle-question__container {
      margin-bottom: 0;
    }

    .lifestyle-response {
      margin-top: 30px;
    }

    hr.before-step-two,
    .content-l.step-two + hr {
      margin-top: 30px;
      margin-bottom: 30px;
    }
  }

  /* TOOLTIPS */
  div[data-tooltip-name] {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
  }

  *[data-tooltip-target] {
    cursor: pointer;
    border-bottom: none;
    color: var(--pacific);
  }

  #tooltip-container {
    background-color: var(--gray-10);
    border: 0 solid var(--black);
    display: none;
    font-style: normal;
    padding: 15px;
    position: absolute;
    width: 20em;
    z-index: 3000;

    .content {
      padding: 0;
      margin: 0;
    }

    .content p:last-child {
      margin-bottom: 0;
    }

    /* These elements, .outertip and .innertip, make the little speech-balloon
     styled tip appear along the top of the tooltip. */
    .outertip {
      border: 0 solid transparent;
      border-bottom-color: var(--black);
      content: ' ';
      height: 0;
      position: absolute;
      left: -5px;
      top: -20px;
      width: 0;
    }

    .innertip {
      border: 7px solid transparent;
      border-bottom-color: var(--gray-10);
      content: ' ';
      height: 0;
      position: absolute;
      left: 8px;
      top: -14px;
      width: 0;
    }
  }

  .tooltip-target {
    border-width: 0;
    border-style: dotted;
    border-color: var(--pacific);
    color: var(--pacific);
    cursor: pointer;
    text-decoration: none;
  }
}

/* ====================================================================
    Spanish page overrides
==================================================================== */

[lang='es'] #claiming-social-security {
  .intro {
    margin-top: 30px;

    // Desktop and above.
    @include respond-to-min($bp-med-min) {
      margin-top: 60px;
      .img {
        background-image: url('/static/apps/retirement/img/before-you-claim-es.png');
      }
    }
  }

  .step-two .question-expenses img,
  .step-two .question-working img {
    display: block;
    box-sizing: border-box;
    width: 200px;
    height: 200px;
    padding-left: 200px; /* Move image out of view */

    // Mobile only.
    @include respond-to-max($bp-xs-max) {
      display: inline-block;
    }
  }

  .step-two .question-expenses img {
    background: url('/static/apps/retirement/img/gastos.png') no-repeat;
  }

  .step-two .question-working img {
    background: url('/static/apps/retirement/img/sus60s.png') no-repeat;
  }
}
