/* ==========================================================================
   TELEGATE WEB CHECKOUT — Styles
   Consistent with Telegate brand: dark theme, #00d26a accent, Inter font
   ========================================================================== */

:root {
    --ck-primary: #00d26a;
    --ck-primary-hover: #00b359;
    --ck-dark-bg: #0a0a0a;
    --ck-card-bg: #161616;
    --ck-card-border: rgba(255, 255, 255, 0.08);
    --ck-text: #e0e0e0;
    --ck-text-muted: #9e9e9e;
    --ck-radius: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--ck-dark-bg);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 210, 106, 0.04) 0%, transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(0, 210, 106, 0.04) 0%, transparent 25%);
    color: var(--ck-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

/* ---------- Container ---------- */
.checkout-container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding-top: 2rem;
}

/* ---------- Card ---------- */
.checkout-card {
    background: var(--ck-card-bg);
    border: 1px solid var(--ck-card-border);
    border-radius: var(--ck-radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ---------- Header ---------- */
.checkout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--ck-card-border);
}

.checkout-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.checkout-brand {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ck-primary);
    letter-spacing: 0.03em;
}

/* ---------- Product Image ---------- */
.product-image-wrapper {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
}

.product-image {
    width: 100%;
    height: auto;
    display: block;
}

video.product-image {
    object-fit: cover;
    max-height: 340px;
}

/* ---------- Product Info ---------- */
.product-title {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--ck-text-muted);
    margin-bottom: 0.25rem;
    line-height: 1.4;
    white-space: pre-line;
}

.product-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ck-primary);
    margin-bottom: 1.25rem;
}

/* ---------- Inputs ---------- */
.checkout-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--ck-card-border) !important;
    color: var(--ck-text) !important;
    border-radius: 10px !important;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
}

.checkout-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 210, 106, 0.2) !important;
    border-color: var(--ck-primary) !important;
}

.checkout-input::placeholder {
    color: var(--ck-text-muted) !important;
}

/* ---------- Pay Button ---------- */
.btn-checkout {
    background: var(--ck-primary);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-checkout:hover {
    background: var(--ck-primary-hover);
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 210, 106, 0.3);
}

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

.btn-checkout:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ---------- QR Code ---------- */
#qr-display {
    text-align: center;
}

.qr-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    display: inline-block;
    margin: 0 auto;
    width: fit-content;
}

.qr-image {
    max-width: 220px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.pix-copy-wrapper .form-control {
    font-size: 0.75rem;
}

/* ---------- Download Buttons ---------- */
.btn-download {
    background: rgba(0, 210, 106, 0.1);
    color: var(--ck-primary);
    border: 1px solid rgba(0, 210, 106, 0.3);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.btn-download:hover {
    background: rgba(0, 210, 106, 0.2);
    color: var(--ck-primary);
    border-color: var(--ck-primary);
    transform: translateY(-1px);
}

/* ---------- Delivery Section ---------- */
.delivery-section {
    padding: 1rem 0;
}

.delivery-message {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--ck-primary);
}

/* ---------- Footer ---------- */
.checkout-footer {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.75rem;
    color: var(--ck-text-muted);
}

.checkout-footer a {
    color: var(--ck-primary);
    text-decoration: none;
    font-weight: 600;
}

/* ---------- Alerts Override ---------- */
.alert-info {
    background: rgba(0, 210, 106, 0.08) !important;
    border-color: rgba(0, 210, 106, 0.2) !important;
    color: var(--ck-text) !important;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.08) !important;
    border-color: rgba(255, 193, 7, 0.2) !important;
    color: var(--ck-text) !important;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1) !important;
    border-color: rgba(220, 53, 69, 0.3) !important;
    color: #f8d7da !important;
}

/* ---------- Cart Items ---------- */
.cart-item {
    transition: transform 0.15s, box-shadow 0.15s;
}

.cart-item-image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
}

.cart-item-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ck-primary);
}

.cart-item-actions {
    display: flex;
    align-items: center;
}

.cart-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}

.cart-status-pending {
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
}

.cart-status-paid {
    background: rgba(0, 210, 106, 0.12);
    color: var(--ck-primary);
}

.cart-status-expired {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ck-text-muted);
}

.cart-status-unknown {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ck-text-muted);
}

