/* ==========================================================================
   BotPulse V22 — Enterprise polish, hero image, button micro-interactions,
   enhanced responsiveness and visual refinements.
   Loaded AFTER botpulse.css, botpulse-v20.css and botpulse-v21.css.
   ========================================================================== */

/* ---------- Design token overrides ---------- */

:root {
    --bp-primary-hover: #8b5cf6;
    --bp-surface-glass: rgb(17 24 45 / 72%);
    --bp-glow-primary: rgb(124 58 237 / 18%);
    --bp-glow-blue: rgb(59 130 246 / 12%);
    --bp-transition-button: 200ms cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Hero image upgrade ---------- */

.bp-hero__frame img {
    border-radius: 20px;
    object-fit: cover;
    box-shadow:
        0 0 0 1px rgb(124 58 237 / 12%),
        0 32px 80px rgb(0 0 0 / 38%),
        0 0 120px rgb(124 58 237 / 8%);
}

/* Responsive hero image via <picture> or srcset —
   when the template switches to a real photo, this ensures crisp display. */
.bp-hero__frame {
    overflow: hidden;
    border-radius: 22px;
}

.bp-hero__frame picture {
    display: block;
    width: 100%;
    height: 100%;
}

.bp-hero__frame picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Glow behind hero image */
.bp-hero__glow {
    background:
        radial-gradient(ellipse 70% 55% at 50% 50%, rgb(124 58 237 / 22%), transparent 72%),
        radial-gradient(ellipse 50% 40% at 80% 30%, rgb(59 130 246 / 14%), transparent 70%) !important;
}

/* ---------- Button micro-interactions (V22 upgrade) ---------- */

/* Primary button — richer hover glow and pressed feedback */
.bp-button {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition:
        background var(--bp-transition-button),
        border-color var(--bp-transition-button),
        color var(--bp-transition-button),
        box-shadow var(--bp-transition-button),
        transform 120ms ease,
        opacity var(--bp-transition-button);
}

.bp-button--primary {
    box-shadow:
        0 1px 0 rgb(255 255 255 / 8%) inset,
        0 4px 16px rgb(124 58 237 / 28%);
}

.bp-button--primary:hover:not(:disabled):not(.is-loading) {
    background: var(--bp-primary-hover);
    box-shadow:
        0 1px 0 rgb(255 255 255 / 10%) inset,
        0 6px 24px rgb(124 58 237 / 40%),
        0 0 0 3px rgb(139 92 246 / 10%);
    transform: translateY(-1px);
}

.bp-button--primary:active:not(:disabled):not(.is-loading),
.bp-button--primary.is-pressed {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 2px 8px rgb(124 58 237 / 22%);
}

.bp-button--secondary:hover:not(:disabled):not(.is-loading) {
    border-color: var(--bp-primary-hover);
    background: rgb(139 92 246 / 8%);
    transform: translateY(-1px);
}

.bp-button--secondary:active:not(:disabled):not(.is-loading) {
    transform: scale(0.98);
}

/* Loading state — smooth spinner */
.bp-button.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.bp-button.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid rgb(255 255 255 / 20%);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: bp-spin 600ms linear infinite;
}

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

/* Success state — animated check */
.bp-button.is-success {
    background: var(--bp-success) !important;
    border-color: var(--bp-success) !important;
    box-shadow: 0 4px 16px rgb(34 197 94 / 30%);
    animation: bp-success-pulse 400ms ease;
}

