/* Importa a fonte TikTok Sans */
@import url('tiktok-sans.css');

/* Configurações gerais da página */
body {
    margin: 0;
    font-family: 'TikTok Sans', 'Roboto', sans-serif;
    background-color: #F2F2F2;
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

/* Container principal do checkout */
.checkout-container {
    width: 100%;
    max-width: 450px;
    background-color: #FFFFFF;
    position: relative;
    overflow-x: hidden;
}

/* Cabeçalho com Título e Selo de Segurança */
.header-section {
    padding: 16px;
    padding-bottom: 12px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin-bottom: 0;
}

.back-arrow {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.header-section .title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 700;
    color: #161823;
    margin: 0;
    text-align: center;
}

.header-section .secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 750;
    color: #FE2C55;
}

.header-section .secure-badge img {
    width: 16px;
    height: 16px;
}

/* Linha de divisão */
.divider {
    border: none;
    height: 1px;
    background-color: #F2F2F2;
    margin: 0 16px;
}

.section-divider {
    border: none;
    height: 8px;
    background-color: #F2F2F2;
    margin: 0;
}

/* Botões de Ação e Display de Endereço/CPF */
.actions-section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
    background-color: #F2F2F2;
    border: 1px solid #F2F2F2;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
    color: #161823;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-button:hover {
    background-color: #E5E5E5;
}

.address-display, .cpf-display {
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    padding: 12px;
    font-size: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.address-display .icon, .cpf-display .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.address-display-info p {
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.address-display-info .name-phone {
    font-weight: 700;
}

.address-display-info .address-line {
    color: #555;
}

.cpf-display-info {
    font-weight: 700;
    color: #161823;
}

/* Seção do Produto */
.product-section {
    padding: 16px;
}

.store-info {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
}

.product-card {
    display: flex;
    gap: 12px;
}

.product-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.product-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.product-details .name {
    font-size: 15px;
    font-weight: 500;
    color: #161823;
    margin: 0;
}

.product-details .variant {
    font-size: 13px;
    color: #8A8A8A;
    margin: 4px 0;
}

.product-details .returns {
    font-size: 13px;
    color: #8A8A8A;
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-details .returns .check-icon {
    color: #25a45a;
}

.price-and-quantity {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.price .current {
    font-size: 16px;
    font-weight: 700;
    color: #161823;
}

.price .original {
    font-size: 13px;
    color: #8A8A8A;
    text-decoration: line-through;
    margin-left: 4px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
}

.quantity-selector button {
    background: none;
    border: none;
    padding: 4px 10px;
    font-size: 18px;
    cursor: pointer;
    color: #161823;
}

.quantity-selector button:disabled {
    color: #E5E5E5;
    cursor: not-allowed;
}

.quantity-selector .quantity {
    padding: 4px 8px;
    font-size: 15px;
    font-weight: 500;
}

/* Seção de Desconto */
.discount-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    cursor: pointer;
}

.discount-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: #161823;
}

.discount-icon {
    width: 20px;
    height: 20px;
}

.discount-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.discount-amount {
    background-color: #F2F2F2;
    padding: 4px 12px;
    border-radius: 6px;
    position: relative;
    font-size: 15px;
    font-weight: 500;
    color: #FE2C55;
}

/* Efeito de ticket com recortes circulares */
.discount-amount::before,
.discount-amount::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    background-color: #FFFFFF;
    border-radius: 50%;
    transform: translateY(-50%);
}

.discount-amount::before {
    left: -5px;
}

.discount-amount::after {
    right: -5px;
}

.arrow-right-icon {
    width: 16px;
    height: 16px;
}

/* Seção Resumo do Pedido */
.summary-section {
    padding: 16px;
}

.summary-title {
    font-size: 16px;
    font-weight: 700;
    color: #161823;
    margin: 0 0 16px 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: #161823;
    margin-bottom: 12px;
}

.summary-discount-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555;
}

.summary-discount-label .discount-icon {
    width: 20px;
    height: 20px;
}

.summary-discount-label .arrow-down-icon {
    width: 16px;
    height: 16px;
}

.summary-item .summary-discount-amount {
    color: #FE2C55;
    font-weight: 500;
}

.summary-divider {
    border: none;
    height: 1px;
    background-color: #E5E5E5;
    margin: 16px 0;
}

.summary-item.total {
    font-weight: 700;
    font-size: 16px;
    margin-top: 16px;
    margin-bottom: 0;
}

/* Seção Forma de Pagamento */
.payment-section {
    padding: 16px;
}

.payment-title {
    font-size: 16px;
    font-weight: 700;
    color: #161823;
    margin: 0 0 16px 0;
}

.payment-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.payment-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
}

.pix-icon {
    width: 24px;
    height: 24px;
}

.payment-option input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: grid;
    place-content: center;
    cursor: pointer;
}

.payment-option input[type="radio"]::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #FE2C55;
}

.payment-option input[type="radio"]:checked {
    border-color: #FE2C55;
}

.payment-option input[type="radio"]:checked::before {
    transform: scale(1);
}

/* Seção de Termos Legais */
.legal-section {
    padding: 16px;
    background-color: #F2F2F2;
}