.cart-link {
    color: var(--ck-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.cart-link:hover {
    color: var(--ck-primary);
}

/* ---------- Product Carousel (cross-sell) — full-bleed ---------- */
.product-carousel-wrapper {
    position: relative;
    width: 100%;
}

.carousel-hint-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0, 210, 106, 0.5);
    background: rgba(0, 0, 0, 0.6);
    color: var(--ck-primary);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.carousel-hint-arrow:hover {
    background: rgba(0, 210, 106, 0.2);
    opacity: 1;
}

.carousel-hint-arrow.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.carousel-hint-left {
    left: 0.5rem;
}

.carousel-hint-right {
    right: 0.5rem;
}

@media (min-width: 769px) {
    .carousel-hint-arrow {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .carousel-hint-arrow {
        display: flex;
    }
}

.product-carousel {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    /* Break out of card + container to full viewport width */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0.25rem max(1rem, calc((100vw - 400px) / 2)) 0.75rem;

    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: 1rem;

    /* Altura dinâmica conforme card focado — controlada via JS */
    min-height: 200px;
    transition: height 0.35s ease;
}

.product-carousel::-webkit-scrollbar {
    display: none;
}

.product-slide {
    flex: 0 0 min(75vw, 360px);
    scroll-snap-align: center;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--ck-card-border);
    text-decoration: none;
    color: var(--ck-text);
    transition: all 0.3s ease;
    opacity: 0.55;
    transform: scale(0.95);
}

.product-slide:hover {
    opacity: 0.8;
    border-color: rgba(0, 210, 106, 0.3);
}

.product-slide-active {
    border-color: var(--ck-primary);
    box-shadow: 0 0 24px rgba(0, 210, 106, 0.18), 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 1;
    transform: scale(1);
}

.product-slide-img img,
.product-slide-img video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.product-slide-info {
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    text-align: center;
}

.product-slide-name {
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--ck-text-muted);
    margin: 0 0 0.2rem;
    line-height: 1.4;
    white-space: pre-line;
}

.product-slide-price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ck-primary);
}

.product-slide-ticket-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.product-slide-original {
    text-decoration: line-through;
    opacity: 0.5;
    font-size: 0.6em;
    margin-right: 0.2rem;
}

/* ---------- Offer / Upsell / Downsell Cards ---------- */
.offer-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ck-card-border);
}

.offer-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ck-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

/* Horizontal offer card (downsell / upsell) */
.offer-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ck-card-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ck-text);
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.offer-card:hover {
    background: rgba(0, 210, 106, 0.06);
    border-color: rgba(0, 210, 106, 0.25);
    color: var(--ck-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.offer-card-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
}

.offer-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.offer-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-card-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ck-primary);
}

.offer-card-original-price {
    text-decoration: line-through;
    opacity: 0.5;
    font-size: 0.75em;
    margin-right: 0.25rem;
}

.offer-card-arrow {
    color: var(--ck-text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Downsell variant */
.offer-card-downsell {
    border-color: rgba(255, 193, 7, 0.2);
}

.offer-card-downsell:hover {
    border-color: rgba(255, 193, 7, 0.4);
    background: rgba(255, 193, 7, 0.05);
}

/* Order Bump (checkbox acima do botão Pagar) */
.order-bump-card {
    padding: 0.75rem;
    background: rgba(0, 210, 106, 0.06);
    border: 1px solid rgba(0, 210, 106, 0.2);
    border-radius: 12px;
}
.order-bump-checkbox {
    cursor: pointer;
    margin: 0;
    font-size: 0.9rem;
    color: var(--ck-text);
}
.order-bump-checkbox input {
    flex-shrink: 0;
}
.order-bump-checkbox strong {
    color: var(--ck-primary);
}
.order-bump-link {
    color: var(--ck-primary);
    text-decoration: none;
    font-weight: 600;
}
.order-bump-link:hover {
    color: var(--ck-primary-hover);
    text-decoration: underline;
}

.checkout-total-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}
.checkout-total-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ck-primary);
}

/* Upsell section */
.upsell-section {
    margin-top: 1.25rem;
}

.upsell-banner {
    background: rgba(0, 210, 106, 0.06);
    border: 1px solid rgba(0, 210, 106, 0.2);
    border-radius: 12px;
    padding: 0.75rem;
}

.upsell-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ck-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.offer-card-upsell {
    border-color: rgba(0, 210, 106, 0.25);
    background: rgba(0, 210, 106, 0.04);
}

.offer-card-upsell:hover {
    background: rgba(0, 210, 106, 0.1);
    border-color: var(--ck-primary);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .checkout-container {
        padding-top: 1rem;
    }

    .checkout-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .product-price {
        font-size: 1.4rem;
    }

    .qr-image {
        max-width: 180px;
    }
}
