/* Reset e Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Mona Sans', 'Helvetica', 'Arial', sans-serif;
    font-synthesis: none;
    -moz-font-feature-settings: 'kern';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    direction: ltr;
    text-align: left;
    font-weight: normal;
    font-style: normal;
    line-height: 1.6;
    background-color: #f6f9fc;
    color: #0a2540;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
}

@media (max-width: 968px) {
    body {
        overflow-y: auto;
    }
}

/* Container Principal */
.checkout-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* Sidebar Esquerda */
.checkout-sidebar {
    width: 40%;
    height: 100vh;
    background: #000000;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: white;
    overflow-y: auto;
    z-index: 1;
}

.sidebar-content {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.sidebar-logo {
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo-box {
    width: 120px;
    height: 120px;
    border: 1px solid #444444;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logo-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.cart-summary {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.95);
}

.cart-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

.cart-items {
    margin-bottom: 2rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.cart-item:last-of-type {
    border-bottom: none;
}

.item-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.item-quantity {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.cart-total {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.total-amount {
    font-size: 1.5rem;
    color: white;
}

.sidebar-footer {
    margin-top: 2rem;
}

.security-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.security-badges svg {
    opacity: 0.9;
}

/* Conteúdo Principal Direita */
.checkout-main {
    width: 60%;
    height: 100vh;
    margin-left: 40%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem;
    background: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    right: 0;
    top: 0;
}

.checkout-wrapper {
    width: 100%;
    max-width: 520px;
    position: relative;
    margin: 2rem 0;
}

/* Alertas */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert svg {
    flex-shrink: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 40%; /* Começa onde termina a sidebar */
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    text-align: center;
}

@media (max-width: 968px) {
    .loading-overlay {
        left: 0; /* Em mobile, cobre toda a tela */
    }
}

.loading-overlay p {
    margin-top: 1.5rem;
    color: #0a2540;
    font-size: 1rem;
    font-weight: 500;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #e6ebf1;
    border-right-color: #635bff;
    animation: spinner-rotate 1s infinite linear;
}

@keyframes spinner-rotate {
    to {
       transform: rotate(1turn);
    }
 }

/* Formulário */
.payment-form {
    background: white;
}

.form-section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e6ebf1;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0a2540;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: #0a2540;
    background: #ffffff;
    border: 1.5px solid #e6ebf1;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: #df1b41;
}

.form-input::placeholder {
    color: #8898aa;
}

.form-input[readonly] {
    background: #f6f9fc;
    cursor: not-allowed;
    color: #6b7280;
}

/* Card Input Wrapper */
.card-input-wrapper {
    position: relative;
}

.card-brand-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    width: 40px;
    height: 28px;
}

.card-brand-icon.show {
    display: flex;
}

.card-brand-icon img,
.card-brand-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-input-wrapper .form-input {
    padding-right: 4rem;
}

/* Select styling */
.form-input[type="select"],
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%230a2540' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-input[type="select"]:focus,
select.form-input:focus {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23635bff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Bandeiras Aceitas */
.accepted-brands {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e6ebf1;
}

.accepted-brands-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.brands-list {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.brand-item {
    width: 48px;
    height: 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    transition: all 0.2s ease;
}

.brand-item:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.brand-icon {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Botão de Pagamento */
.btn-pay {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: #635bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(99, 91, 255, 0.2);
}

.btn-pay:hover:not(:disabled) {
    background: #5850e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 91, 255, 0.3);
}

.btn-pay:active:not(:disabled) {
    transform: translateY(0);
}

.btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-icon {
    display: none;
}

.btn-pay.processing .btn-icon {
    display: block;
    animation: spin 1s linear infinite;
}

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

/* Validação */
.form-input.is-invalid {
    border-color: #df1b41;
}

.invalid-feedback {
    display: block;
    color: #df1b41;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 968px) {
    .checkout-container {
        flex-direction: column;
    }

    .checkout-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 2rem;
    }

    .checkout-main {
        position: relative;
        width: 100%;
        height: auto;
        margin-left: 0;
        padding: 2rem;
        align-items: center;
        min-height: 100vh;
    }

    .checkout-wrapper {
    margin: 0;
}

    .form-row {
        grid-template-columns: 1fr;
    }

    .sidebar-content {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .checkout-sidebar,
    .checkout-main {
        padding: 1.5rem;
    }

    .cart-title {
        font-size: 1.25rem;
    }

    .total-amount {
        font-size: 1.25rem;
    }

    .logo-box {
        width: 100px;
        height: 100px;
        border-radius: 20px;
        padding: 16px;
    }
}

/* Telas de Resultado (Sucesso/Erro) */
.result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    min-height: 60vh;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-icon {
    margin-bottom: 2rem;
    animation: scaleIn 0.5s ease-out 0.2s both;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.result-title {
    font-size: 2rem;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 1rem;
}

.result-message {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 2.5rem;
    max-width: 500px;
    line-height: 1.6;
}

.result-details {
    width: 100%;
    max-width: 400px;
    background: #f6f9fc;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.result-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e6ebf1;
    gap: 1rem;
}

.result-detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 120px;
}

.detail-value {
    font-size: 1rem;
    color: #0a2540;
    font-weight: 600;
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    text-align: right;
    flex: 1;
}

.result-error-details {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
}

.error-box {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #c33;
}

.error-box svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.error-box span {
    font-size: 0.9rem;
    line-height: 1.5;
}

.result-actions {
    margin-top: 1rem;
}

.btn-result {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: #635bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(99, 91, 255, 0.2);
}

.btn-result:hover {
    background: #5850e6;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 91, 255, 0.3);
}

.btn-result:active {
    transform: translateY(0);
}

.result-success .result-title {
    color: #10b981;
}

.result-error .result-title {
    color: #ef4444;
}

/* Responsive para telas de resultado */
@media (max-width: 640px) {
    .result-screen {
        padding: 2rem 1.5rem;
        min-height: 50vh;
    }

    .result-title {
        font-size: 1.5rem;
    }

    .result-message {
        font-size: 1rem;
    }

    .result-icon svg {
        width: 60px;
        height: 60px;
    }
}

/* Utilitários */
.d-none {
    display: none !important;
}
