@font-face {
  font-family: "DenimRegular";
  src: url("../assets/fonts/DenimRegular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DenimWDSemiBold";
  src: url("../assets/fonts/DenimWDSemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --logo-gap: 48px;
  --yape-purple: #662d91;
  --yape-teal: #00b7a8;
  --yape-yellow: #ffcc00;
  --yape-gray-border: #dfdfe3;
  --font-regular: "DenimRegular", Arial, sans-serif;
  --font-semibold: "DenimWDSemiBold", Arial, sans-serif;
}

.content-hidden {
  visibility: hidden;
}

.spinner {
    margin-bottom: 16px;
    width: 48px;
    height: 48px;
    border: 5px solid #ddd;
    border-top-color: #4d148c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-regular);

  html,
  body {
    height: 100vh;
    width: 100%;
    padding: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
    background: #f2f2f2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
  }

  strong,
  b {
    font-family: var(--font-semibold) !important;
    font-weight: 600 !important;
  }

  .popup-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    min-height: 415px;
  }

  .header {
    position: absolute;
    top: calc(var(--logo-gap) + 30px);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
  }

  .logo {
    width: 120px;
    height: auto;
  }

  .message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 16px;
    max-width: 472px;
    width: 100%;
    padding-top: 10px;
  }

  .dots {
    position: absolute;
    left: 62%;
    top: 83%;
    transform: translate(8px, -50%);
    width: 3ch;
    text-align: left;
    font-size: 1.2rem;
    color: #333;
  }

  .message h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
  }

  .footer {
    position: absolute;
    bottom: var(--logo-gap);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
  }

  .header-logo {
    width: 210px;
    height: auto;
  }

  .header-pagoefectivo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid #e5e5e5;
    background-color: #fff;
  }

  .header-pagoefectivo .header-logo {
    width: 180px;
    height: auto;
  }

  @media (max-width: 365px) {
    :root {
      --logo-gap: 16px;
    }
    .logo {
      width: 100px;
    }
    .spinner {
      width: 36px;
      height: 36px;
      border-width: 4px;
    }
    .dots {
      left: 61%;
      top: 82%;
    }
    .message h1 {
      font-size: 1rem;
    }
    .message {
      padding: 0 12px;
    }
    .instructions-container {
      padding: 12px;
    }
    .instructions-container h1 {
      font-size: 0.95rem;
      margin-bottom: 8px;
    }
    .success-ol li {
      font-size: 0.8rem;
      margin-bottom: 2px;
    }
    .header-logo {
      width: 160px;
    }
    .header-pagoefectivo {
      padding: 10px 0;
    }
    .header-pagoefectivo .header-logo {
      width: 140px;
    }
  }

  @media (max-height: 545px) {
    :root {
      --logo-gap: 12px;
    }
    .logo {
      width: 100px;
    }
    .spinner {
      width: 36px;
      height: 36px;
    }
    .message h1 {
      font-size: 1rem;
    }
    .header-logo {
      width: 160px;
    }
    .header-pagoefectivo {
      padding: 8px 0;
    }
    .header-pagoefectivo .header-logo {
      width: 140px;
    }
  }

  @media (max-width: 320px) {
    :root {
      --logo-gap: 12px;
    }
    .logo {
      width: 80px;
    }
    .spinner {
      width: 28px;
      height: 28px;
      border-width: 3px;
    }
    .message h1 {
      font-size: 0.9rem;
    }
    .message {
      padding: 0 8px;
    }
    .success-ol {
      padding-left: 16px;
    }
    .success-ol li {
      font-size: 0.75rem;
      margin-bottom: 1px;
      padding: 2px 0;
    }
    .header-logo {
      width: 120px;
    }
    .header-pagoefectivo {
      padding: 8px 0;
    }
    .header-pagoefectivo .header-logo {
      width: 120px;
    }
  }

  @media (max-height: 280px) {
    :root {
      --logo-gap: 8px;
    }
    .logo {
      width: 64px;
    }
    .spinner {
      width: 24px;
      height: 24px;
      border-width: 3px;
    }
    .message h1 {
      font-size: 0.8rem;
    }
    .header-logo {
      width: 100px;
      opacity: 0.8;
    }
    .header-pagoefectivo {
      padding: 5px 0;
    }
    .header-pagoefectivo .header-logo {
      width: 100px;
      opacity: 0.8;
    }
  }

  .retry-button {
    margin-top: 16px;
    padding: 8px 16px;
    font-size: 1rem;
    background: #62226a;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
  }
  .retry-button:hover {
    opacity: 0.9;
  }

  .popup-container.success-page {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: var(--sp-logo-gap);
    padding-inline: 16px;
    width: 100%;
    max-width: 365px;
    height: auto;
    max-height: none;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .success-header {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 5px;
  }

  .success-footer {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    margin-top: 12px;
  }

  .success-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    min-width: 0;
    overflow: visible;
  }
  .success-content h1 {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
  }
  .success-content ul {
    list-style: disc outside;
    margin: 0;
    padding: 0;
    padding-inline-start: 1.4em;
    width: 100%;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .success-content li {
    margin-bottom: 8px;
    line-height: 1.4;
    color: #333;
    font-size: 0.8rem;
  }

  .success-animation {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.4s ease-out;
  }


  .success-animation.hidden {
    opacity: 0;
    pointer-events: none;
  }
  .success-icon {
    width: 96px;
    height: 96px;
  }

  .popup-container.success-page.ready .success-header,
  .popup-container.success-page.ready .success-content,
  .popup-container.success-page.ready .success-footer {
    opacity: 1;
  }

  .popup-container.success-page.ready .success-footer {
    margin-top: 12px;
  }

  .success-header,
  .success-content,
  .success-footer {
    opacity: 0;
    transition: opacity 0.5s ease-in;
  }

  @media (max-width: 365px) {
    :root {
      --sp-logo-gap: 8px;
    }
    .success-header .logo {
      width: 80px;
    }
    .success-content {
      max-width: 260px;
    }
    .success-content h1 {
      font-size: 0.7rem !important;
      margin-bottom: 5px;
    }
    .success-content li {
      font-size: 0.62rem !important;
      margin-bottom: 4px;
    }
    .success-footer .header-logo {
      width: 140px;
    }
  }
  @media (max-width: 320px) {
    :root {
      --sp-logo-gap: 12px;
    }
    .success-header .logo {
      width: 75px;
    }
    .success-content {
      max-width: 220px;
      padding-inline: 8px;
    }
    .success-content h1 {
      font-size: 0.68rem !important;
      margin-bottom: 6px !important;
    }
    .success-content li {
      font-size: 0.6rem !important;
      margin-bottom: 4px !important;
    }
    .success-footer .header-logo {
      width: 125px;
    }
  }

  @media (max-width: 320px) {
    :root {
      --sp-logo-gap: 12px;
    }
    .success-header .logo {
      width: 70px;
    }
    .success-content {
      max-width: 220px;
      padding-inline: 8px;
    }
    .success-content h1 {
      font-size: 0.68rem !important;
      margin-bottom: 6px !important;
    }
    .success-content li {
      font-size: 0.6rem !important;
      margin-bottom: 4px !important;
    }
    .success-footer .header-logo {
      width: 125px;
    }
  }

  @media (max-height: 500px) {
    :root {
      --sp-logo-gap: 7px;
    }
    .success-header .logo {
      width: 72px;
    }
    .success-content {
      padding-inline: 6px;
    }
    .success-content h1 {
      font-size: 0.73rem;
      margin-bottom: 6px;
    }
    .success-content li {
      font-size: 0.68rem;
      margin-bottom: 2px;
    }
    .success-footer .header-logo {
      width: 160px;
      opacity: 0.8;
    }

    .popup-container {
      min-height: 0;
    }
  }
  @media (max-height: 440px) {
    :root {
      --sp-logo-gap: 7px;
    }
    .success-header .logo {
      width: 72px;
    }
    .success-content {
      padding-inline: 7px;
    }
    .success-content h1 {
      font-size: 0.77rem;
      margin-bottom: 6px;
    }
    .success-content li {
      font-size: 0.68rem;
      margin-bottom: 2px;
    }
    .success-footer .header-logo {
      width: 160px;
      opacity: 0.8;
    }

    .popup-container {
      min-height: 0;
    }
  }
  @media (max-height: 400px) {
    :root {
      --sp-logo-gap: 8px;
    }
    .success-header .logo {
      width: 68px;
    }
    .success-content {
      padding-inline: 8px;
    }
    .success-content h1 {
      font-size: 0.78rem;
      margin-bottom: 5px;
    }
    .success-content li {
      font-size: 0.66rem;
      margin-bottom: 3px;
    }
    .success-footer .header-logo {
      width: 150px;
      opacity: 0.8;
    }
  }
  @media (max-height: 395px) {
    :root {
      --sp-logo-gap: 6px;
    }
    .success-header .logo {
      width: 62px;
    }
    .success-content {
      padding-inline: 6px;
    }
    .success-content h1 {
      margin-bottom: 7px;
      font-size: 0.73rem;
    }
    .success-content li {
      font-size: 0.59rem;
      margin-bottom: 2px;
    }
    .success-footer .header-logo {
      width: 140px;
      opacity: 0.8;
    }
  }

  @media (max-height: 375px) {
    :root {
      --sp-logo-gap: 6px;
    }
    .success-header .logo {
      width: 47px;
    }
    .success-content {
      padding-inline: 6px;
    }
    .success-content h1 {
      margin-bottom: 7px;
      font-size: 0.74rem;
    }
    .success-content li {
      font-size: 0.6rem;
      margin-bottom: 2px;
    }
    .success-footer .header-logo {
      width: 130px;
      opacity: 0.8;
    }
  }

  @media (max-height: 340px) {
    :root {
      --sp-logo-gap: 5px;
    }
    .success-header .logo {
      width: 40px;
    }
    .success-content {
      padding-inline: 4px;
    }
    .success-content h1 {
      margin-bottom: 5px;
      font-size: 0.6rem;
    }
    .success-content li {
      font-size: 0.55rem;
      margin-bottom: 2px;
    }
    .success-footer .header-logo {
      width: 90px;
      opacity: 0.8;
    }
  }

  .payment-amount-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: var(--yape-yellow);
    border: 1px solid var(--yape-gray-border);
    border-radius: 8px;
    padding: 14px 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    gap: 10px;
  }

  .payment-label {
    font-size: 19px;
    color: #333;
    font-weight: 400;
  }

  .payment-value {
    font-size: 28px;
    font-weight: 600;
    color: #000;
    font-family: var(--font-semibold);
  }

  @media (max-width: 365px) {
    .payment-amount-box {
      padding: 10px 12px;
      margin-bottom: 16px;
    }

    .payment-label {
      font-size: 16px;
      font-family: var(--font-regular);
    }

    .payment-value {
      font-size: 24px;
    }
  }

  @media (max-width: 320px) {
    .payment-amount-box {
      padding: 8px 10px;
      margin-bottom: 14px;
    }

    .payment-label {
      font-size: 14px;
    }

    .payment-value {
      font-size: 22px;
    }
  }

  .expiry-notice {
    margin-top: 5px;
    margin-bottom: 0px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    animation: color_yape_message 1.1s infinite alternate;
    width: 100%;
  }

  .instructions-container {
    border: 1px solid #b3b3b3;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    margin-top: 5px;
    margin-bottom: 5px;
  }

  .instructions-container h1 {
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
    font-size: 1.1rem;
  }

  @keyframes color_yape_message {
    0% {
      color: var(--yape-purple);
    }
    100% {
      color: black;
    }
  }

  @keyframes color_spinner {
    0% {
      border-top-color: black;
      border-bottom-color: black;
    }
    25% {
      border-top-color: var(--yape-teal);
      border-bottom-color: var(--yape-teal);
    }
    100% {
      border-top-color: var(--yape-purple);
      border-bottom-color: var(--yape-purple);
    }
  }

  .approval-spinner-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
  }

  .approval-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border-top: 2px solid var(--yape-purple);
    border-right: 2px solid transparent;
    border-bottom: 2px solid var(--yape-purple);
    border-left: 2px solid transparent;
    animation: spin 0.7s linear infinite, color_spinner 1.1s infinite alternate;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  .transaction-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .transaction-success .success-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
  }

  .transaction-success h1 {
    color: #31af91;
    margin-bottom: 1rem;
    font-size: 24px;
  }

  .transaction-success p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
  }

  .transaction-details {
    margin: 1.5rem 0;
    width: 100%;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 6px;
  }

  .footer {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .footer .logo {
    height: 40px;
    margin-bottom: 0.5rem;
  }

  .footer .powered-by {
    height: 24px;
  }

  .popup-container.success-page .header-pagoefectivo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 11;
  }

  .popup-container.success-page .success-header {
    margin-top: 70px;
  }

  .instructions-container {
    border: 1px solid #b3b3b3;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    margin-top: 10px;
  }

  .instructions-container h1 {
    text-align: left;
    width: 100%;
    margin-bottom: 10px;
  }

  .success-ol {
    list-style-position: outside;
    padding-left: 20px;
    margin: 0;
    text-align: left;
  }

  .success-ol li {
    margin-bottom: 3px;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #333;
    padding: 3px 0;
    text-align: left;
  }

  .yape-app-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    gap: 9px;
  }

  .yape-app-container strong {
    font-size: 22px;
    color: #333;
    flex-grow: 1;
  }

  .yape-logo {
    width: 47px;
    height: 47px;
  }

  @media (max-width: 365px) {
    .yape-app-container {
      padding: 10px 12px;
      margin-bottom: 16px;
    }

    .yape-app-container strong {
      font-size: 18px;
    }

    .yape-logo {
      width: 40px;
      height: 40px;
    }
  }

  @media (max-width: 320px) {
    .yape-app-container {
      padding: 8px 10px;
      margin-bottom: 14px;
    }

    .yape-app-container strong {
      font-size: 16px;
    }

    .yape-logo {
      width: 35px;
      height: 35px;
    }
  }

  @media (max-width: 365px) {
    .approval-spinner-container {
      margin-bottom: 24px;
    }
  }

  @media (max-width: 320px) {
    .approval-spinner-container {
      margin-bottom: 20px;
    }
  }

  .transaction-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    max-width: 550px;
    padding: 0 20px;
  }

  .transaction-container .success-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
  }

  .transaction-container h1 {
    color: #000000;
    font-size: 36px;
    margin-bottom: 10px;
  }

  .transaction-container p {
    color: #5f645a;
    font-size: 17px;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
  }

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

  @media (max-width: 480px) {
    .transaction-container h1 {
      font-size: 30px;
    }
  }

  @media (max-width: 365px) {
    .transaction-container h1 {
      font-size: 26px;
    }

    .transaction-container p {
      font-size: 15px;
    }
  }

  .mobile-message {
    position: relative;
    text-align: center;
    margin-top: 5px;
  }
  
  .mobile-message h1 {
    margin-bottom: 5px;
    font-size: 1.2rem;
    color: #333;
  }
  
  .yape-app-container + .mobile-message {
    margin-top: 15px;
  }
  
  .mobile-message .dots {
    display: inline-block;
    position: relative;
    width: auto;
    left: auto;
    top: auto;
    transform: none;
    height: 1.2rem;
    line-height: 1.2rem;
    vertical-align: middle;
  }
  
  .retry-button {
    margin-top: 20px;
    padding: 8px 16px;
    background-color: var(--yape-purple);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-semibold);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }
  
  .retry-button:hover {
    background-color: #4d148c;
  }
}
