/* حاسبة الموارد البشرية - الحركات والتأثيرات */

/* Base Animation Variables */
:root {
    --animation-duration: 0.3s;
    --animation-timing: ease-in-out;
    --bounce-timing: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --slide-timing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Loading Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Gradient Animation */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Typing Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCursor {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: var(--primary-color);
    }
}

/* Count Up Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Progress Bar Fill */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

/* Slide and Fade */
@keyframes slideAndFade {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-in-up {
    animation: slideInUp var(--animation-duration) var(--animation-timing) forwards;
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-duration) var(--animation-timing) forwards;
}

.animate-zoom-in {
    animation: zoomIn var(--animation-duration) var(--animation-timing) forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.6s var(--bounce-timing) forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-gradient {
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), var(--primary-color), var(--secondary-color));
    background-size: 400% 400%;
    animation: gradientMove 4s ease infinite;
}

/* Delay Classes */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-400 {
    animation-delay: 0.4s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

.animate-delay-600 {
    animation-delay: 0.6s;
}

.animate-delay-700 {
    animation-delay: 0.7s;
}

.animate-delay-800 {
    animation-delay: 0.8s;
}

.animate-delay-900 {
    animation-delay: 0.9s;
}

.animate-delay-1000 {
    animation-delay: 1s;
}

/* Hover Animations */
.hover-lift {
    transition: transform var(--animation-duration) var(--animation-timing);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform var(--animation-duration) var(--animation-timing);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--animation-duration) var(--animation-timing);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow var(--animation-duration) var(--animation-timing);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(30, 58, 138, 0.4);
}

.hover-bounce {
    transition: transform var(--animation-duration) var(--bounce-timing);
}

.hover-bounce:hover {
    transform: scale(1.1);
}

/* Focus Animations */
.focus-ring {
    transition: box-shadow var(--animation-duration) var(--animation-timing);
}

.focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.3);
}

.focus-scale {
    transition: transform var(--animation-duration) var(--animation-timing);
}

.focus-scale:focus {
    transform: scale(1.02);
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 0.5rem;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: pulse 1.5s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.loading-bars {
    display: flex;
    gap: 0.25rem;
    align-items: flex-end;
}

.loading-bar {
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    animation: loadingBars 1s infinite;
}

.loading-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.loading-bar:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes loadingBars {
    0%, 100% {
        height: 20px;
    }
    50% {
        height: 40px;
    }
}

/* Progress Bar Animations */
.progress-bar {
    overflow: hidden;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Number Counter Animation */
.counter {
    font-weight: bold;
    font-size: 2rem;
    color: var(--primary-color);
}

.counter.animate {
    animation: countUp 0.5s var(--animation-timing) forwards;
}

/* Stagger Animation */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn var(--animation-duration) var(--animation-timing) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

/* Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s var(--animation-timing);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-left: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blinkCursor 0.75s step-end infinite;
}

/* Particle Effect */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: particleFloat 6s infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(50px) rotate(360deg);
        opacity: 0;
    }
}

/* Ripple Button Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Slide Show Animation */
.slide-show {
    position: relative;
    overflow: hidden;
}

.slide-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.slide-item.active {
    opacity: 1;
}

/* Accordion Animation */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-content.expanded {
    max-height: 500px;
}

/* Tab Animation */
.tab-content {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.tab-content.active {
    opacity: 1;
    transform: translateX(0);
}

/* Notification Animation */
.notification {
    transform: translateX(100%);
    transition: transform 0.3s var(--slide-timing);
}

.notification.show {
    transform: translateX(0);
}

/* Card Flip Animation */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* Scroll Animation */
.scroll-fade {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Success Animation */
.success-checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--success-color);
    position: relative;
    animation: successPulse 0.5s ease-in-out;
}

.success-checkmark::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 8px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes successPulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Error Animation */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-pulse,
    .animate-rotate,
    .animate-float,
    .animate-gradient,
    .loading-spinner,
    .loading-dots,
    .loading-bars,
    .progress-bar::before,
    .particle,
    .typewriter {
        animation: none !important;
    }
}