/* ============================================================
   BART PERSONALITY & INTERACTIVE FEATURES CSS
   Based on iOS visual design with web adaptations
   ============================================================ */

/* ============================================================
   BART SPEECH BUBBLE
   ============================================================ */
.bart-speech-bubble {
    position: fixed;
    z-index: 10000;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 300px;
}

.bart-speech-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-120%);
}

.bart-speech-bubble .speech-content {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.4;
}

.bart-speech-bubble .speech-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid rgba(255, 255, 255, 0.95);
}

/* ============================================================
   BART WIGGLE ANIMATION
   ============================================================ */
.live-bart.wiggle {
    animation: bartWiggle 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes bartWiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-10deg) scale(1.05);
    }

    40% {
        transform: rotate(10deg) scale(1.08);
    }

    60% {
        transform: rotate(-5deg) scale(1.05);
    }

    80% {
        transform: rotate(5deg);
    }
}

/* ============================================================
   EASTER EGG TOAST
   ============================================================ */
.easter-egg-toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: linear-gradient(135deg, #A3A7FF 0%, #CBC9FF 100%);
    border-radius: 100px;
    box-shadow: 0 15px 50px rgba(163, 167, 255, 0.4);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.easter-egg-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.easter-egg-toast .toast-star {
    font-size: 24px;
    animation: starPulse 1s ease-in-out infinite;
}

.easter-egg-toast .toast-text {
    font-size: 16px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

@keyframes starPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(15deg);
    }
}

/* ============================================================
   CONFETTI
   ============================================================ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================================
   TASK DECAY DEMO SECTION
   ============================================================ */
.decay-demo-section {
    padding: 120px 40px;
    background: transparent;
    /* matches page bg */
    position: relative;
    overflow: hidden;
}

.decay-demo-section .section-header {
    text-align: center;
    margin-bottom: 60px;
}

.decay-demo-section h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
}

.decay-demo-section .subtitle {
    font-size: 1.1rem;
    color: #86868B;
    max-width: 500px;
    margin: 0 auto;
}

.decay-demo {
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    background: rgba(28, 28, 30, 0.6);
    /* Glass card container */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    padding: 40px;
    backdrop-filter: blur(20px);
}

/* ============================================================
   DECAY TASK CARD
   ============================================================ */
.decay-task-card {
    width: 100%;
    padding: 20px 24px;
    background: #1a1a1e;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.decay-task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

/* Decay Stages */
.decay-task-card[data-decay="fresh"]::before {
    opacity: 0;
}

.decay-task-card[data-decay="mild"]::before {
    background: linear-gradient(135deg, rgba(156, 175, 136, 0.15) 0%, transparent 50%);
    opacity: 1;
}

.decay-task-card[data-decay="moderate"]::before {
    background: linear-gradient(135deg, rgba(107, 142, 78, 0.25) 0%, transparent 60%);
    opacity: 1;
}

.decay-task-card[data-decay="severe"]::before {
    background: linear-gradient(135deg, rgba(74, 107, 65, 0.35) 0%, rgba(61, 92, 53, 0.2) 50%, transparent 80%);
    opacity: 1;
}

.decay-task-card[data-decay="extreme"]::before {
    background: linear-gradient(135deg, rgba(61, 92, 53, 0.5) 0%, rgba(74, 107, 65, 0.3) 50%, transparent 90%);
    opacity: 1;
}

/* Decay Visual Effects */
.decay-task-card[data-decay="severe"]::after,
.decay-task-card[data-decay="extreme"]::after {
    content: '🕸️';
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 18px;
    opacity: 0.6;
    z-index: 1;
}

.decay-task-card[data-decay="extreme"]::after {
    content: '🕸️💀';
    opacity: 0.8;
}

.decay-task-card .task-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(163, 167, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.decay-task-card[data-decay="severe"] .task-icon,
.decay-task-card[data-decay="extreme"] .task-icon {
    filter: saturate(0.7);
}

.decay-task-card .task-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.decay-task-card .task-title {
    font-size: 16px;
    font-weight: 600;
    color: #f5f5f7;
    margin-bottom: 4px;
}

.decay-task-card .task-meta {
    font-size: 13px;
    color: #8e8e93;
    display: flex;
    align-items: center;
    gap: 8px;
}

.decay-task-card .decay-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-size: 12px;
}

.decay-task-card[data-decay="mild"] .decay-indicator {
    color: #9CAF88;
}

.decay-task-card[data-decay="moderate"] .decay-indicator {
    color: #6B8E4E;
}

.decay-task-card[data-decay="severe"] .decay-indicator {
    color: #FF9500;
}

.decay-task-card[data-decay="extreme"] .decay-indicator {
    color: #FF453A;
}

.decay-task-card .checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
}

