/* Shared Insta Redemption full-page flow */

.insta-page {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    background: #ffffff;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.insta-page__header {
    padding: 20px 24px 4px;
    text-align: center;
}

.insta-page__brand {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #111;
    line-height: 1.3;
}

.insta-page[data-page="scan"] .insta-page__header {
    display: none;
}

.insta-page__main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 24px 24px;
}

.insta-page__footer {
    padding: 8px 24px 20px;
    text-align: center;
}

.insta-page__powered {
    font-size: 11px;
    color: #999;
}

.insta-page__back {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #1a2b4a;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.insta-page__back:hover,
.insta-page__back:focus {
    background: #f3f4f6;
    color: #111;
    text-decoration: none;
}

.insta-page__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    font-size: 22px;
    line-height: 1;
    color: #6b7280;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.insta-page__close:hover,
.insta-page__close:focus {
    background: #e5e7eb;
    color: #374151;
    text-decoration: none;
}

/* Card */

.insta-card {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.insta-card--centered {
    text-align: center;
}

.insta-card--scan,
.insta-card--confirm,
.insta-card--success {
    text-align: center;
}

.insta-card--scan {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 28px;
}

.insta-card__brand {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #1a2b4a;
    text-align: center;
    line-height: 1.3;
}

.insta-card--scan .insta-page__close {
    top: 12px;
    right: 12px;
}

.insta-card--scan .insta-icon-circle {
    margin-top: 4px;
    margin-bottom: 24px;
}

.insta-card--scan .insta-card__subtitle {
    margin-bottom: 28px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.insta-card--scan .insta-btn--primary,
.insta-card--scan .insta-qr-video-wrap,
.insta-card--scan .insta-scan-error,
.insta-card--scan .insta-info-box,
.insta-card--scan .insta-scan-divider,
.insta-card--scan .insta-manual-entry {
    width: 100%;
}

.insta-card__title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #111;
    line-height: 1.25;
}

.insta-card__subtitle {
    margin: 0 0 20px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.45;
}

.insta-card__actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
}

.insta-card__actions .insta-btn {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 0%;
    flex: 1 1 0%;
    min-width: 0;
    width: auto;
    box-sizing: border-box;
}

/* Reliable spacing — do not rely on flex gap (broken on some mobile browsers) */
.insta-card__actions .insta-btn + .insta-btn {
    margin-left: 12px;
}

/* Icon circles */

.insta-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin: 8px auto 20px;
    border-radius: 50%;
    background: #e8f7ee;
    color: #2f9e5a;
    font-size: 40px;
}

.insta-icon-circle svg {
    display: block;
    width: 44px;
    height: 44px;
}

.insta-icon-circle--sm {
    width: 56px;
    height: 56px;
    font-size: 22px;
    margin: 0 auto 14px;
}

.insta-icon-circle--sm svg {
    width: 26px;
    height: 26px;
}

.insta-icon-circle--store {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
}

.insta-icon-circle--store svg {
    width: 36px;
    height: 36px;
}

.insta-confirm-hero {
    margin-bottom: 4px;
}

/* Buttons */

.insta-btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, -webkit-transform 0.15s ease;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.insta-btn:active {
    -webkit-transform: scale(0.98);
    transform: scale(0.98);
}

.insta-btn--primary {
    background: #45b76d;
    border-color: #45b76d;
    color: #ffffff;
}

.insta-btn--primary:hover,
.insta-btn--primary:focus {
    background: #3aa460;
    border-color: #3aa460;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(69, 183, 109, 0.35);
}

.insta-btn--secondary {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #333;
}

.insta-btn--secondary:hover,
.insta-btn--secondary:focus {
    background: #e5e5e5;
    color: #333;
    text-decoration: none;
}

.insta-btn--outline {
    background: #fff;
    border-color: #d1d5db;
    color: #4b5563;
}

.insta-btn--outline:hover,
.insta-btn--outline:focus {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    text-decoration: none;
}

.insta-btn--outline-primary {
    background: #fff;
    border-color: #45b76d;
    color: #45b76d;
}

.insta-btn--outline-primary:hover,
.insta-btn--outline-primary:focus {
    background: #f0faf4;
    border-color: #3aa460;
    color: #3aa460;
    text-decoration: none;
}

