/* ============================================
   MAGISTRAR CHECKOUT - STYLE
   Colors: #082645 (azul), #AB7903 (dourado)
   Font: Nunito
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --azul: #082645;
    --azul-light: #0d3a6a;
    --dourado: #AB7903;
    --dourado-light: #c99a2e;
    --dourado-bg: #fdf6e3;
    --branco: #ffffff;
    --cinza-bg: #f5f6f8;
    --cinza-light: #e8eaed;
    --cinza-border: #d1d5db;
    --cinza-text: #6b7280;
    --cinza-dark: #374151;
    --texto: #1f2937;
    --sucesso: #2ecc71;
    --sucesso-bg: #eafaf1;
    --erro: #e74c3c;
    --erro-bg: #fdf0ef;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --transition: 0.25s ease;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cinza-bg);
    color: var(--texto);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden { display: none !important; }

/* ============================================
   HEADER
   ============================================ */
.checkout-header {
    background: linear-gradient(135deg, var(--azul) 0%, var(--azul-light) 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--dourado);
    letter-spacing: 1px;
}

.logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.secure-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sucesso);
    font-size: 13px;
    font-weight: 600;
    background: rgba(46,204,113,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(46,204,113,0.2);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    background: var(--branco);
    padding: 18px 0;
    border-bottom: 1px solid var(--cinza-light);
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: var(--transition);
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 0.7;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cinza-light);
    color: var(--cinza-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--azul);
    color: var(--branco);
}

.step.completed .step-number {
    background: var(--sucesso);
    color: var(--branco);
}

.step span {
    font-size: 13px;
    font-weight: 600;
    color: var(--cinza-dark);
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--cinza-light);
    margin: 0 12px;
}

/* ============================================
   MAIN GRID
   ============================================ */
.checkout-main {
    padding: 30px 0 60px;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

/* ============================================
   LEFT: SECTIONS
   ============================================ */
.checkout-section {
    background: var(--branco);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--azul);
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--cinza-light);
}

.section-title svg {
    color: var(--dourado);
}

/* ============================================
   FORMS
   ============================================ */
.form-row {
    margin-bottom: 16px;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full {
    width: 100%;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cinza-dark);
    margin-bottom: 6px;
}

input, select {
    padding: 12px 14px;
    border: 2px solid var(--cinza-border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--texto);
    transition: var(--transition);
    background: var(--branco);
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--dourado);
    box-shadow: 0 0 0 3px rgba(171,121,3,0.15);
}

input.error {
    border-color: var(--erro);
    background: var(--erro-bg);
}

input.valid {
    border-color: var(--sucesso);
}

.error-msg {
    font-size: 12px;
    color: var(--erro);
    margin-top: 4px;
    min-height: 16px;
}

select {
    cursor: pointer;
    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 1l5 5 5-5' stroke='%236b7280' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--dourado) 0%, var(--dourado-light) 100%);
    color: var(--branco);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 24px;
    box-shadow: 0 4px 15px rgba(171,121,3,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(171,121,3,0.4);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-finalizar {
    background: linear-gradient(135deg, var(--sucesso) 0%, #27ae60 100%);
    box-shadow: 0 4px 15px rgba(46,204,113,0.3);
    font-size: 18px;
    padding: 18px 24px;
}

.btn-finalizar:hover {
    box-shadow: 0 6px 20px rgba(46,204,113,0.4);
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--cinza-text);
    border: none;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--transition);
}

.btn-back:hover {
    color: var(--azul);
}

/* ============================================
   PAYMENT TABS
   ============================================ */
.payment-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border: 2px solid var(--cinza-border);
    border-radius: var(--radius);
    background: var(--branco);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--cinza-text);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab:hover {
    border-color: var(--azul);
    color: var(--azul);
}

.tab.active {
    border-color: var(--azul);
    background: rgba(8,38,69,0.04);
    color: var(--azul);
}

