/* ============================================================================
   DEMO EDITOR CSS — Live Inline Text Editing System
   Provides editable content UI, floating toolbar, toast notifications,
   onboarding bar, modals, and conversion CTAs for demo websites.
   ============================================================================ */

/* ---- Local Nerds Brand Tokens (editor overlay layer) ---- */
:root {
    --ln-bg: #0a0a0f;
    --ln-pink: #B00D68;
    --ln-pink-hover: #d41080;
    --ln-cyan: #40C9F7;
    --ln-text: #f0f0f5;
    --ln-muted: #94a3b8;
    --ln-muted-dark: #64748b;
    --ln-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ln-radius: 16px;
    --ln-radius-sm: 12px;
    --ln-radius-btn: 8px;
}


/* ============================================================================
   1. Editable Element States
   ============================================================================ */

.demo-editor-editable {
    cursor: text;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
    border-radius: 4px;
    position: relative;
}

.demo-editor-editable:hover {
    border: 1px dashed var(--demo-primary, #1e40af);
    background-color: rgba(30, 64, 175, 0.04);
}

.demo-editor-editable--active,
.demo-editor-editable:focus {
    border: 2px solid var(--demo-primary, #1e40af);
    background-color: rgba(30, 64, 175, 0.06);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}


/* ============================================================================
   2. Floating Toolbar
   ============================================================================ */

.demo-editor-toolbar {
    position: absolute;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1e293b;
    border-radius: var(--ln-radius-btn);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
    animation: demo-editor-fade-in 0.15s ease-out;
}

/* Arrow pointer at bottom */
.demo-editor-toolbar::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #1e293b;
}

.demo-editor-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-family: var(--ln-font);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.demo-editor-toolbar__btn:active {
    transform: scale(0.96);
}

.demo-editor-toolbar__btn--save {
    background: #10b981;
    color: #fff;
}

.demo-editor-toolbar__btn--save:hover {
    background: #059669;
}

.demo-editor-toolbar__btn--cancel {
    background: #475569;
    color: #e2e8f0;
}

.demo-editor-toolbar__btn--cancel:hover {
    background: #64748b;
}


/* ============================================================================
   3. Toast Notifications
   ============================================================================ */

.demo-editor-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: #1e293b;
    color: var(--ln-text);
    border-radius: var(--ln-radius-btn);
    font-family: var(--ln-font);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    animation: demo-editor-slide-up 0.3s ease-out;
    pointer-events: auto;
    max-width: calc(100% - 32px);
}

.demo-editor-toast--success {
    border-left: 4px solid #10b981;
}

.demo-editor-toast--error,
.demo-editor-toast--warning {
    border-left: 4px solid var(--ln-pink);
}

.demo-editor-toast--dismiss {
    animation: demo-editor-fade-in 0.2s ease-out reverse forwards;
}


/* ============================================================================
   4. Onboarding Bar
   ============================================================================ */

.demo-editor-onboarding {
    position: fixed;
    bottom: 48px; /* sits just above the demo banner */
    left: 0;
    right: 0;
    z-index: 950;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(176, 13, 104, 0.25);
    padding: 12px 24px;
    animation: demo-editor-slide-down 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--ln-font);
}

.demo-editor-onboarding__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.demo-editor-onboarding__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--ln-cyan);
    opacity: 0.9;
}

.demo-editor-onboarding__text {
    color: var(--ln-muted);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.demo-editor-onboarding__text strong {
    color: var(--ln-text);
    font-weight: 600;
}

.demo-editor-onboarding__dismiss {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: var(--ln-muted-dark);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    margin-left: 8px;
    line-height: 1;
    font-family: var(--ln-font);
}

.demo-editor-onboarding__dismiss:hover {
    color: var(--ln-text);
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.05);
}


/* ============================================================================
   5. Pulsing Hint (Hero H1 first-visit indicator)
   ============================================================================ */

.demo-editor-pulse {
    border: 1px dashed var(--demo-primary, #1e40af);
    border-radius: 4px;
    animation: demo-editor-pulse 2s ease-in-out infinite;
}


/* ============================================================================
   6. Modal Backdrop
   ============================================================================ */

.demo-editor-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: demo-editor-fade-in 0.3s ease-out;
}


/* ============================================================================
   7. Modal
   ============================================================================ */

.demo-editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9600;
    width: 100%;
    max-width: 480px;
    background: var(--ln-bg);
    border: 1px solid rgba(176, 13, 104, 0.3);
    border-radius: var(--ln-radius);
    padding: 48px 40px;
    box-shadow:
        0 0 80px rgba(176, 13, 104, 0.15),
        0 0 160px rgba(64, 201, 247, 0.08);
    animation: demo-editor-scale-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--ln-font);
}


