body{
  background-color: hsl(202, 86%, 94%);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-style: normal; 
  padding: 0;

}
.container{
  width: 90%;
  margin-left: auto;
  margin-right: auto;
  background-color: hsl(0, 0%, 100%);
  margin-bottom: 15px;

  .topcard{
    width: 100%;
    padding: 1rem;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    background-color: hsl(0, 0%, 100%);
  }

  .bottomcard{
    width: 100%;
    box-sizing: border-box;
  }

  

  /* ====================== INPUT FIELDS ====================== */
  .input {
    margin: 33px 0;
  }

  .input-wrapper {
    width: 100%;
    position: relative;
  }

  .input-wrapper .inp{
    width: 100%;
    height: 50px;
    padding: 10px;
    border: 1.1px solid hsl(200, 26%, 54%);
    border-radius: 5px;
    box-sizing: border-box;
    background-color: hsl(0, 0%, 100%);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
  }

  .input-wrapper .inp:hover {
    cursor: pointer;
  }

  /* keep border exactly the same as focus  */
  .input-wrapper .inp:focus {
    border: 0.5px solid hsl(61, 70%, 52%);
    box-shadow: 0 0 0 0.5px hsla(61, 70%, 52%, 0.15);
  }

  /* When input is focused, style both left and right spans */
  .input-wrapper:has(.inp:focus) .sp.left,
  .input-wrapper:has(.inp:focus) .sp.right {
    background-color: hsl(61, 70%, 52%);
    color: hsl(202, 55%, 16%);
  }

  /* LEFT ICON (₤) */
  .sp.left{
    position: absolute;
    left: 1.4px;
    top:1.2px;
    height: 47.8px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3.1px 0 0 3.1px;
    background-color: hsl(202, 86%, 94%);
    color: hsl(202, 55%, 16%);
    font-weight: 700;
  }

  /* Change span background when input is focused */
  .input-wrapper .sp.left + .inp {
    padding-left: 50px;
  }

  .sp.right {
    position: absolute;
    right: 1.4px;
    top: 1.2px;
    height: 47.8px;
    width: 60px; 
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(202, 86%, 94%);
    border-radius: 0 3.1px 3.1px 0;
    color: hsl(202, 55%, 16%);
    font-weight: 700;
  }

  .input-wrapper .sp.right ~ .inp {
    padding-right: 70px;
  }

  #per {
    width: 40px;
  }

  .input-wrapper .inp {
    font-size: 13px;
  }

  /* Optional: Also apply to other inputs for safety */
  input[type="text"] {
    font-size: 13px;
  }


  /* ====================== MORTGAGE TYPE BUTTONS ====================== */

  .rad{
    border: 1px solid hsl(200, 26%, 54%);
    text-align: left;
    border-radius: 5px;
    background-color: hsl(0, 0%, 100%);
    width: 100%;
    margin: 15px 0;
    height: 50px;
    display: flex;
    align-items: center;
    color: hsl(202, 55%, 16%);
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 15px;
  }

  .rad:hover {
    border-color: hsl(61, 70%, 52%);
  }

  .rad.selected {
    background-color: hsla(61, 70%, 52%, 0.15);
    border-color: hsl(61, 70%, 52%);
  }

  input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    
    width: 16px;
    height: 16px;
    margin-right: 15px;
    cursor: pointer;
    flex-shrink: 0;
    
    border: 2px solid hsl(202, 55%, 16%);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
  }

  input[type="radio"]:checked {
    background-color: hsl(61, 70%, 52%);
    border: 5px solid #fff; 
    box-shadow: 0 0 0 2px hsl(61, 70%, 52%);
  }
  .rad:active {
    background-color: hsla(61, 70%, 45%, 0.25);
  }

  /*========= Heading Area ==============*/
  h1 {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 1.3rem;
    margin-top: 0;
    font-weight: 800;
    font-style: normal;
    color: hsl(202, 55%, 16%);
  }

  h4 {
    color: hsl(200, 24%, 40%);
    font-weight: 600;
    font-size: 1rem;
  }
  #clear {
    color: hsl(200, 24%, 40%);
    font-weight: 600;
  }

  /* ====================== CALCULATE BUTTON ====================== */
  .calculate{
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    height: 50px;
    border-style: none;
    font-size: 0.98rem;
    gap:12px;
    color: hsl(202, 55%, 16%);
    font-weight: 700;
    border-radius: 50px;
    background-color: hsl(61, 70%, 52%);
    margin-top: 20px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
  }

  /* Hover effect for Calculate Button */

  .calculate:hover {
    background-color: hsla(61, 70%, 45%, 0.5);     /* Slightly darker yellow */
    transform: translateY(-2px);              /* Lift up effect */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  }

  /* .calculate:active {
    transform: translateY(1px); Pressed effect 
  } */

  #cal-icon {
    width: 25px;
  }

  /*====== Second Card =====*/
  .bottomcard{
    background-color: hsl(202, 55%, 16%);
    width: 100%;
    box-sizing:border-box;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    margin-bottom: 5px;
  }

  .bottom-pic {
    margin-top: 10px;
  }
  .emptytext{
    text-align: center;
    color: hsl(203, 41%, 72%);
    font-weight: 500;
  }

  .result {
    color: hsl(0, 0%, 100%);
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 4px;
  }

  /* ERROR MESSAGE STYLING */
  .error-message {
    font-weight: 500;
    margin-top: 2px;
    font-size: 1px;
  }

  /* Make sure errors don't affect layout too much */
  /* .input {
    margin-top: 2px;
    margin-bottom: 2px;
  } */

  /* ====================== SINGLE RESULTS BOX ====================== */
  .result-box {
    background-color: hsla(198, 100%, 3%, 0.5);
    border-radius: 5px;
    border-top: 3px solid hsl(61, 70%, 52%); 
    padding: 24px 20px;
    margin-top: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* Labels */
  .result-label {
    color: hsl(203, 41%, 72%);
    font-size: 0.6rem;
    margin-bottom: 8px;
    font-weight: 500;
  }

  /* Monthly Repayment - Big & Yellow */
  .result-amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: hsl(61, 70%, 52%);
    margin: 0 0 20px 0;
  }

  /* Total Repay - Smaller & White */
  .result-total {
    font-size: 0.8rem;
    font-weight: 700;
    color: hsl(0, 0%, 100%);
    margin: 0;
  }

  /* Thin Divider Line */
  .result-divider {
    border: none;
    height: 1px;
    background-color: hsl(203, 41%, 72%);
    margin: 20px 0;
    width: 100%;                    /* You can change to 90% if you want it shorter */
  }
  

}
.attribution { font-size: 0.6875rem; text-align: center; }
.attribution a { color: hsl(228, 45%, 44%); }

