/*
 * Smooth UX Enhancements
 * Making the user experience smoother without breaking existing functionality
 * 
 * Copyright 2025 - Enhanced User Experience
 */

/* ==========================================================================
   GLOBAL SMOOTH TRANSITIONS
   ========================================================================== */

/* Add smooth transitions to all interactive elements */
*, *::before, *::after {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reduce motion for users who prefer it */
@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;
    }
}

/* ==========================================================================
   ENHANCED BUTTON INTERACTIONS
   ========================================================================== */

/* Smooth button hover effects */
.btn, .button, button, input[type="submit"], input[type="button"] {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:hover, .button:hover, button:hover, input[type="submit"]:hover, input[type="button"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(24, 119, 242, 0.3);
}

.btn:active, .button:active, button:active, input[type="submit"]:active, input[type="button"]:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(24, 119, 242, 0.2);
}

/* Button ripple effect */
.btn::before, .button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before, .button:active::before {
    width: 300px;
    height: 300px;
}

/* ==========================================================================
   ENHANCED CARD INTERACTIONS
   ========================================================================== */

.card {
    transform: translateZ(0);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Smooth card content transitions */
.card-body, .card-header, .card-footer {
    transition: all 0.3s ease;
}

/* ==========================================================================
   ENHANCED FORM INTERACTIONS
   ========================================================================== */

/* Smooth input focus effects */
input, textarea, select {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 8px;
}

input:focus, textarea:focus, select:focus {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(24, 119, 242, 0.2);
    border-color: #1877F2;
}

/* Floating label effect enhancement */
.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group label {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   ENHANCED NAVIGATION
   ========================================================================== */

/* Smooth navigation transitions */
nav, .navbar, .nav-tabs, .nav-pills {
    transition: all 0.3s ease;
}

.nav-link, .navbar-nav .nav-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-link::after, .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #1877F2;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-link:hover::after, .navbar-nav .nav-link:hover::after,
.nav-link.active::after, .navbar-nav .nav-link.active::after {
    width: 100%;
}

/* ==========================================================================
   ENHANCED MODAL INTERACTIONS
   ========================================================================== */

.modal {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-dialog {
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.modal-content {
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: none;
    overflow: hidden;
}

/* ==========================================================================
   ENHANCED LOADING STATES
   ========================================================================== */

/* Smooth loading spinner */
.spinner-border, .preloader-wrapper {
    animation: smoothSpin 1s linear infinite;
}

@keyframes smoothSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading skeleton animation */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   ENHANCED DROPDOWN MENUS
   ========================================================================== */

.dropdown-menu {
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: none;
}

.dropdown-menu.show {
    transform: translateY(0);
    opacity: 1;
}

.dropdown-item {
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px 8px;
}

.dropdown-item:hover {
    background: rgba(24, 119, 242, 0.1);
    transform: translateX(4px);
}

/* ==========================================================================
   ENHANCED TOAST NOTIFICATIONS
   ========================================================================== */

.toast {
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: none;
}

.toast.show {
    transform: translateX(0);
}

.toast.hiding {
    transform: translateX(100%);
}

/* ==========================================================================
   ENHANCED IMAGE LOADING
   ========================================================================== */

img {
    transition: all 0.3s ease;
    border-radius: 8px;
}

img:hover {
    transform: scale(1.05);
}

/* Smooth image loading */
img[src] {
    opacity: 0;
    animation: fadeInImage 0.5s ease forwards;
}

@keyframes fadeInImage {
    to { opacity: 1; }
}

/* ==========================================================================
   ENHANCED SCROLL BEHAVIOR
   ========================================================================== */

html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #1877F2;
}

/* ==========================================================================
   ENHANCED FOCUS STATES FOR ACCESSIBILITY
   ========================================================================== */

*:focus {
    outline: 2px solid #1877F2;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove default focus for mouse users, keep for keyboard users */
.js-focus-visible *:focus:not(.focus-visible) {
    outline: none;
}

/* ==========================================================================
   ENHANCED HOVER EFFECTS FOR INTERACTIVE ELEMENTS
   ========================================================================== */

a, .clickable {
    transition: all 0.2s ease;
}

a:hover, .clickable:hover {
    color: #1877F2;
    text-decoration: none;
}

/* ==========================================================================
   ENHANCED PAGE TRANSITIONS
   ========================================================================== */

.page-transition {
    opacity: 0;
    transform: translateY(20px);
    animation: pageEnter 0.5s ease forwards;
}

@keyframes pageEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   ENHANCED MICRO-INTERACTIONS
   ========================================================================== */

/* Smooth icon rotations */
.fa, .icon, i {
    transition: transform 0.3s ease;
}

.fa:hover, .icon:hover, i:hover {
    transform: scale(1.1);
}

/* Smooth badge animations */
.badge, .label {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.badge:hover, .label:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

/* ==========================================================================
   ENHANCED TABLE INTERACTIONS
   ========================================================================== */

table tr {
    transition: all 0.2s ease;
}

table tr:hover {
    background-color: rgba(24, 119, 242, 0.05);
    transform: scale(1.01);
}

/* ==========================================================================
   ENHANCED PROGRESS BARS
   ========================================================================== */

.progress-bar {
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #1877F2, #42a5f5);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

/* ==========================================================================
   ENHANCED ACCORDION/COLLAPSE
   ========================================================================== */

.collapse {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.collapse.show {
    animation: slideDown 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   ENHANCED RESPONSIVE ANIMATIONS
   ========================================================================== */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile for better performance */
    .btn:hover, .button:hover {
        transform: none;
        box-shadow: none;
    }
    
    .card:hover {
        transform: translateY(-2px);
    }
    
    img:hover {
        transform: none;
    }
}

/* ==========================================================================
   ENHANCED DARK MODE SUPPORT
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .loading-skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #1a1a1a 50%, #2a2a2a 75%);
        background-size: 200% 100%;
    }
    
    ::-webkit-scrollbar-track {
        background: #2a2a2a;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #555;
    }
}