.insta-btn--danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.insta-btn--danger:hover,
.insta-btn--danger:focus {
    background: #d63c2c;
    color: #fff;
    text-decoration: none;
}

/* Scan page */

.insta-card--scan .insta-btn--primary {
    margin-bottom: 0;
}

.insta-scan-divider {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin: 18px 0;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.insta-scan-divider::before,
.insta-scan-divider::after {
    content: "";
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.insta-scan-divider span {
    padding: 0 12px;
}

.insta-manual-entry {
    text-align: left;
    margin-bottom: 16px;
}

.insta-manual-entry__label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.insta-manual-entry__input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 14px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #111;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.insta-manual-entry__input:focus {
    outline: none;
    border-color: #45b76d;
    box-shadow: 0 0 0 3px rgba(69, 183, 109, 0.18);
}

.insta-manual-entry__hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.insta-info-box {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #e8f7ee;
    color: #2f6b45;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    box-sizing: border-box;
}

.insta-info-box .fa {
    flex-shrink: 0;
    margin-top: 1px;
    margin-right: 10px;
    color: #45b76d;
    font-size: 15px;
}
@supports (gap: 10px) {
    .insta-info-box .fa {
        margin-right: 0;
    }
}

.insta-qr-video-wrap {
    position: relative;
    margin: 0 0 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
}

.insta-qr-video-wrap video {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    display: block;
    background: #000;
}

.insta-qr-scanline {
    position: absolute;
    left: 8%;
    right: 8%;
    height: 2px;
    background: #45b76d;
    box-shadow: 0 0 8px rgba(69, 183, 109, 0.8);
    -webkit-animation: insta-scanline 2s ease-in-out infinite;
    animation: insta-scanline 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes insta-scanline {
    0%, 100% { top: 12%; }
    50% { top: 88%; }
}
@-webkit-keyframes insta-scanline {
    0%, 100% { top: 12%; }
    50% { top: 88%; }
}

.insta-scan-error {
    color: #c0392b;
    font-size: 13px;
    margin: 0 0 14px;
    line-height: 1.4;
}

/* Summary rows */

.insta-summary-box {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 4px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    text-align: left;
}

.insta-summary-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.insta-summary-row:last-child {
    border-bottom: none;
}

.insta-summary-label {
    color: #9ca3af;
    flex-shrink: 0;
}

.insta-summary-value {
    font-weight: 700;
    color: #111;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.insta-summary-value--accent,
#insta-confirm-balance {
    color: #45b76d;
}

/* Cashier verification (barcode + pass ID) */

.insta-cashier-verify {
    margin: 0 0 16px;
    padding: 16px 14px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    text-align: center;
}

.insta-cashier-verify__hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

.insta-cashier-verify__barcode {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto 12px;
}

.insta-cashier-verify__barcode img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    max-height: 90px;
}

.insta-cashier-verify__barcode-code {
    margin: 0 0 12px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #111;
    word-break: break-all;
}

.insta-cashier-verify__pass {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}

.insta-success-details .insta-summary-box,
.insta-details-modal-body .insta-summary-box {
    margin-bottom: 0;
}

.insta-card--success .insta-success-details {
    margin-top: 4px;
    margin-bottom: 20px;
}

.insta-details-modal-body .insta-cashier-verify {
    margin-bottom: 12px;
}

/* Warning */

.insta-warning-box {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 10px;
    background: #fff8e6;
    border: 1px solid #f5e0a8;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    color: #8a6d3b;
    margin-bottom: 20px;
    text-align: left;
    box-sizing: border-box;
}

.insta-warning-box .fa,
.insta-warning-box__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    color: #e6a817;
    font-size: 15px;
}
@supports (gap: 10px) {
    .insta-warning-box .fa,
    .insta-warning-box__icon {
        margin-right: 0;
    }
}

/* Confirm dialog */