@media(min-width: 820px) {
  body{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-size: 10px;
  }
  .container{
    width: 750px;
    height: 410px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background-color: hsl(0, 0%, 100%);

    .topcard{
      padding: 1rem;
      height: 405px;
      border-radius: 10px 0 0 10px;
    }
    .bottomcard{
      border-radius: 0 10px 10px 50px;
      box-sizing: border-box;
      padding: 59px;
      height: 410px;
      margin: 0;
    }

    h1{
      font-size: 18px;
    }

   #first{
    margin-top: 22px;
   }

    #left{
      margin-left: 14px;
    }

    h1, #clear{
      display: inline-block;
      margin-top: 0;
      margin-bottom: 0;
    }
    #clear{
      margin-left: 90px;
    }

    .in-line{
      display: inline-block;
      margin-top: 0;
      margin-bottom: 25px;
      width: 150px;
    }
   
    .calculate{
      width: 210px;
      height: 30px;
      padding: 17px 18px;
      margin-top:auto;
      font-size: 12px;
      background-color: hsla(61, 70%, 52%, 0.85);
    }

    #cal-icon{
      width: 18px;
    }

    .rad{
      height: 30px;
    }

    h4{
      font-size: 12px;
      margin-top: 0;
      margin-bottom: 6px;
    }

    .input{
      margin-bottom: 20px;
    }

    .input-wrapper .inp{
      height: 30px;
      margin-top: 0;
    }

    .sp.left, .sp.right{
      height: 27.8px;
    }

    .rad{
      font-size: 0.75rem;
    }
    input[type="radio"] {
      width: 12px;
      height: 12px;
    }

    input[type="radio"]:checked {
      background-color: hsl(61, 70%, 52%);
      border: 4px solid #fff; 
      box-shadow: 0 0 0 2px hsl(61, 70%, 52%);
    }

    /* ====================== ERROR MESSAGES ====================== */
    /* ERROR MESSAGES */
    .input {
      position: relative;
      margin-bottom: 28px;
    }

    .input4 {
      position: relative;
      margin-bottom: 28px;
    }

    .error-message {
      color: hsl(0, 84%, 60%);
      font-size: 0.85rem;
      font-weight: 500;
      position: absolute;
      bottom: -22px;
      left: 4px;
      margin: 0;
      z-index: 5;
    }

    /* Extra space when error shows */
    .input.has-error, .input4.has-error {
      margin-bottom: 48px;
    }
  }
}
