/* ============================================
   ADVANCED ANIMATIONS & MICRO-INTERACTIONS
   Renegade Notes - Premium UI Enhancement
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES FOR ANIMATIONS
   ============================================ */
:root {
    --animation-fast: 0.15s;
    --animation-normal: 0.3s;
    --animation-slow: 0.5s;
    --animation-very-slow: 0.8s;
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-elegant: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ============================================
   FADE IN ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   PULSE & GLOW ANIMATIONS
   ============================================ */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px var(--accent),
            0 0 10px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 20px var(--accent),
            0 0 40px var(--accent-glow),
            0 0 60px var(--accent-glow);
    }
}

@keyframes borderGlow {

    0%,
    100% {
        border-color: var(--accent);
    }

    50% {
        border-color: var(--accent-hover);
    }
}

@keyframes textGlow {

    0%,
    100% {
        text-shadow: 0 0 10px var(--accent-glow);
    }

    50% {
        text-shadow: 0 0 30px var(--accent), 0 0 50px var(--accent-glow);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* ============================================
   BOUNCE & ELASTIC ANIMATIONS
   ============================================ */
@keyframes bounce {

    0%,
    20%,
    53%,
    80%,
    100% {
        transform: translateY(0);
    }

    40%,
    43% {
        transform: translateY(-15px);
    }

    70% {
        transform: translateY(-7px);
    }

    90% {
        transform: translateY(-3px);
    }
}

@keyframes rubberBand {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scaleX(1.25) scaleY(0.75);
    }

    40% {
        transform: scaleX(0.75) scaleY(1.25);
    }

    50% {
        transform: scaleX(1.15) scaleY(0.85);
    }

    65% {
        transform: scaleX(0.95) scaleY(1.05);
    }

    75% {
        transform: scaleX(1.05) scaleY(0.95);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes jello {

    0%,
    11.1%,
    100% {
        transform: none;
    }

    22.2% {
        transform: skewX(-12.5deg) skewY(-12.5deg);
    }

    33.3% {
        transform: skewX(6.25deg) skewY(6.25deg);
    }

    44.4% {
        transform: skewX(-3.125deg) skewY(-3.125deg);
    }

    55.5% {
        transform: skewX(1.5625deg) skewY(1.5625deg);
    }

    66.6% {
        transform: skewX(-0.78125deg) skewY(-0.78125deg);
    }

    77.7% {
        transform: skewX(0.390625deg) skewY(0.390625deg);
    }

    88.8% {
        transform: skewX(-0.1953125deg) skewY(-0.1953125deg);
    }
}

/* ============================================
   ROTATE & SPIN ANIMATIONS
   ============================================ */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes spinReverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(5deg);
    }
}

/* ============================================
   FLOAT & DRIFT ANIMATIONS
   ============================================ */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatSlow {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(1deg);
    }

    50% {
        transform: translateY(-8px) rotate(0deg);
    }

    75% {
        transform: translateY(-5px) rotate(-1deg);
    }
}

@keyframes drift {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(5px, -5px);
    }

    50% {
        transform: translate(0, -8px);
    }

    75% {
        transform: translate(-5px, -5px);
    }
}

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   CARD ANIMATIONS
   ============================================ */
.item-card {
    animation: fadeInUp 0.4s var(--ease-smooth) forwards;
    opacity: 0;
    transition: all var(--animation-normal) var(--ease-smooth);
}

/* Staggered card entrance */
.items-grid .item-card:nth-child(1) {
    animation-delay: 0.05s;
}

.items-grid .item-card:nth-child(2) {
    animation-delay: 0.1s;
}

.items-grid .item-card:nth-child(3) {
    animation-delay: 0.15s;
}

.items-grid .item-card:nth-child(4) {
    animation-delay: 0.2s;
}

.items-grid .item-card:nth-child(5) {
    animation-delay: 0.25s;
}

.items-grid .item-card:nth-child(6) {
    animation-delay: 0.3s;
}

.items-grid .item-card:nth-child(7) {
    animation-delay: 0.35s;
}

.items-grid .item-card:nth-child(8) {
    animation-delay: 0.4s;
}

.items-grid .item-card:nth-child(9) {
    animation-delay: 0.45s;
}

.items-grid .item-card:nth-child(10) {
    animation-delay: 0.5s;
}

.item-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px var(--accent-glow);
}

.item-card:active {
    transform: translateY(-4px) scale(0.98);
    transition-duration: 0.1s;
}

/* Card image shine effect on hover */
.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.1),
            transparent);
    transition: left 0.5s ease;
    z-index: 1;
    pointer-events: none;
}

.item-card:hover::before {
    left: 150%;
}