.decay-task-card:hover .checkbox {
    border-color: #4ADE80;
    background: rgba(74, 222, 128, 0.1);
}

/* ============================================================
   BURN ANIMATION
   ============================================================ */
.decay-task-card.burning {
    animation: burnPulse 0.3s ease-out;
}

@keyframes burnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(74, 222, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.burn-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(74, 222, 128, 0.4) 0%, rgba(74, 222, 128, 0.2) 40%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: glowIn 0.3s ease-out;
}

@keyframes glowIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.burn-glow .checkmark {
    font-size: 48px;
    color: #4ADE80;
    font-weight: bold;
    animation: checkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes checkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================
   DECAY LABEL & CONTROLS
   ============================================================ */
.decay-label {
    font-size: 14px;
    color: #8e8e93;
    text-align: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
}

.decay-controls {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.decay-btn {
    padding: 14px 28px;
    border-radius: 99px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.decay-btn.progress {
    background: rgba(255, 255, 255, 0.08);

    color: #fff;
}

.decay-btn.progress:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.burn-task-btn {
    background: #30D158;
    color: black;
    border: none;
    box-shadow: 0 4px 20px rgba(48, 209, 88, 0.4);
}

.burn-task-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(48, 209, 88, 0.5);
    background: #32e660;
}

/* ============================================================
   INTERACTIVE PERSONALITY BADGES
   ============================================================ */
.personality-toggles .toggle-pill {
    position: relative;
    overflow: hidden;
}

.personality-toggles .toggle-pill::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.personality-toggles .toggle-pill:active::after {
    width: 200%;
    height: 200%;
}

/* Personality-specific colors when active */
.personality-toggles .toggle-pill.active[data-personality="sassy"] {
    background: #A78BFA;
}

.personality-toggles .toggle-pill.active[data-personality="calm"] {
    background: #38BDF8;
}

.personality-toggles .toggle-pill.active[data-personality="hype"] {
    background: #F97316;
}

.personality-toggles .toggle-pill.active[data-personality="friendly"] {
    background: #4ADE80;
}

.personality-toggles .toggle-pill.active[data-personality="pro"] {
    background: #64748B;
}

/* ============================================================
   TAP HINT FOR BART
   ============================================================ */
.live-bart {
    position: relative;
}

.live-bart::after {
    content: 'Tap me!';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #8e8e93;
    opacity: 0.7;
    animation: tapHintPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes tapHintPulse {

    0%,
    100% {
        opacity: 0.4;
        transform: translateX(-50%) translateY(0);
    }

    50% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Hide hint after first interaction */
.live-bart.interacted::after {
    display: none;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 768px) {
    .decay-demo-section {
        padding: 60px 20px;
    }

    .decay-task-card {
        padding: 16px 20px;
    }

    .bart-speech-bubble {
        max-width: 250px;
        padding: 12px 18px;
    }

    .bart-speech-bubble .speech-content {
        font-size: 14px;
    }

    .easter-egg-toast {
        padding: 12px 20px;
        font-size: 14px;
    }
}