@keyframes bp-success-pulse {
    0% { transform: scale(0.96); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Error state */
.bp-button.is-error {
    background: var(--bp-error) !important;
    border-color: var(--bp-error) !important;
    box-shadow: 0 4px 16px rgb(239 68 68 / 30%);
    animation: bp-error-shake 400ms ease;
}

@keyframes bp-error-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Disabled state */
.bp-button:disabled:not(.is-loading):not(.is-success) {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(30%);
}

/* ---------- Toast notification enhancements ---------- */

.bp-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: min(440px, calc(100vw - 40px));
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 550;
    line-height: 1.45;
    backdrop-filter: blur(16px);
    box-shadow:
        0 12px 40px rgb(0 0 0 / 32%),
        0 0 0 1px rgb(255 255 255 / 5%) inset;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 320ms cubic-bezier(.22, .61, .36, 1), opacity 320ms ease;
}

.bp-toast.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.bp-toast.is-leaving {
    transform: translateX(120%);
    opacity: 0;
}

.bp-toast--success {
    border: 1px solid rgb(34 197 94 / 22%);
    background: rgb(17 24 45 / 92%);
    color: #bbf7d0;
}

.bp-toast--error {
    border: 1px solid rgb(239 68 68 / 22%);
    background: rgb(45 17 17 / 92%);
    color: #fca5a5;
}

.bp-toast--info {
    border: 1px solid rgb(59 130 246 / 22%);
    background: rgb(17 24 45 / 92%);
    color: #bfdbfe;
}

.bp-toast__icon {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.bp-toast--success .bp-toast__icon {
    background: rgb(34 197 94 / 18%);
    color: #22c55e;
}

.bp-toast--error .bp-toast__icon {
    background: rgb(239 68 68 / 18%);
    color: #ef4444;
}

.bp-toast--info .bp-toast__icon {
    background: rgb(59 130 246 / 18%);
    color: #3b82f6;
}

.bp-toast__message {
    flex: 1;
    min-width: 0;
}

.bp-toast__close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    color: inherit;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 160ms ease, background 160ms ease;
}

.bp-toast__close:hover {
    opacity: 1;
    background: rgb(255 255 255 / 8%);
}

.bp-toast-region {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: var(--bp-z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.bp-toast-region > * {
    pointer-events: auto;
}

/* ---------- Platform card hover effects ---------- */

.bp-platform-card {
    transition:
        border-color var(--bp-transition-button),
        background var(--bp-transition-button),
        box-shadow var(--bp-transition-button),
        transform 180ms ease;
}

.bp-platform-card:hover:not(.is-unavailable) {
    border-color: rgb(139 92 246 / 50%);
    box-shadow:
        0 8px 32px rgb(0 0 0 / 18%),
        0 0 0 1px rgb(139 92 246 / 12%);
    transform: translateY(-3px);
}

.bp-platform-card:active:not(.is-unavailable) {
    transform: translateY(-1px) scale(0.99);
}

/* ---------- Benefit card hover ---------- */

.bp-benefit-card {
    transition:
        border-color var(--bp-transition-button),
        box-shadow var(--bp-transition-button),
        transform 200ms ease;
}

.bp-benefit-card:hover {
    border-color: rgb(124 58 237 / 30%);
    box-shadow: 0 12px 40px rgb(0 0 0 / 22%);
    transform: translateY(-4px);
}

/* ---------- Service card (catalog) ---------- */

.bp-service-card {
    transition:
        border-color var(--bp-transition-button),
        box-shadow var(--bp-transition-button),
        transform 180ms ease;
}

.bp-service-card:hover {
    border-color: rgb(139 92 246 / 42%);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgb(0 0 0 / 18%);
}

/* ---------- Step card hover ---------- */

.bp-step-card {
    transition:
        border-color var(--bp-transition-button),
        box-shadow var(--bp-transition-button),
        transform 200ms ease;
}

.bp-step-card:hover {
    border-color: rgb(124 58 237 / 30%);
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgb(0 0 0 / 18%);
}

/* ---------- Pix inline card polish ---------- */

.bp-pix-inline {
    border: 1px solid rgb(34 197 94 / 18%);
    border-radius: 18px;
    background: linear-gradient(145deg, rgb(17 30 20 / 60%), rgb(10 16 31 / 80%));
    box-shadow: 0 12px 40px rgb(0 0 0 / 18%);
    overflow: hidden;
}

.bp-pix-inline__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgb(34 197 94 / 10%);
}

.bp-pix-inline__body {
    padding: 20px;
}

.bp-pix-inline__qr {
    text-align: center;
}

.bp-pix-inline__qr img {
    border-radius: 14px;
    border: 3px solid rgb(255 255 255 / 8%);
    background: white;
    padding: 8px;
}

.bp-pix-inline__amount {
    display: block;
    margin-top: 12px;
    color: #22c55e;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.02em;
}

/* Pix status badges */
.bp-status--pending i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bp-warning);
    box-shadow: 0 0 8px rgb(245 158 11 / 40%);
    animation: bp-pulse 2s ease infinite;
}

