/**
 * Smart Interactions Styles - Premium UI Effects
 */

/* Ripple Effect */
.btn, .card, .list-group-item {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    transition: all 0.3s ease;
}

.btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-loading-text {
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Progress Bar */
.smart-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d6efd, #0dcaf0, #20c997);
    width: 0%;
    z-index: 9999;
    transition: width 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.8);
}

.smart-progress-bar.loading {
    opacity: 1;
}

/* Form Loading Overlay */
.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.form-loading-overlay.show {
    opacity: 1;
}

.form-loading-content {
    text-align: center;
    animation: fade-in-up 0.4s ease;
}

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

/* Link Loading State */
.link-loading {
    opacity: 0.7;
    pointer-events: none;
}

.link-loading-indicator {
    display: inline-block;
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
}

.smart-toast {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: all;
    border-left: 4px solid;
}

@media (max-width: 768px) {
    .smart-toast {
        min-width: auto;
        width: 100%;
    }
}

.smart-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.smart-toast-success {
    border-left-color: #198754;
    color: #198754;
}

.smart-toast-error {
    border-left-color: #dc3545;
    color: #dc3545;
}

.smart-toast-warning {
    border-left-color: #ffc107;
    color: #856404;
}

.smart-toast-info {
    border-left-color: #0dcaf0;
    color: #055160;
}

.smart-toast i {
    font-size: 1.2rem;
}

/* Skeleton Loading */
.skeleton-loading {
    pointer-events: none;
}

.skeleton-box {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Pull to Refresh */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(13, 110, 253, 0.1), transparent);
    z-index: 9997;
    transition: transform 0.3s ease;
}

.pull-refresh-content {
    text-align: center;
    color: #0d6efd;
    font-size: 14px;
}

.pull-refresh-content i {
    display: block;
    font-size: 24px;
    margin-bottom: 5px;
    animation: bounce-arrow 1s ease-in-out infinite;
}

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

.pull-to-refresh.refreshing .pull-refresh-content i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Enhanced Button Hover Effects */
.btn {
    transition: all 0.2s ease;
    transform: translateZ(0);
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card Hover Enhancement */
.card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Loading Dots Animation */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Shimmer Effect for Images */
.img-loading {
    position: relative;
    overflow: hidden;
    background: #f6f7f8;
}

.img-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9996;
    display: none;
    animation: slide-up 0.3s ease;
}

@keyframes slide-up {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

body.offline .offline-indicator {
    display: block;
}

/* Focus Visible Enhancement */
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

/* Prevent layout shift during loading */
.btn[data-original-width] {
    min-width: var(--original-width);
}

/* Dark mode support for effects */
@media (prefers-color-scheme: dark) {
    .form-loading-overlay {
        background: rgba(33, 37, 41, 0.95);
    }
    
    .smart-toast {
        background: #2d3748;
        color: #e9ecef;
    }
    
    .skeleton-box {
        background: linear-gradient(
            90deg,
            #2d3748 25%,
            #3d4756 50%,
            #2d3748 75%
        );
    }
}

/* 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;
    }
    
    .ripple {
        display: none;
    }
}
