/* ============================================
   ALPHA FINANS DATA - Global Animations & Effects
   Tüm sayfalar için geçerli animasyonlar
   ============================================ */

/* =============================================
   KEYFRAME DEFINITIONS
   ============================================= */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@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 fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

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

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

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

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

@keyframes popIn {
    0%   { transform: scale(0.8); opacity: 0; }
    70%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

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

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

@keyframes pulseScale {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.02); }
}

@keyframes shimmerSweep {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(18, 149, 235, 0.2); }
    50%      { box-shadow: 0 0 20px rgba(18, 149, 235, 0.35); }
}

@keyframes borderFlow {
    0%   { border-color: var(--color-border-primary); }
    50%  { border-color: var(--color-accent-primary); }
    100% { border-color: var(--color-border-primary); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes countFlip {
    0%   { transform: translateY(0); opacity: 1; }
    50%  { transform: translateY(-10px); opacity: 0; }
    51%  { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes skeletonShimmer {
    0%   { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

@keyframes rippleEffect {
    to { transform: scale(4); opacity: 0; }
}

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

@keyframes tickerTape {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}


/* =============================================
   UTILITY ANIMATION CLASSES
   ============================================= */

.anim-fade-in          { animation: fadeIn 0.4s ease-out; }
.anim-fade-in-up       { animation: fadeInUp 0.5s ease-out; }
.anim-fade-in-down     { animation: fadeInDown 0.5s ease-out; }
.anim-fade-in-left     { animation: fadeInLeft 0.5s ease-out; }
.anim-fade-in-right    { animation: fadeInRight 0.5s ease-out; }
.anim-fade-in-scale    { animation: fadeInScale 0.4s ease-out; }
.anim-slide-up         { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.anim-scale-in         { animation: scaleIn 0.3s ease-out; }
.anim-pop-in           { animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.anim-bounce-in        { animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.anim-pulse            { animation: pulse 2s ease-in-out infinite; }
.anim-pulse-scale      { animation: pulseScale 2s ease-in-out infinite; }
.anim-glow             { animation: glowPulse 2s ease-in-out infinite; }
.anim-spin             { animation: spin 1s linear infinite; }
.anim-float            { animation: float 3s ease-in-out infinite; }

/* Delay modifiers */
.anim-delay-1 { animation-delay: 0.1s; animation-fill-mode: backwards; }
.anim-delay-2 { animation-delay: 0.2s; animation-fill-mode: backwards; }
.anim-delay-3 { animation-delay: 0.3s; animation-fill-mode: backwards; }
.anim-delay-4 { animation-delay: 0.4s; animation-fill-mode: backwards; }
.anim-delay-5 { animation-delay: 0.5s; animation-fill-mode: backwards; }


/* =============================================
   PAGE CONTENT - Entry Animations
   ============================================= */

/* Main content area fades in */
.app-content {
    animation: fadeIn 0.3s ease-out;
}

/* Page headers slide down */
.page-header,
.page-title {
    animation: fadeInDown 0.4s ease-out;
}

/* Section cards stagger in */
.section-card,
.data-card,
.info-card,
.stat-card {
    animation: fadeInUp 0.4s ease-out backwards;
}


/* =============================================
   CARD HOVER EFFECTS - Global
   ============================================= */

/* Standard hover lift for all card-like elements */
.data-card,
.info-card,
.stat-card,
.news-card,
.stock-card,
.asset-card,
.notification-card,
.watchlist-card,
.market-card {
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.data-card:hover,
.info-card:hover,
.stat-card:hover,
.news-card:hover,
.stock-card:hover,
.asset-card:hover,
.notification-card:hover,
.watchlist-card:hover,
.market-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--color-accent-glow);
}


/* =============================================
   BUTTON EFFECTS - Global
   ============================================= */

/* All interactive buttons get micro-interactions */
button,
.btn,
[class*="btn-"] {
    transition:
        transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.2s ease,
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        filter 0.2s ease;
}

button:active,
.btn:active,
[class*="btn-"]:active {
    transform: scale(0.96);
    transition-duration: 0.08s;
}

/* Primary buttons get glow on hover */
.btn-primary:hover,
.btn-accent:hover,
[class*="btn-primary"]:hover {
    box-shadow: 0 4px 15px rgba(18, 149, 235, 0.35);
    filter: brightness(1.05);
}


/* =============================================
   INPUT FOCUS EFFECTS - Global
   ============================================= */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 3px var(--color-accent-glow);
    border-color: var(--color-accent-primary);
}


/* =============================================
   TABLE ROW HOVER - Global
   ============================================= */

table tbody tr {
    transition: background 0.15s ease;
}

table tbody tr:hover {
    background: var(--color-hover-subtle);
}


/* =============================================
   SKELETON / LOADING STATES
   ============================================= */

.skeleton,
.shimmer {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 25%,
        var(--color-bg-elevated) 37%,
        var(--color-bg-card) 63%
    );
    background-size: 400px 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
}

.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 80px;
    border-radius: var(--radius-md);
}


/* =============================================
   LOADING SPINNER
   ============================================= */

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border-secondary);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}


/* =============================================
   TAB TRANSITIONS
   ============================================= */

.tab-content {
    animation: fadeIn 0.3s ease-out;
}

.tab-panel[hidden] {
    display: none;
}

.tab-panel:not([hidden]) {
    animation: fadeInUp 0.3s ease-out;
}


/* =============================================
   MODAL / OVERLAY TRANSITIONS
   ============================================= */

.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}


/* =============================================
   TOAST / NOTIFICATION POPUP
   ============================================= */

.toast,
.notification-toast,
.alert-toast {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}


/* =============================================
   NUMBER / PRICE CHANGE FLASH
   ============================================= */

.price-flash-up {
    animation: countFlip 0.3s ease-out;
    color: var(--color-market-up);
}

.price-flash-down {
    animation: countFlip 0.3s ease-out;
    color: var(--color-market-down);
}


/* =============================================
   CHART / DATA VIZ ENTRY
   ============================================= */

canvas,
.chart-container,
.chart-wrapper {
    animation: fadeInScale 0.5s ease-out;
}


/* =============================================
   LIST ITEM STAGGER (JS helper)
   ============================================= */

[data-stagger] > * {
    animation: fadeInUp 0.35s ease-out backwards;
}

[data-stagger] > *:nth-child(1)  { animation-delay: 0.03s; }
[data-stagger] > *:nth-child(2)  { animation-delay: 0.06s; }
[data-stagger] > *:nth-child(3)  { animation-delay: 0.09s; }
[data-stagger] > *:nth-child(4)  { animation-delay: 0.12s; }
[data-stagger] > *:nth-child(5)  { animation-delay: 0.15s; }
[data-stagger] > *:nth-child(6)  { animation-delay: 0.18s; }
[data-stagger] > *:nth-child(7)  { animation-delay: 0.21s; }
[data-stagger] > *:nth-child(8)  { animation-delay: 0.24s; }
[data-stagger] > *:nth-child(9)  { animation-delay: 0.27s; }
[data-stagger] > *:nth-child(10) { animation-delay: 0.30s; }
[data-stagger] > *:nth-child(n+11) { animation-delay: 0.33s; }


/* =============================================
   SCROLL-TRIGGERED ANIMATIONS (IntersectionObserver)
   Add .anim-on-scroll to elements, JS adds .anim-visible
   ============================================= */

.anim-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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


/* =============================================
   TOOLTIP ANIMATION
   ============================================= */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    font-size: var(--font-size-xs);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    border: 1px solid var(--color-border-primary);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* =============================================
   BADGE PULSE (notification count etc.)
   ============================================= */

.badge-pulse {
    position: relative;
}

.badge-pulse::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}


/* =============================================
   PROGRESS BAR ANIMATION
   ============================================= */

.progress-bar-animated {
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: shimmerSweep 1s linear infinite;
}


/* =============================================
   LINK UNDERLINE ANIMATION
   ============================================= */

.link-animated {
    position: relative;
    display: inline-block;
}

.link-animated::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: var(--color-accent-primary);
    transition: width 0.3s ease;
}

.link-animated:hover::after {
    width: 100%;
}


/* =============================================
   ACCESSIBILITY - Reduced Motion
   ============================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .skeleton,
    .shimmer {
        animation: none;
        background: var(--color-bg-elevated);
    }
}