.bp-status--approved i {
    background: var(--bp-success);
    box-shadow: 0 0 8px rgb(34 197 94 / 40%);
}

@keyframes bp-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ---------- Timeline (order tracking) ---------- */

.bp-timeline {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: grid;
    gap: 0;
}

.bp-timeline li {
    position: relative;
    padding: 12px 0 12px 36px;
    font-size: 13px;
    color: var(--bp-text-muted);
}

.bp-timeline li::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bp-border);
}

.bp-timeline li:first-child::before {
    top: 50%;
}

.bp-timeline li:last-child::before {
    bottom: 50%;
}

.bp-timeline li::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid var(--bp-border);
    border-radius: 50%;
    background: var(--bp-surface);
    z-index: 1;
}

.bp-timeline li.is-done::after {
    background: var(--bp-success);
    border-color: var(--bp-success);
    box-shadow: 0 0 8px rgb(34 197 94 / 25%);
}

.bp-timeline li.is-done::before {
    background: var(--bp-success);
}

.bp-timeline li.is-current::after {
    background: var(--bp-primary);
    border-color: var(--bp-primary);
    box-shadow: 0 0 0 4px rgb(124 58 237 / 18%), 0 0 12px rgb(124 58 237 / 30%);
    animation: bp-pulse 2s ease infinite;
}

.bp-timeline li.is-current {
    color: var(--bp-text);
    font-weight: 600;
}

.bp-timeline li strong {
    display: block;
    color: var(--bp-text);
    font-weight: 600;
}

.bp-timeline li time {
    display: block;
    font-size: 11px;
    color: #8898b3;
    margin-top: 2px;
}

/* ---------- Float cards on hero (animated) ---------- */

.bp-float-card {
    animation: bp-float-in 800ms cubic-bezier(.22, .61, .36, 1) both;
}

.bp-float-card--platforms {
    animation-delay: 400ms;
}

.bp-float-card--payment {
    animation-delay: 600ms;
}

@keyframes bp-float-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Section entrance animations ---------- */

.bp-section {
    animation: bp-section-in 600ms cubic-bezier(.22, .61, .36, 1) both;
}

.bp-platforms-section { animation-delay: 200ms; }
.bp-benefits-section { animation-delay: 100ms; }
.bp-featured-section { animation-delay: 100ms; }
.bp-steps-section { animation-delay: 100ms; }

@keyframes bp-section-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Final CTA glow animation */
.bp-final-cta__glow {
    animation: bp-cta-glow 4s ease infinite alternate;
}

@keyframes bp-cta-glow {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* ---------- Account dashboard card polish ---------- */

.bp-account-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

/* ---------- Scrollbar styling ---------- */

.bp-main ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.bp-main ::-webkit-scrollbar-track {
    background: transparent;
}

.bp-main ::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #34405f;
}

.bp-main ::-webkit-scrollbar-thumb:hover {
    background: #4a5775;
}

/* ---------- Focus-visible rings ---------- */

.bp-button:focus-visible,
.bp-platform-card:focus-visible,
.bp-benefit-card:focus-visible,
.bp-buy-platform:focus-visible,
.bp-buy-method:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--bp-primary);
    outline-offset: 2px;
}