/* ============================================================================
   8. Modal Elements
   ============================================================================ */

.demo-editor-modal__brand {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--ln-pink);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.demo-editor-modal__heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--ln-text);
    line-height: 1.3;
    margin-bottom: 16px;
}

.demo-editor-modal__body {
    font-size: 16px;
    color: var(--ln-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.demo-editor-modal__subtext {
    font-size: 14px;
    color: var(--ln-muted-dark);
    line-height: 1.5;
    margin-bottom: 20px;
}

.demo-editor-modal__features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
}

.demo-editor-modal__features li {
    position: relative;
    padding-left: 24px;
    font-size: 14px;
    color: var(--ln-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}

.demo-editor-modal__features li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--ln-cyan);
    font-weight: 700;
}

.demo-editor-modal__features li:last-child {
    margin-bottom: 0;
}

.demo-editor-modal__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    background: var(--ln-pink);
    color: #fff;
    border: none;
    border-radius: var(--ln-radius-sm);
    font-family: var(--ln-font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    text-decoration: none;
    margin-bottom: 16px;
}

.demo-editor-modal__cta:hover {
    filter: brightness(1.15);
    color: #fff;
}

.demo-editor-modal__cta:active {
    transform: scale(0.98);
}

.demo-editor-modal__dismiss {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: var(--ln-cyan);
    font-family: var(--ln-font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    transition: text-decoration 0.15s ease;
    text-decoration: none;
}

.demo-editor-modal__dismiss:hover {
    text-decoration: underline;
}

.demo-editor-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    color: var(--ln-muted-dark);
    font-size: 1.125rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    line-height: 1;
    font-family: var(--ln-font);
}

.demo-editor-modal__close:hover {
    color: var(--ln-text);
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.05);
}


/* ============================================================================
   9. Modal Upgrade Variant (gradient top border)
   ============================================================================ */

.demo-editor-modal--upgrade {
    border-top: 2px solid;
    border-image: linear-gradient(to right, #B00D68, #40C9F7) 1;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    /* Wrap in a container div if you need fully rounded corners with gradient border */
    overflow: hidden;
}

/* Restore visual rounding with an inner pseudo-element */
.demo-editor-modal--upgrade::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #B00D68, #40C9F7);
}


/* ============================================================================
   10. Responsive — Mobile (below 768px)
   ============================================================================ */

@media (max-width: 768px) {
    /* Modal */
    .demo-editor-modal {
        width: calc(100% - 32px);
        max-width: none;
        padding: 32px 24px;
    }

    .demo-editor-modal__heading {
        font-size: 20px;
    }

    .demo-editor-modal__body {
        font-size: 15px;
    }

    /* Toolbar */
    .demo-editor-toolbar__btn {
        min-height: 44px;
        padding: 10px 20px;
        font-size: 0.875rem;
    }

    /* Onboarding bar */
    .demo-editor-onboarding {
        padding: 14px 16px;
    }

    .demo-editor-onboarding__inner {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        gap: 8px;
    }

    .demo-editor-onboarding__text {
        font-size: 0.8125rem;
        flex-basis: 100%;
        order: 2;
    }

    .demo-editor-onboarding__icon {
        order: 1;
    }

    .demo-editor-onboarding__dismiss {
        position: absolute;
        top: 8px;
        right: 12px;
        order: 3;
    }

    .demo-editor-onboarding {
        position: relative;
    }

    /* Toast */
    .demo-editor-toast {
        width: calc(100% - 32px);
        max-width: none;
        bottom: 96px;
    }
}

@media (max-width: 480px) {
    .demo-editor-modal {
        padding: 28px 20px;
    }

    .demo-editor-modal__cta {
        height: 52px;
        font-size: 16px;
    }
}


/* ============================================================================
   11. Animations
   ============================================================================ */

@keyframes demo-editor-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes demo-editor-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes demo-editor-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes demo-editor-pulse {
    0%, 100% {
        border-color: rgba(var(--demo-primary-rgb, 30, 64, 175), 0.3);
    }
    50% {
        border-color: rgba(var(--demo-primary-rgb, 30, 64, 175), 0.7);
    }
}

@keyframes demo-editor-slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ============================================================================
   Reduced Motion Preference
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .demo-editor-editable {
        transition: none;
    }

    .demo-editor-toolbar,
    .demo-editor-toast,
    .demo-editor-onboarding,
    .demo-editor-modal-backdrop,
    .demo-editor-modal {
        animation: none;
    }

    .demo-editor-pulse {
        animation: none;
        border-color: rgba(var(--demo-primary-rgb, 30, 64, 175), 0.5);
    }
}