.insta-dialog {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10050;
    display: none;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.insta-dialog.is-open {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.insta-dialog__box {
    background: #fff;
    width: 100%;
    max-width: 340px;
    padding: 28px 22px 22px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.insta-dialog__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #45b76d;
    color: #fff;
    font-size: 20px;
}

.insta-dialog__icon svg {
    display: block;
    width: 24px;
    height: 24px;
}

.insta-dialog__title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.insta-dialog__text {
    margin: 0 0 22px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.insta-dialog__amount {
    display: inline;
    color: #45b76d;
    font-weight: 700;
}

.insta-dialog__actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.insta-dialog__actions .insta-btn {
    width: 100%;
    margin: 0;
}

.insta-dialog__actions .insta-btn + .insta-btn {
    margin-top: 12px;
}

.insta-dialog__box--details {
    max-width: 360px;
    text-align: left;
    position: relative;
}

.insta-dialog__box--details .insta-btn {
    margin-top: 12px;
}

.insta-dialog__close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

/* Processing overlay */

.insta-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 10060;
    display: none;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.insta-overlay.is-open {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.insta-overlay__box {
    text-align: center;
    max-width: 320px;
}

.insta-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8e8e8;
    border-top-color: #45b76d;
    border-radius: 50%;
    -webkit-animation: insta-spin 1s linear infinite;
    animation: insta-spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Success */

.insta-success-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    margin: 4px auto 16px;
}

.insta-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #45b76d;
    color: #fff;
    font-size: 32px;
    box-shadow: 0 6px 20px rgba(69, 183, 109, 0.35);
}

.insta-success-badge__confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.insta-success-badge__confetti--1 {
    top: 10px;
    left: 18px;
    background: #f5c518;
}

.insta-success-badge__confetti--2 {
    top: 8px;
    right: 22px;
    width: 6px;
    height: 6px;
    background: #45b76d;
}

.insta-success-badge__confetti--3 {
    bottom: 22px;
    left: 12px;
    width: 7px;
    height: 7px;
    background: #f0a500;
}

.insta-success-badge__confetti--4 {
    bottom: 18px;
    right: 14px;
    background: #7ed957;
}

.insta-success-badge__confetti--5 {
    top: 40px;
    left: 4px;
    width: 5px;
    height: 5px;
    background: #45b76d;
}

.insta-success-badge__confetti--6 {
    top: 36px;
    right: 6px;
    width: 5px;
    height: 5px;
    background: #f5c518;
}

.insta-card--success .insta-btn--primary {
    margin-top: 4px;
}

/* Landing / redeem CTA helpers */

.insta-redeem-now-btn {
    cursor: pointer;
}

.insta-redeem-slot {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
}

.insta-post-redeem {
    text-align: center;
}

.insta-redemption-details-btn {
    cursor: pointer;
}

.insta-already-redeemed {
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

.insta-post-redemption__title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: #222;
    text-align: center;
}

.insta-post-redemption__note {
    margin: 0;
    font-size: 14px;
    color: #555;
    text-align: center;
}

/* Responsive — keep mobile card width on desktop, top-aligned (no large vertical gap) */

@media (min-width: 768px) {
    .insta-page {
        min-height: auto;
    }

    .insta-page__main {
        flex: 0 1 auto;
        align-items: flex-start;
        justify-content: center;
        padding: 16px 24px 8px;
    }

    .insta-page__footer {
        padding-top: 8px;
        padding-bottom: 24px;
    }

    .insta-page[data-page="scan"] .insta-page__main {
        padding-top: 24px;
    }

    .insta-card {
        padding: 28px 28px 24px;
    }

    .insta-card--scan {
        box-shadow: none;
        border: none;
        max-width: 420px;
        padding-top: 8px;
    }

    .insta-btn {
        font-size: 16px;
        padding: 15px 18px;
    }
}

@media (max-width: 480px) {
    .insta-page__main {
        padding: 12px 16px 20px;
    }

    .insta-card {
        padding: 24px 16px 20px;
    }

    .insta-card__actions {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }

    .insta-card__actions .insta-btn {
        width: 100%;
        -webkit-box-flex: 0;
        -ms-flex: 0 0 auto;
        flex: 0 0 auto;
    }

    .insta-card__actions .insta-btn + .insta-btn {
        margin-left: 0;
        margin-top: 12px;
    }
}

/* Dummy QR scan preview (no camera) */
.insta-qr-demo-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #111;
    color: #fff;
    gap: 10px;
    padding: 24px;
}

.insta-qr-demo-preview__label {
    font-size: 13px;
    color: #d1d5db;
}

.insta-qr-demo-preview__code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #7ed957;
}