/* ---------- Responsive fine-tuning (V22 additions) ---------- */

/* Ultrawide (2560px) */
@media (min-width: 2560px) {
    :root {
        --bp-container: 1440px;
    }

    .bp-hero h1 {
        font-size: 62px;
    }

    .bp-section h2 {
        font-size: 38px;
    }
}

/* Large Desktop (1920px) */
@media (min-width: 1920px) {
    .bp-hero {
        gap: 48px;
    }
}

/* Desktop (1280–1440) — default, no changes */

/* Small laptop (1024) */
@media (max-width: 1024px) {
    .bp-hero {
        flex-direction: column;
        text-align: center;
        gap: 32px;
    }

    .bp-hero__actions {
        justify-content: center;
    }

    .bp-hero__trust {
        justify-content: center;
    }

    .bp-hero__visual {
        max-width: 600px;
        margin-inline: auto;
    }

    .bp-platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bp-benefit-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bp-step-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bp-buy-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet (768–820) */
@media (max-width: 820px) {
    .bp-container {
        width: min(100% - 32px, var(--bp-container));
    }

    .bp-hero h1 {
        font-size: clamp(28px, 5vw, 40px);
    }

    .bp-platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bp-benefit-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bp-step-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin-inline: auto;
    }

    .bp-catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bp-toast-region {
        right: 16px;
        bottom: 88px;
        left: 16px;
    }

    .bp-toast {
        min-width: 0;
        max-width: 100%;
    }
}

/* Large phone (414–430) */
@media (max-width: 430px) {
    .bp-container {
        width: min(100% - 24px, var(--bp-container));
    }

    .bp-hero h1 {
        font-size: 28px;
    }

    .bp-hero__subtitle {
        font-size: 14px;
    }

    .bp-section h2 {
        font-size: 22px;
    }

    .bp-platform-grid {
        grid-template-columns: 1fr;
    }

    .bp-benefit-grid {
        grid-template-columns: 1fr;
    }

    .bp-catalog-grid,
    .bp-catalog-grid--featured {
        grid-template-columns: 1fr;
    }

    .bp-button--lg {
        width: 100%;
        justify-content: center;
    }

    .bp-hero__actions {
        flex-direction: column;
        gap: 10px;
    }

    .bp-buy-intro {
        flex-direction: column;
        gap: 16px;
    }

    .bp-buy-intro h1 {
        font-size: 26px;
    }

    .bp-buy-intro__trust {
        justify-content: flex-start;
        max-width: 100%;
    }
}

/* Small phone (320–375) */
@media (max-width: 375px) {
    .bp-container {
        width: min(100% - 20px, var(--bp-container));
    }

    .bp-hero h1 {
        font-size: 24px;
    }

    .bp-section h2 {
        font-size: 20px;
    }

    .bp-button--lg {
        min-height: 48px;
        font-size: 14px;
    }

    .bp-buy-platforms {
        gap: 6px;
        padding: 4px;
        border-radius: 14px;
    }

    .bp-buy-platform {
        padding: 6px 10px;
        font-size: 11px;
    }

    .bp-pix-inline__body {
        padding: 14px;
    }

    .bp-pix-inline__qr img {
        max-width: 180px;
    }
}

/* Safe area for iPhone notch / bottom bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bp-bottom-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .bp-toast-region {
        bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* Prevent horizontal overflow everywhere */
.bp-body {
    overflow-x: hidden;
}

.bp-main {
    overflow-x: hidden;
}

/* ---------- Print styles ---------- */

@media print {
    .bp-header,
    .bp-bottom-nav,
    .bp-drawer,
    .bp-drawer-backdrop,
    .bp-toast-region,
    .bp-final-cta {
        display: none !important;
    }

    .bp-body {
        background: white !important;
        color: #111 !important;
    }
}