/* Pinned card special animation */
.item-card.pinned {
    animation: fadeInUp 0.4s var(--ease-smooth) forwards,
        borderGlow 2s ease-in-out infinite;
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */
button,
.btn-primary,
.btn-secondary,
.btn-danger,
.quick-btn,
.add-btn {
    position: relative;
    overflow: hidden;
    transition: all var(--animation-normal) var(--ease-smooth);
}

button:hover,
.quick-btn:hover,
.add-btn:hover {
    transform: translateY(-2px);
}

button:active,
.quick-btn:active,
.add-btn:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.1s;
}

/* Ripple effect on click */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s, opacity 0.5s;
    pointer-events: none;
}

button:active::after {
    transform: translate(-50%, -50%) scale(40);
    opacity: 0;
}

/* Primary button glow */
.btn-primary {
    animation: none;
}

.btn-primary:hover {
    box-shadow: 0 0 20px var(--accent-glow),
        0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Quick Add Button Hover Effects */
.quick-btn {
    position: relative;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 1px solid var(--border);
}

.quick-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: -1;
    pointer-events: none;
}

.quick-btn:hover::before {
    opacity: 1;
}

.quick-btn:hover {
    color: white;
    border-color: var(--accent);
    box-shadow: 0 5px 25px var(--accent-glow);
}

/* ============================================
   NAVIGATION ANIMATIONS
   ============================================ */
.nav-item {
    position: relative;
    transition: all var(--animation-normal) var(--ease-smooth);
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--accent);
    border-radius: 2px;
    transition: height var(--animation-normal) var(--ease-bounce);
    box-shadow: 0 0 10px var(--accent);
    pointer-events: none;
}

.nav-item:hover::before,
.nav-item.active::before {
    height: 60%;
}

.nav-item .nav-icon {
    transition: transform var(--animation-normal) var(--ease-bounce);
}

.nav-item:hover .nav-icon {
    transform: scale(1.2);
}

