/* =====================================================
   NOVARIDE NEWSLETTER QUIET BAR
   Apple-Level Premium — World-Class Design
   ===================================================== */

/* ========== QUIET BAR CONTAINER ========== */
.nr-quiet-bar {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 60px));
    z-index: 95;
    width: 92%;
    max-width: 680px;
    border-radius: 24px;
    background: rgba(10, 10, 10, 0.88);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(16, 185, 129, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    padding: 20px 24px;
    opacity: 0;
    visibility: hidden;
    transition: none;
    will-change: transform, opacity;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.nr-quiet-bar.nr-bar-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    animation: nrBarSlideIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nr-quiet-bar.nr-bar-dismissing {
    animation: nrBarSlideOut 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}

/* ========== ANIMATIONS ========== */

@keyframes nrBarSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(calc(100% + 60px)) scale(0.95);
    }

    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-6px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes nrBarSlideOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.97);
        visibility: hidden;
    }
}

@keyframes nrShimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes nrPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
}

@keyframes nrCheckDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes nrSuccessScale {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes nrParticleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes nrProgressShrink {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@keyframes nrShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(2px);
    }
}

@keyframes nrFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== LAYOUT — DESKTOP (DEFAULT) ========== */

.nr-bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Close button */
.nr-bar-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    z-index: 2;
}

.nr-bar-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.1);
}

.nr-bar-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.5;
}

/* Icon */
.nr-bar-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nrPulse 3s ease-in-out infinite;
}

.nr-bar-icon svg {
    width: 20px;
    height: 20px;
    color: #10b981;
}

/* Text */
.nr-bar-text {
    flex: 0 0 auto;
    min-width: 0;
}

.nr-bar-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.3;
    white-space: nowrap;
}

.nr-bar-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.3;
    margin-top: 1px;
    white-space: nowrap;
}

/* Form */
.nr-bar-form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.nr-bar-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

.nr-bar-input {
    width: 100%;
    height: 42px;
    padding: 0 16px;
    font-size: 13px;
    font-family: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.nr-bar-input:focus {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.06);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.nr-bar-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
}

/* Submit button */
.nr-bar-submit {
    flex-shrink: 0;
    height: 42px;
    padding: 0 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #000;
    background: linear-gradient(135deg, #10b981, #34d399);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.nr-bar-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.2) 50%,
            transparent 100%);
    background-size: 200% 100%;
    animation: nrShimmer 3s ease-in-out infinite;
    border-radius: inherit;
}

.nr-bar-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.nr-bar-submit:active {
    transform: translateY(0) scale(0.98);
}

.nr-bar-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.nr-bar-submit span {
    position: relative;
    z-index: 1;
}

/* Loading spinner */
.nr-bar-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: nrSpin 0.6s linear infinite;
    position: relative;
    z-index: 1;
}

@keyframes nrSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Error message */
.nr-bar-error {
    position: absolute;
    bottom: -22px;
    left: 0;
    font-size: 11px;
    color: #ef4444;
    animation: nrFadeIn 0.3s ease;
    white-space: nowrap;
}

/* ========== AUTO-DISMISS PROGRESS BAR ========== */

.nr-bar-progress {
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 2px;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
}

.nr-bar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 1px;
    transform-origin: left;
    animation: nrProgressShrink 15s linear forwards;
    animation-play-state: running;
}

.nr-quiet-bar.nr-bar-paused .nr-bar-progress-fill {
    animation-play-state: paused;
}

/* ========== SUCCESS STATE ========== */

.nr-bar-success {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 0;
    animation: nrFadeIn 0.4s ease;
}

.nr-bar-success.nr-active {
    display: flex;
}

.nr-bar-success-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nrSuccessScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.nr-bar-success-icon svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: nrCheckDraw 0.4s ease 0.3s forwards;
}

.nr-bar-success-text {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.nr-bar-success-text span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

/* Particles container */
.nr-bar-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 24px;
}

.nr-bar-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: nrParticleBurst 0.8s ease-out forwards;
}

/* ========== MOBILE STYLES (<1024px) ========== */

@media (max-width: 1023px) {
    .nr-quiet-bar {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        transform: translateX(0) translateY(100%);
        border-radius: 24px 24px 0 0;
        padding: 20px 20px 24px;
        background: rgba(8, 8, 8, 0.95);
        border-bottom: none;
        box-shadow:
            0 -20px 60px rgba(0, 0, 0, 0.5),
            0 0 0 1px rgba(16, 185, 129, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

    .nr-quiet-bar.nr-bar-visible {
        transform: translateX(0) translateY(0);
        animation: nrBarSlideInMobile 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    .nr-quiet-bar.nr-bar-dismissing {
        animation: nrBarSlideOutMobile 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    /* Shift up if sticky CTA is visible */
    .nr-quiet-bar.nr-bar-above-sticky {
        bottom: 68px;
        border-radius: 24px;
        margin: 0 8px;
        width: calc(100% - 16px);
    }

    @keyframes nrBarSlideInMobile {
        0% {
            opacity: 0;
            transform: translateX(0) translateY(100%);
        }

        60% {
            opacity: 1;
            transform: translateX(0) translateY(-4px);
        }

        100% {
            opacity: 1;
            transform: translateX(0) translateY(0);
        }
    }

    @keyframes nrBarSlideOutMobile {
        0% {
            opacity: 1;
            transform: translateX(0) translateY(0);
        }

        100% {
            opacity: 0;
            transform: translateX(0) translateY(100%);
            visibility: hidden;
        }
    }

    /* Drag handle */
    .nr-bar-handle {
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 2px;
        margin: 0 auto 16px;
    }

    /* Stack layout */
    .nr-bar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .nr-bar-header-row {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .nr-bar-title {
        font-size: 15px;
        white-space: normal;
    }

    .nr-bar-subtitle {
        font-size: 12px;
        white-space: normal;
    }

    /* Close button repositioned */
    .nr-bar-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
    }

    .nr-bar-close svg {
        width: 16px;
        height: 16px;
    }

    /* Form stacked */
    .nr-bar-form {
        flex-direction: column;
        gap: 10px;
    }

    .nr-bar-input {
        height: 48px;
        font-size: 16px;
        /* Prevents iOS auto-zoom */
        padding: 0 18px;
        border-radius: 14px;
    }

    .nr-bar-input::placeholder {
        font-size: 14px;
    }

    .nr-bar-submit {
        height: 48px;
        width: 100%;
        font-size: 15px;
        border-radius: 14px;
    }

    /* Progress bar */
    .nr-bar-progress {
        left: 0;
        right: 0;
        border-radius: 0;
    }

    /* Error */
    .nr-bar-error {
        position: static;
        margin-top: -4px;
    }

    /* Success */
    .nr-bar-success {
        padding: 12px 0;
    }
}

/* ========== HIDE DRAG HANDLE ON DESKTOP ========== */

@media (min-width: 1024px) {
    .nr-bar-handle {
        display: none;
    }

    .nr-bar-header-row {
        display: contents;
    }
}

/* ========== SAFE AREA (NOTCHED DEVICES) ========== */

@supports (padding: max(0px)) {
    @media (max-width: 1023px) {
        .nr-quiet-bar:not(.nr-bar-above-sticky) {
            padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
        }
    }
}

/* ========== REDUCED MOTION ========== */

@media (prefers-reduced-motion: reduce) {

    .nr-quiet-bar,
    .nr-quiet-bar.nr-bar-visible,
    .nr-quiet-bar.nr-bar-dismissing {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .nr-bar-submit::before {
        animation: none;
    }

    .nr-bar-icon {
        animation: none;
    }
}