/* FinControl iOS Advanced Animations */

/* Page Transitions */
@keyframes pageEnterFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pageExitToLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Tab Bar Animations */
.ios-tab-item {
    animation: fadeInUp 0.4s ease;
}

.ios-tab-item:nth-child(1) {
    animation-delay: 0.05s;
}

.ios-tab-item:nth-child(2) {
    animation-delay: 0.1s;
}

.ios-tab-item:nth-child(3) {
    animation-delay: 0.15s;
}

.ios-tab-item:nth-child(4) {
    animation-delay: 0.2s;
}

.ios-tab-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* Card Animations */
.ios-card {
    animation: scaleIn 0.3s ease;
}

.ios-card:nth-child(1) {
    animation-delay: 0s;
}

.ios-card:nth-child(2) {
    animation-delay: 0.05s;
}

.ios-card:nth-child(3) {
    animation-delay: 0.1s;
}

.ios-card:nth-child(4) {
    animation-delay: 0.15s;
}

/* Button Animations */
.ios-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-btn:active {
    transform: scale(0.98);
}

.ios-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ios-btn:active::before {
    animation: ripple 0.6s ease;
}

@keyframes ripple {
    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* List Item Animations */
.ios-list-item {
    animation: fadeInUp 0.3s ease;
}

.ios-list-item:nth-child(1) {
    animation-delay: 0.05s;
}

.ios-list-item:nth-child(2) {
    animation-delay: 0.1s;
}

.ios-list-item:nth-child(3) {
    animation-delay: 0.15s;
}

.ios-list-item:nth-child(4) {
    animation-delay: 0.2s;
}

/* KPI Card Animations */
.ios-kpi-card {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-kpi-card:nth-child(1) {
    animation-delay: 0s;
}

.ios-kpi-card:nth-child(2) {
    animation-delay: 0.1s;
}

.ios-kpi-card:nth-child(3) {
    animation-delay: 0.2s;
}

.ios-kpi-card:nth-child(4) {
    animation-delay: 0.3s;
}

/* Progress Bar Animation */
.ios-progress-fill,
.ios-meta-fill {
    animation: fillProgress 1s ease;
}

@keyframes fillProgress {
    from {
        width: 0 !important;
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Badge Animations */
.ios-badge {
    animation: scaleIn 0.3s ease;
}

/* Loading Skeleton */
.ios-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Bounce Animation */
.ios-bounce {
    animation: bounce 1s infinite;
}

/* Pulse Animation */
.ios-pulse {
    animation: pulse 2s infinite;
}

/* Form Focus Animation */
.ios-form-input:focus,
.ios-form-textarea:focus,
.ios-form-select:focus {
    animation: focusRing 0.3s ease;
}

@keyframes focusRing {
    from {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.5);
    }
    to {
        box-shadow: 0 0 0 8px rgba(0, 122, 255, 0);
    }
}

/* Success Animation */
@keyframes successCheck {
    0% {
        stroke-dashoffset: 66;
    }
    65% {
        stroke-dashoffset: -4;
    }
    100% {
        stroke-dashoffset: 62;
    }
}

/* Error Animation */
@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* Tooltip Animation */
@keyframes tooltipAppear {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth Transitions */
.ios-smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger Animation */
.ios-stagger > * {
    animation: fadeInUp 0.3s ease;
}

.ios-stagger > *:nth-child(1) {
    animation-delay: 0s;
}

.ios-stagger > *:nth-child(2) {
    animation-delay: 0.05s;
}

.ios-stagger > *:nth-child(3) {
    animation-delay: 0.1s;
}

.ios-stagger > *:nth-child(4) {
    animation-delay: 0.15s;
}

.ios-stagger > *:nth-child(5) {
    animation-delay: 0.2s;
}

.ios-stagger > *:nth-child(6) {
    animation-delay: 0.25s;
}

/* Long Press Animation */
.ios-long-press-target {
    transition: all 0.2s ease;
}

.ios-long-press-target:active {
    transform: scale(0.96);
    opacity: 0.7;
}

/* Swipe Action Animation */
@keyframes swipeDelete {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Modal Bottom Sheet Animation */
.ios-modal-content {
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tab Indicator Animation */
.ios-tab-indicator {
    animation: slideHorizontal 0.3s ease;
}

@keyframes slideHorizontal {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Parallax Scroll */
.ios-parallax {
    background-attachment: fixed;
}

/* Spring Animation */
@keyframes spring {
    0% {
        transform: scaleY(0.95);
    }
    50% {
        transform: scaleY(1.05);
    }
    100% {
        transform: scaleY(1);
    }
}

.ios-spring {
    animation: spring 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Fade and Scale */
@keyframes fadeAndScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ios-rotate {
    animation: rotate 2s linear infinite;
}

/* Theme Toggle Animation */
@keyframes themeToggleRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Disable animations in reduced-motion mode */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