.nav-item.active .nav-icon {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */
.modal {
    transition: opacity var(--animation-normal) var(--ease-smooth);
}

.modal:not(.hidden) {
    animation: fadeIn 0.3s var(--ease-smooth);
}

.modal-content {
    animation: fadeInScale 0.4s var(--ease-spring);
}

.modal-backdrop {
    animation: fadeIn 0.3s var(--ease-smooth);
}

/* HUD Frame entrance */
.character-hud-frame {
    animation: fadeInUp 0.5s var(--ease-spring);
}

/* ============================================
   STATS ANIMATIONS
   ============================================ */
.stat-card {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 20px var(--accent-glow);
    border-color: var(--accent);
}

.stat-number {
    transition: all var(--animation-normal) var(--ease-bounce);
}

.stat-card:hover .stat-number {
    transform: scale(1.1);
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

/* Stats counting animation on load */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: fadeInUp 0.5s var(--ease-smooth) forwards;
    opacity: 0;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* ============================================
   SIDEBAR ANIMATIONS
   ============================================ */
.sidebar {
    animation: slideInFromLeft 0.5s var(--ease-smooth);
}

.sidebar-logo-img {
    animation: floatSlow 4s ease-in-out infinite;
}

/* ============================================
   RIGHT PANEL ANIMATIONS
   ============================================ */
.right-panel {
    animation: slideInFromRight 0.5s var(--ease-smooth);
}

.calendar-widget,
.time-widget,
.user-widget,
.youtube-player-widget {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.calendar-widget:hover,
.time-widget:hover,
.user-widget:hover,
.youtube-player-widget:hover {
    transform: translateX(-5px);
    box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.3);
}

/* Calendar day hover */
.calendar-day {
    transition: all var(--animation-fast) var(--ease-smooth);
}

.calendar-day:hover:not(.empty) {
    background: var(--accent-glow);
    color: white;
    transform: scale(1.2);
    border-radius: 50%;
}

.calendar-day.today {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   TIME WIDGET ANIMATION
   ============================================ */
.time-display {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

/* ============================================
   SEARCH BOX ANIMATIONS
   ============================================ */
.search-box {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.search-input:focus+.search-icon,
.search-input:focus {
    transform: scale(1.02);
}

.search-input::placeholder {
    transition: opacity var(--animation-normal);
}

.search-input:focus::placeholder {
    opacity: 0.5;
}

/* ============================================
   FORM INPUT ANIMATIONS
   ============================================ */
.form-group input,
.form-group textarea {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.form-group input:focus,
.form-group textarea:focus {
    transform: scale(1.01);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* File upload area animations */
.file-upload-area {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: rgba(255, 51, 51, 0.05);
    transform: scale(1.02);
}

.file-upload-area.dragover {
    animation: pulse 1s ease-in-out infinite;
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* ============================================
   TAG ANIMATIONS
   ============================================ */
.tag {
    transition: all var(--animation-fast) var(--ease-smooth);
}

.tag:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ============================================
   PIN BADGE ANIMATION
   ============================================ */
.pin-badge {
    animation: float 3s ease-in-out infinite;
}

/* ============================================
   YOUTUBE PLAYER ANIMATIONS
   ============================================ */
.youtube-player-container {
    transition: all var(--animation-normal) var(--ease-smooth);
}

.youtube-player-container.active {
    animation: fadeInUp 0.5s var(--ease-smooth);
}

.youtube-load-btn {
    transition: all var(--animation-fast) var(--ease-bounce);
}

.youtube-load-btn:hover {
    transform: scale(1.15) rotate(5deg);
}

.youtube-load-btn:active {
    transform: scale(0.95);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
@keyframes spinnerRotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes spinnerDash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -35px;
    }

    100% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -124px;
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    animation: spinnerRotate 2s linear infinite;
}

.loading-spinner circle {
    stroke: var(--accent);
    stroke-linecap: round;
    animation: spinnerDash 1.5s ease-in-out infinite;
}

/* ============================================
   THEME TOGGLE ANIMATION
   ============================================ */
.theme-toggle svg {
    transition: transform var(--animation-normal) var(--ease-spring);
}

.theme-toggle:hover svg {
    transform: rotate(180deg);
}

body.light-theme .theme-toggle svg {
    animation: spin 0.5s var(--ease-spring);
}

/* ============================================
   WELCOME SECTION ANIMATIONS
   ============================================ */
.welcome-card {
    animation: fadeInLeft 0.6s var(--ease-smooth) forwards;
    opacity: 0;
}

.welcome-card h1 {
    background: linear-gradient(90deg, var(--accent), #ff6666, var(--accent));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

.date-card {
    animation: fadeInRight 0.6s var(--ease-smooth) forwards;
    opacity: 0;
    animation-delay: 0.2s;
    transition: transform var(--animation-normal) var(--ease-smooth);
}

.date-card:hover {
    transform: scale(1.05);
}

.date-day {
    animation: fadeInScale 0.5s var(--ease-spring) forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

/* ============================================
   SCROLLBAR ANIMATIONS
   ============================================ */
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ============================================
   VIEW TRANSITIONS
   ============================================ */
.view {
    transition: opacity var(--animation-normal) var(--ease-smooth);
}

.view.active {
    animation: fadeIn 0.4s var(--ease-smooth);
}

.view-header {
    animation: fadeInDown 0.4s var(--ease-smooth);
}

.view-header h1 {
    position: relative;
    display: inline-block;
}

.view-header h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s var(--ease-smooth);
    box-shadow: 0 0 10px var(--accent-glow);
}

.view.active .view-header h1::after {
    width: 100%;
}

/* ============================================
   RECENT ACTIVITY ANIMATIONS
   ============================================ */
.recent-item {
    animation: fadeInLeft 0.4s var(--ease-smooth) forwards;
    opacity: 0;
    transition: all var(--animation-normal) var(--ease-smooth);
}

.recent-item:nth-child(1) {
    animation-delay: 0.1s;
}

.recent-item:nth-child(2) {
    animation-delay: 0.2s;
}

.recent-item:nth-child(3) {
    animation-delay: 0.3s;
}

.recent-item:nth-child(4) {
    animation-delay: 0.4s;
}

.recent-item:nth-child(5) {
    animation-delay: 0.5s;
}

.recent-item:hover {
    transform: translateX(10px);
    background: rgba(255, 51, 51, 0.1);
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
}

/* ============================================
   FULL VIEW MODAL ANIMATIONS
   ============================================ */
.full-view-modal.active {
    animation: fadeIn 0.3s var(--ease-smooth);
}

.full-view-modal.active .full-view-content {
    animation: fadeInUp 0.5s var(--ease-spring);
}

.full-view-image {
    transition: transform var(--animation-normal) var(--ease-smooth);
}

.full-view-image:hover {
    transform: scale(1.02);
}

/* ============================================
   LOGOUT BUTTON SPECIAL ANIMATION
   ============================================ */
.logout-btn:hover {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}

.logout-btn:hover svg {
    animation: slideInFromRight 0.3s var(--ease-smooth);
}

/* ============================================
   PARTICLE BACKGROUND EFFECT
   ============================================ */
@keyframes particleFloat {

    0%,
    100% {
        transform: translate(0, 0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--particle-x, 20px), var(--particle-y, -100px));
        opacity: 0;
    }
}

/* ============================================
   GLASS MORPHISM EFFECTS
   ============================================ */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}