/* ============================================
   RESET E CONFIGURAÇÕES GERAIS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
    padding: 0;
}

/* ============================================
   TOPBAR (Barra Verde de Segurança)
   ============================================ */

.topbar {
    background-color: #4CAF50;
    width: 100%;
    padding: 12px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topbar-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.check-icon {
    color: white;
    font-size: 20px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.2);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.security-text {
    color: white;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.checkout-container {
    max-width: 600px;
    margin: 30px auto;
    padding: 0 20px;
}

.checkout-card {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   SEÇÃO DE IDENTIFICAÇÃO
   ============================================ */

.identification-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
}

.step-badge {
    background-color: #2196F3;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.section-title {
    color: #333;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* ============================================
   FORMULÁRIO
   ============================================ */

.identification-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.form-input {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    color: #333;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input::placeholder {
    color: #999;
}

.form-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-input.error {
    border-color: #f44336;
}

.checkout-card + .checkout-card {
    margin-top: 20px;
}

/* ============================================
   SEÇÃO DO PRODUTO PRINCIPAL
   ============================================ */

.product-section-title {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.product-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.product-image-container {
    flex-shrink: 0;
    width: 150px;
    min-width: 150px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.product-image {
    width: 100%;
    height: auto;
    display: block;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-name {
    color: #333;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.product-price {
    color: #4CAF50;
    font-size: 22px;
    font-weight: 700;
}

/* ============================================
   SEÇÃO DE PAGAMENTO
   ============================================ */

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.payment-method-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s;
    position: relative;
}

.payment-method-btn:hover {
    border-color: #4CAF50;
}

.payment-method-btn.active {
    border-color: #2196F3;
    background-color: #f0f7ff;
}

.payment-method-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.payment-icon {
    font-size: 24px;
}

.pix-icon {
    width: 32px;
    height: auto;
    display: block;
}

.check-selected {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #4CAF50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

/* ============================================
   FORMULÁRIO DE CARTÃO
   ============================================ */

.payment-form {
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.card-input-wrapper {
    position: relative;
}

.card-input-wrapper .input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.help-icon {
    cursor: help;
    pointer-events: auto !important;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.security-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background-color: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    margin: 15px 0;
}

.security-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    border-left: 4px solid #c62828;
}

/* ============================================
   FORMULÁRIO DE PIX
   ============================================ */

.pix-content {
    text-align: center;
}

.pix-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.pix-qr-container {
    background-color: #f5f5f5;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pix-qr-container .pix-qr-image,
.pix-qr-container img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.pix-qr-container table {
    margin: 0 auto;
}

.pix-qr-container table img {
    max-width: 100%;
    height: auto;
}

.pix-loading {
    color: #999;
    font-size: 14px;
}

.pix-code-container {
    margin-bottom: 20px;
    text-align: left;
}

.pix-code-container label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.pix-code-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.pix-code-wrapper input {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: break-word;
    overflow-x: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.copy-btn {
    padding: 12px 16px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.copy-btn:hover {
    background-color: #1976D2;
}

.pix-total {
    margin: 20px 0;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
    font-size: 18px;
    color: #333;
}

.pix-total strong {
    color: #4CAF50;
}

/* ============================================
   BOTÃO DE PAGAR
   ============================================ */

.pay-button {
    width: 100%;
    padding: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 15px;
}

.pay-button:hover {
    background-color: #45a049;
}

.pay-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ============================================
   TOTAL DO PEDIDO
   ============================================ */

.order-total {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
    font-size: 20px;
    color: #333;
}

.order-total strong {
    color: #4CAF50;
}

/* ============================================
   POPUP DE ERRO DO CARTÃO
   ============================================ */

.error-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.error-popup {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.error-popup-header {
    padding: 25px 25px 15px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.error-popup-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.error-popup-title {
    color: #c62828;
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.error-popup-body {
    padding: 25px;
    text-align: center;
}

.error-popup-message {
    color: #333;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

.error-popup-footer {
    padding: 15px 25px 25px;
    text-align: center;
}

.error-popup-button {
    width: 100%;
    padding: 14px 24px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-popup-button:hover {
    background-color: #45a049;
}

.error-popup-button:active {
    background-color: #3d8b40;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 640px) {
    .checkout-card {
        padding: 20px;
    }
    .section-title {
        font-size: 18px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .product-display {
        flex-direction: column;
        text-align: center;
    }
    .product-image-container {
        width: 100%;
        max-width: 200px;
        height: auto;
        margin: 0 auto;
    }
    .product-image {
        height: auto;
    }
    .pix-code-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    .pix-code-wrapper input {
        width: 100%;
        font-size: 13px;
        padding: 10px 12px;
    }
    .copy-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    .pix-code-container {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
}

@media (max-width: 400px) {
    .pix-code-wrapper input {
        font-size: 12px;
        padding: 10px;
    }
    .copy-btn {
        padding: 10px;
        font-size: 13px;
    }
    .pix-code-container {
        padding: 0;
    }
}
