/**
 * Central Hub Theme Animations
 * Tile hover effects, Doraemon starfield, sleeping Doraemon, decorations.
 */

/* ===== TILE HOVER SHIMMER ===== */
.tile-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.04),
        transparent
    );
    transition: left 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.tile-container:hover::after {
    left: 100%;
}

/* ===== DORAEMON NIGHT STARFIELD ===== */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Shooting star */
@keyframes shootingStar {
    0% {
        transform: translateX(0) translateY(0) rotate(-35deg);
        opacity: 0;
        width: 0;
    }
    5% {
        opacity: 1;
        width: 80px;
    }
    30% {
        opacity: 0.8;
        width: 120px;
    }
    100% {
        transform: translateX(400px) translateY(250px) rotate(-35deg);
        opacity: 0;
        width: 0;
    }
}

.starfield-shooting {
    position: absolute;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(255,248,225,0.9), transparent);
    border-radius: 2px;
    pointer-events: none;
    opacity: 0;
    animation: shootingStar 4s ease-out infinite;
}

/* Clouds */
.starfield-clouds {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.starfield-cloud {
    position: absolute;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0;
}

@keyframes cloudDrift {
    0% {
        transform: translateX(-10%) translateY(0);
        opacity: 0;
    }
    10% {
        opacity: var(--cloud-opacity, 0.06);
    }
    90% {
        opacity: var(--cloud-opacity, 0.06);
    }
    100% {
        transform: translateX(10%) translateY(-2%);
        opacity: 0;
    }
}

@keyframes cloudDriftReverse {
    0% {
        transform: translateX(10%) translateY(0);
        opacity: 0;
    }
    10% {
        opacity: var(--cloud-opacity, 0.06);
    }
    90% {
        opacity: var(--cloud-opacity, 0.06);
    }
    100% {
        transform: translateX(-10%) translateY(-1%);
        opacity: 0;
    }
}

/* ===== SLEEPING DORAEMON ===== */
.sleeping-doraemon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 160px;
    height: 160px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

/* Z's floating animation */
@keyframes floatZ {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) scale(1.1);
        opacity: 0.4;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
}

.sleeping-doraemon .zzz {
    animation: floatZ 3s ease-in-out infinite;
}

.sleeping-doraemon .zzz-small {
    animation: floatZ 3s ease-in-out infinite 0.5s;
}

/* ===== DORAEMON ICON WIGGLE ON HOVER ===== */
[data-theme="doraemon-day"] .tile-container:hover .tile-icon,
[data-theme="doraemon-night"] .tile-container:hover .tile-icon {
    animation: doraemonWiggle 0.5s ease;
}

@keyframes doraemonWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* ===== PING ANIMATION FOR STATUS DOTS ===== */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.status-dot-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ===== CANDY BADGE GLOW (Doraemon Night) ===== */
[data-theme="doraemon-night"] .candy-locked {
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

[data-theme="doraemon-night"] .candy-draft {
    box-shadow: 0 0 10px rgba(30, 144, 255, 0.3);
}

[data-theme="doraemon-night"] .candy-overdue {
    box-shadow: 0 0 10px rgba(229, 57, 53, 0.3);
}

/* ===== SMOOTH THEME TRANSITIONS ===== */
.tile-container,
.hub-header,
.hub-context-bar,
.section-line,
.tile-accent {
    transition-property: background-color, border-color, color, box-shadow, transform;
    transition-duration: 300ms;
    transition-timing-function: ease;
}

/* Override transition for active press (faster) */
.tile-container:active {
    transition-duration: 50ms;
}

/* ===== DORAEMON DAY/NIGHT WATERMARK SVG ANIMATION ===== */
@keyframes gentleBob {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.02); }
}

.doraemon-watermark svg {
    animation: gentleBob 8s ease-in-out infinite;
}