.discount-badge {
    position: absolute;
    top: -8px;
    right: -6px;
    background: var(--sucesso);
    color: var(--branco);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.payment-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.payment-content.active {
    display: block;
}

/* PIX & Boleto info */
.pix-info, .boleto-info {
    padding: 20px;
    background: var(--cinza-bg);
    border-radius: var(--radius);
    text-align: center;
}

.pix-discount-banner {
    background: var(--sucesso-bg);
    border: 1px solid rgba(46,204,113,0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    font-size: 16px;
}

.pix-price {
    color: var(--sucesso);
    font-size: 22px;
}

.pix-instructions {
    color: var(--cinza-text);
    font-size: 14px;
}

.boleto-warning {
    color: var(--dourado);
    font-weight: 600;
    margin-top: 10px;
    font-size: 14px;
}

/* ============================================
   ORDER BUMP
   ============================================ */
.order-bump {
    border: 2px dashed var(--dourado);
    border-radius: var(--radius-lg);
    margin-top: 24px;
    overflow: hidden;
    background: var(--dourado-bg);
    transition: var(--transition);
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--dourado); }
    50% { border-color: var(--dourado-light); }
}

.order-bump:has(input:checked) {
    border-style: solid;
    background: #fef9ec;
    animation: none;
}

.bump-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--dourado) 0%, var(--dourado-light) 100%);
}

.bump-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--branco);
    font-weight: 700;
}

.bump-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--branco);
    cursor: pointer;
}

.bump-tag {
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.bump-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    gap: 16px;
}

.bump-info h4 {
    font-size: 15px;
    color: var(--azul);
    margin-bottom: 4px;
}

.bump-info p {
    font-size: 13px;
    color: var(--cinza-text);
    line-height: 1.5;
}

.bump-price {
    text-align: center;
    white-space: nowrap;
}

.bump-original {
    display: block;
    font-size: 13px;
    color: var(--cinza-text);
    text-decoration: line-through;
}

.bump-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--sucesso);
}

.bump-only {
    display: block;
    font-size: 11px;
    color: var(--erro);
    font-weight: 700;
    text-transform: uppercase;
}

/* ============================================
   RIGHT: ORDER SUMMARY
   ============================================ */
.order-summary {
    background: var(--branco);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.summary-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--azul);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--cinza-light);
}

.product-card {
    background: linear-gradient(135deg, rgba(8,38,69,0.03) 0%, rgba(8,38,69,0.06) 100%);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
    border: 1px solid var(--cinza-light);
}

.product-badge {
    display: inline-block;
    background: var(--dourado);
    color: var(--branco);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.product-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--azul);
    margin-bottom: 6px;
}

.product-desc {
    font-size: 13px;
    color: var(--cinza-text);
    margin-bottom: 14px;
    line-height: 1.5;
}

.product-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--cinza-dark);
    font-weight: 600;
}

/* Summary lines */
.summary-lines {
    margin-bottom: 20px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--cinza-dark);
}

.summary-line.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--azul);
    padding-top: 14px;
}

.discount-value {
    color: var(--sucesso);
    font-weight: 600;
}

.summary-divider {
    height: 1px;
    background: var(--cinza-light);
    margin: 4px 0;
}

/* Guarantee */
.guarantee-box {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    background: var(--sucesso-bg);
    border-radius: var(--radius);
    border: 1px solid rgba(46,204,113,0.2);
    margin-bottom: 20px;
}

.guarantee-box strong {
    font-size: 14px;
    color: var(--sucesso);
    display: block;
    margin-bottom: 2px;
}

.guarantee-box p {
    font-size: 12px;
    color: var(--cinza-text);
    line-height: 1.4;
}

/* Trust badges */
.trust-badges {
    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--cinza-text);
    font-weight: 600;
}

.trust-item svg {
    color: var(--azul);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,38,69,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    color: var(--branco);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--dourado);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.loading-content span {
    font-size: 13px;
    opacity: 0.7;
}

/* ============================================
   FOOTER
   ============================================ */
.checkout-footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--cinza-light);
    background: var(--branco);
}

.checkout-footer p {
    font-size: 13px;
    color: var(--cinza-text);
}

.footer-links a {
    color: var(--azul);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .checkout-right {
        order: -1;
    }

    .order-summary {
        position: static;
    }

    .product-card {
        display: none;
    }

    .steps {
        gap: 0;
    }

    .step span {
        display: none;
    }

    .step-line {
        width: 40px;
    }
}

@media (max-width: 600px) {
    .checkout-section {
        padding: 20px 16px;
    }

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

    .payment-tabs {
        grid-template-columns: 1fr;
    }

    .bump-body {
        flex-direction: column;
        text-align: center;
    }

    .header-content {
        flex-direction: column;
        gap: 8px;
    }
}