.legal-text {
    font-size: 13px;
    line-height: 1.5;
    color: #8A8A8A;
}

.legal-text a {
    color: #161823;
    font-weight: 500;
    text-decoration: none;
}

.savings-info-section {
    background-color: #FFF1F3;
    color: #FE2C55;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* Seção Final de Ações */
.final-actions-section {
    background-color: #FFFFFF;
    padding: 16px;
    border-top: 1px solid #F2F2F2;
}

.final-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.final-total-label {
    font-size: 16px;
    color: #161823;
}

.final-total-label b {
    font-weight: 700;
}

.final-total-amount b {
    font-size: 18px;
    font-weight: 700;
    color: #161823;
}

.place-order-button {
    background-color: #FE2C55;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px;
    cursor: pointer;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}

.main-button-text {
    font-size: 16px;
    font-weight: 700;
}

.coupon-expiry-text {
    font-size: 12px;
    font-weight: 400;
    margin-top: 4px;
    opacity: 0.9;
}

/* Estilos do Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F2F2F2;
    display: none;
    justify-content: center;
    align-items: stretch;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: #F2F2F2;
    width: 100%;
    max-width: 450px;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: #FFFFFF;
    border-bottom: 1px solid #E5E5E5;
    flex-shrink: 0;
}

.modal-header .back-arrow {
    cursor: pointer;
}

.modal-header .title {
    flex-grow: 1;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    margin-right: 24px;
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.modal-section {
    background-color: #FFFFFF;
    margin-bottom: 8px;
    padding: 0 16px;
}

.modal-section-title {
    font-size: 13px;
    color: #8A8A8A;
    padding: 12px 16px;
    background-color: #F2F2F2;
}

.form-group {
    position: relative;
    padding: 14px 0;
    border-bottom: 1px solid #F2F2F2;
}

.form-group:last-child {
    border-bottom: none;
}

.form-group {
    position: relative;
}

.form-group input, .form-group select {
    width: 100%;
    border: none;
    background: none;
    font-size: 15px;
    font-family: 'TikTok Sans', 'Roboto', sans-serif;
    outline: none;
    color: #161823;
    transition: border-color 0.3s ease;
}

.form-group input.error, .form-group select.error {
    border-bottom: 1px solid #FE2C55;
}

.error-message {
    color: #FE2C55;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.cep-loading {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #FE2C55;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.phone-group {
    display: flex;
    align-items: center;
}

.phone-group .country-code {
    margin-right: 8px;
    font-weight: 500;
}

.phone-group input {
    flex-grow: 1;
}

.toggle-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
}

.toggle-switch label {
    font-size: 15px;
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #25a45a;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.modal-footer {
    padding: 16px;
    background-color: #F2F2F2;
    flex-shrink: 0;
}

.modal-footer p {
    font-size: 12px;
    color: #8A8A8A;
    text-align: center;
    margin: 0 0 12px 0;
}

.modal-footer a {
    color: #161823;
    font-weight: 500;
}

.modal-footer button {
    background-color: #FE2C55;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

/* Estilos do Modal PIX */
.pix-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Estilos para a mensagem de sucesso */
.payment-success {
    text-align: center;
    padding: 30px;
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.success-icon {
    width: 60px;
    height: 60px;
    background-color: #25a45a;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px;
}

.payment-success h2 {
    color: #25a45a;
    font-size: 24px;
    margin-bottom: 15px;
}

.payment-success p {
    color: #161823;
    font-size: 16px;
    margin-bottom: 10px;
}

.order-info {
    margin-top: 20px;
    padding: 20px;
    background-color: #F8F8F8;
    border-radius: 4px;
}

.order-info p {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.order-info p:last-child {
    margin-bottom: 0;
}

.pix-qrcode {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pix-qrcode img {
    width: 200px;
    height: 200px;
}

.pix-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pix-timer {
    text-align: center;
    font-size: 14px;
    color: #161823;
}

.countdown {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #FE2C55;
    margin-top: 4px;
}

.pix-copy {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.pix-copy input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    font-size: 14px;
    color: #161823;
    background-color: #F8F8F8;
    cursor: default;
}

.copy-button {
    background-color: #25a45a;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.copy-button:hover {
    background-color: #1f8d4e;
}

#check-payment-button {
    margin-top: 16px;
    background-color: #FE2C55;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}

#check-payment-button:hover {
    background-color: #e62548;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: white;
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    animation: toast-slide-in 0.3s ease forwards;
    pointer-events: auto;
}

.toast-error {
    border-left: 4px solid #FE2C55;
}

.toast-success {
    border-left: 4px solid #25a45a;
}

.toast-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: bold;
}

.toast-error .toast-icon {
    background-color: #FE2C55;
    color: white;
}

.toast-success .toast-icon {
    background-color: #25a45a;
    color: white;
}

.toast-text {
    flex-grow: 1;
    font-size: 14px;
    color: #161823;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #FE2C55;
    transition: width 3s linear;
}

.toast-success .toast-progress {
    background-color: #25a45a;
}

.toast-fade-out {
    animation: toast-slide-out 0.3s ease forwards;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}