/* ============================================
   SOPHI OS - Animações
   ============================================ */

/* ============================================
   BOOT ANIMATIONS
   ============================================ */

@keyframes bootLogoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bootProgress {
    0% {
        width: 0%;
    }
    60% {
        width: 80%;
    }
    100% {
        width: 100%;
    }
}

/* ============================================
   WINDOW ANIMATIONS
   ============================================ */

@keyframes windowOpen {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateX(0deg);
    }
}

@keyframes windowMinimize {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(calc(100vw - 100px), calc(100vh - 100px)) scale(0.1);
    }
}

@keyframes windowClose {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateX(-10deg);
    }
}

@keyframes windowMaximize {
    from {
        width: 600px;
        height: 400px;
        top: 50%;
        left: 50%;
    }
    to {
        width: calc(100vw - 40px);
        height: calc(100vh - 132px);
        top: 50%;
        left: 50%;
    }
}

/* ============================================
   DOCK ANIMATIONS
   ============================================ */

@keyframes dockItemHover {
    0% {
        transform: scale(1) translateY(0);
    }
    100% {
        transform: scale(1.2) translateY(-8px);
    }
}

@keyframes dockItemClick {
    0% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(0.95) translateY(2px);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

/* ============================================
   FADE ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   PULSE ANIMATIONS
   ============================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulseBg {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 122, 255, 0);
    }
}

/* ============================================
   ROTATE ANIMATIONS
   ============================================ */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   BOUNCE ANIMATIONS
   ============================================ */

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================
   CLASS ANIMATIONS
   ============================================ */

.animate-open {
    animation: windowOpen 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-close {
    animation: windowClose 0.3s ease-out forwards;
}

.animate-minimize {
    animation: windowMinimize 0.4s ease-in forwards;
}

.animate-maximize {
    animation: windowMaximize 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-dock-click {
    animation: dockItemClick 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-bounce-in {
    animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================
   TRANSITION GLOBAL
   ============================================ */

.smooth-transition {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   TRANSFORM UTILITIES
   ============================================ */

.scale-up {
    transform: scale(1.1);
}

.scale-down {
    transform: scale(0.95);
}

.translate-up {
    transform: translateY(-2px);
}

.translate-down {
    transform: translateY(2px);
}

/* ============================================
   MICRO INTERACTIONS
   ============================================ */

button, 
input[type="button"], 
input[type="submit"],
.clickable {
    position: relative;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

button:active:not(:disabled), 
input[type="button"]:active:not(:disabled), 
input[type="submit"]:active:not(:disabled),
.clickable:active {
    transform: scale(0.98);
}

/* ============================================
   STATUS BAR ANIMATIONS
   ============================================ */

@keyframes batteryLow {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.battery-low .battery-icon {
    animation: batteryLow 1s ease-in-out infinite;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

@keyframes loadingBar {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

.loading .window-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    animation: loadingBar 1.5s ease-in-out infinite;
}

/* ============================================
   FOCUS ANIMATIONS
   ============================================ */

@keyframes focusRing {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
    }
}

input:focus,
select:focus {
    animation: focusRing 0.3s ease-out;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

.window-content::-webkit-scrollbar {
    width: 8px;
}

.window-content::-webkit-scrollbar-track {
    background: transparent;
}

.window-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: background 0.2s;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .window-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .window-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ============================================
   MENU ANIMATIONS
   ============================================ */

@keyframes menuItemHover {
    from {
        opacity: 0.8;
    }
    to {
        opacity: 1;
    }
}

.menu-item {
    animation: menuItemHover 0.2s ease-out;
}

/* ============================================
   GLITCH ANIMATION (Optional - Premium)
   ============================================ */

@keyframes glitch {
    0% {
        clip-path: inset(40% 0 61% 0);
        transform: translate(-2px, -2px);
    }
    20% {
        clip-path: inset(92% 0 1% 0);
        transform: translate(2px, 2px);
    }
    40% {
        clip-path: inset(43% 0 1% 0);
        transform: translate(-2px, 2px);
    }
    60% {
        clip-path: inset(25% 0 58% 0);
        transform: translate(2px, -2px);
    }
    80% {
        clip-path: inset(54% 0 7% 0);
        transform: translate(-2px, -2px);
    }
    100% {
        clip-path: inset(58% 0 43% 0);
        transform: translate(2px, 2px);
    }
}

.glitch {
    animation: glitch 0.3s ease-in-out;
}

/* ============================================
   PARALLAX ANIMATION
   ============================================ */

@keyframes parallax {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 40px 40px;
    }
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */

.stagger-item {
    animation: slideInFromLeft 0.4s ease-out;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   MEDIA QUERIES PARA ANIMAÇÕES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    @keyframes windowOpen {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
    
    .dock-item:hover {
        transform: scale(1.1) translateY(-4px);
    }
}
