/**
 * Special Features CSS
 * Typewriter, Lofi Player, Cursor Trail, PWA Install
 */

/* ============================================
   1. TYPEWRITER EFFECT
   ============================================ */
.typewriter-wrapper {
    display: inline;
    font-family: 'Fira Code', 'Courier New', monospace;
}

.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: linear-gradient(180deg, #8b5cf6, #38bdf8);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

.typewriter-cursor.done {
    animation: cursorBlink 1.2s step-end infinite;
    opacity: 0.6;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.typewriter-code-prefix {
    color: #c084fc;
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.5em;
}

/* ============================================
   2. LOFI PLAYER
   ============================================ */
.lofi-player {
    position: fixed;
    bottom: 90px;
    right: 16px;
    z-index: 9998;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: filter 0.3s ease;
}

.lofi-player:active {
    cursor: grabbing;
}

.lofi-player.dragging {
    transition: none !important;
    filter: brightness(1.2);
}

.lofi-blob {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lofi-blob:hover {
    transform: scale(1.1);
}

.lofi-blob:active {
    transform: scale(0.95);
}

.lofi-blob-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(56, 189, 248, 0.15));
    border: 1.5px solid rgba(139, 92, 246, 0.35);
    backdrop-filter: blur(12px);
    animation: blobMorph 8s ease-in-out infinite;
    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.15),
        inset 0 0 15px rgba(139, 92, 246, 0.08);
}

.lofi-blob-bg.playing {
    animation: blobMorph 3s ease-in-out infinite, blobPulse 1.5s ease-in-out infinite;
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow:
        0 0 30px rgba(139, 92, 246, 0.25),
        inset 0 0 20px rgba(139, 92, 246, 0.12);
}

@keyframes blobMorph {

    0%,
    100% {
        border-radius: 50% 45% 55% 48%;
    }

    25% {
        border-radius: 45% 55% 48% 52%;
    }

    50% {
        border-radius: 52% 48% 45% 55%;
    }

    75% {
        border-radius: 48% 52% 55% 45%;
    }
}

@keyframes blobPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }
}

.lofi-icon {
    position: relative;
    z-index: 1;
    font-size: 1.3rem;
    color: #c4b5fd;
    transition: all 0.3s ease;
    line-height: 1;
}

.lofi-player.playing .lofi-icon {
    color: #a78bfa;
    animation: iconDance 2s ease-in-out infinite;
}

@keyframes iconDance {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-5deg) scale(1.05);
    }

    75% {
        transform: rotate(5deg) scale(1.05);
    }
}

/* Expanded controls panel */
.lofi-controls {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
    padding: 12px 14px;
    min-width: 160px;
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.lofi-controls.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lofi-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.lofi-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #c4b5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lofi-play-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lofi-play-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    transform: scale(1.1);
}

.lofi-volume {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lofi-volume-icon {
    font-size: 0.7rem;
    color: #94a3b8;
}

.lofi-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 3px;
    outline: none;
}

.lofi-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

/* Visualizer bars */
.lofi-visualizer {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 16px;
    margin-top: 8px;
}

.lofi-bar {
    width: 3px;
    background: linear-gradient(to top, #8b5cf6, #38bdf8);
    border-radius: 2px;
    min-height: 2px;
    transition: height 0.1s ease;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .lofi-player {
        bottom: 80px;
        right: 8px;
    }

    .lofi-blob {
        width: 44px;
        height: 44px;
    }

    .lofi-icon {
        font-size: 1.1rem;
    }

    .lofi-controls {
        right: 0;
        min-width: 140px;
        padding: 10px 12px;
    }
}

/* ============================================
   3. CURSOR TRAIL
   ============================================ */
.cursor-trail-dot {
    position: fixed;
    pointer-events: none;
    z-index: 99990;
    border-radius: 50%;
    background: #8b5cf6;
    mix-blend-mode: screen;
}

.cursor-spark {
    position: fixed;
    pointer-events: none;
    z-index: 99991;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #a78bfa;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.8);
}

/* ============================================
   4. PWA INSTALL BUTTON
   ============================================ */
.pwa-install-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(56, 189, 248, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.pwa-install-nav:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(56, 189, 248, 0.15));
    border-color: rgba(139, 92, 246, 0.4);
    color: #e0d4fc;
    transform: translateY(-1px);
}

.pwa-install-close {
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.5;
    cursor: pointer;
    padding: 2px;
    transition: opacity 0.2s;
}

.pwa-install-close:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .pwa-install-nav {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}