/* ========================================
   VECTEUR UX Enhancements
   ======================================== */

/* ========================================
   1. SKELETON LOADING
   ======================================== */

@keyframes skeleton-pulse {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.lg { height: 20px; }
.skeleton-text.sm { height: 10px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }
.skeleton-text.w-100 { width: 100%; }

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-avatar.lg {
    width: 64px;
    height: 64px;
}

.skeleton-badge {
    width: 60px;
    height: 24px;
    border-radius: 12px;
}

.skeleton-btn {
    height: 38px;
    width: 100px;
    border-radius: 6px;
}

.skeleton-img {
    width: 100%;
    height: 180px;
    border-radius: 8px;
}

/* Skeleton Card */
.skeleton-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.skeleton-card .card-body {
    padding: 1.25rem;
}

.skeleton-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

/* Skeleton Table */
.skeleton-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.skeleton-table th {
    background: #f8fafc;
    padding: 12px 16px;
    border-bottom: 2px solid #e2e8f0;
}

.skeleton-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.skeleton-table th .skeleton {
    height: 12px;
    background: linear-gradient(90deg, #cbd5e1 25%, #e2e8f0 37%, #cbd5e1 63%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* Skeleton transitions */
.skeleton-container {
    transition: opacity 0.3s ease;
}

.skeleton-container.loaded {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.content-container {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.content-container.loaded {
    opacity: 1;
}

/* ========================================
   2. PAGE TRANSITIONS
   ======================================== */

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-content {
    animation: page-fade-in 0.35s ease-out;
}

/* Staggered fade for cards/items */
@keyframes stagger-fade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
    opacity: 0;
    animation: stagger-fade 0.4s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* Link transitions */
a { transition: color 0.2s ease; }

/* ========================================
   3. ENHANCED TOASTS
   ======================================== */

.toast-enhanced {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    overflow: hidden;
    min-width: 320px;
    max-width: 420px;
    backdrop-filter: blur(8px);
}

.toast-enhanced .toast-header {
    padding: 12px 16px;
    border-bottom: none;
}

.toast-enhanced .toast-body {
    padding: 0 16px 12px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.toast-enhanced .toast-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 14px;
}

.toast-enhanced .toast-actions .btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}

/* Toast types */
.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-header { color: var(--success); }

.toast-danger { border-left: 4px solid var(--danger); }
.toast-danger .toast-header { color: var(--danger); }

.toast-warning { border-left: 4px solid var(--warning); }
.toast-warning .toast-header { color: var(--warning); }

.toast-info { border-left: 4px solid var(--info); }
.toast-info .toast-header { color: var(--info); }

/* Toast slide-in animation */
@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-enhanced.showing {
    animation: toast-slide-in 0.3s ease-out;
}

/* Toast progress bar */
.toast-progress {
    height: 3px;
    background: rgba(0,0,0,0.1);
    border-radius: 0;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.toast-progress-bar {
    height: 100%;
    border-radius: 0;
    transition: width linear;
}

.toast-success .toast-progress-bar { background: var(--success); }
.toast-danger .toast-progress-bar { background: var(--danger); }
.toast-warning .toast-progress-bar { background: var(--warning); }
.toast-info .toast-progress-bar { background: var(--info); }

/* ========================================
   4. DYNAMIC BREADCRUMB
   ======================================== */

.breadcrumb-dynamic {
    background: transparent;
    padding: 0;
    margin: 0 0 1rem;
    font-size: 0.85rem;
}

.breadcrumb-dynamic .breadcrumb-item a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-dynamic .breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-dynamic .breadcrumb-item.active {
    color: var(--dark);
    font-weight: 600;
}

.breadcrumb-dynamic .breadcrumb-item + .breadcrumb-item::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.6rem;
    color: #cbd5e1;
    padding: 0 8px;
}

/* ========================================
   5. MICRO-ANIMATIONS & RIPPLE
   ======================================== */

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Button hover enhancements */
.btn {
    transition: all 0.2s ease;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
}

.btn:not(:disabled):active {
    transform: translateY(0) scale(0.98);
}

/* Card hover lift */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* Icon bounce on hover */
.icon-hover-bounce:hover i,
.icon-hover-bounce:hover .fas,
.icon-hover-bounce:hover .far {
    animation: icon-bounce 0.4s ease;
}

@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

/* Scale on hover */
.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.03);
}

/* ========================================
   6. VISUAL FEEDBACK
   ======================================== */

@keyframes feedback-flash-success {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes feedback-flash-danger {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes feedback-flash-info {
    0% { box-shadow: 0 0 0 0 rgba(29, 161, 212, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(29, 161, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(29, 161, 212, 0); }
}

.feedback-success { animation: feedback-flash-success 0.6s ease; }
.feedback-danger { animation: feedback-flash-danger 0.6s ease; }
.feedback-info { animation: feedback-flash-info 0.6s ease; }

/* Checkmark animation */
@keyframes checkmark-draw {
    to { stroke-dashoffset: 0; }
}

.feedback-checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.feedback-checkmark path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: checkmark-draw 0.4s ease forwards 0.1s;
}

/* ========================================
   7. INFINITE SCROLL
   ======================================== */

.infinite-scroll-container {
    position: relative;
}

.infinite-scroll-loader {
    text-align: center;
    padding: 24px;
    display: none;
}

.infinite-scroll-loader.active {
    display: block;
}

.infinite-scroll-dots {
    display: inline-flex;
    gap: 6px;
}

.infinite-scroll-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: scroll-dot-bounce 1.4s ease-in-out infinite;
}

.infinite-scroll-dots span:nth-child(2) { animation-delay: 0.2s; }
.infinite-scroll-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes scroll-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.infinite-scroll-end {
    text-align: center;
    padding: 16px;
    color: var(--gray);
    font-size: 0.85rem;
}

/* ========================================
   8. FORM ENHANCEMENTS
   ======================================== */

.form-control:focus,
.form-select:focus {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-floating-animated label {
    transition: all 0.2s ease;
}

/* Input validation visual feedback */
.form-control.is-valid { animation: feedback-flash-success 0.6s ease; }
.form-control.is-invalid { animation: feedback-flash-danger 0.6s ease; }

/* ========================================
   9. TABLE ENHANCEMENTS
   ======================================== */

.table-enhanced tbody tr {
    transition: background-color 0.15s ease;
}

.table-enhanced tbody tr:hover {
    background-color: rgba(29, 161, 212, 0.04);
}

.table-enhanced tbody tr.row-highlight {
    animation: row-highlight 1.5s ease;
}

@keyframes row-highlight {
    0% { background-color: rgba(29, 161, 212, 0.15); }
    100% { background-color: transparent; }
}

/* ========================================
   10. RESPONSIVE IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    .toast-enhanced { min-width: 280px; max-width: calc(100vw - 32px); }
    .skeleton-card { margin-bottom: 12px; }
}

/* Reduced motion support */
/* ========================================
   11. DASHBOARD REALTIME ANIMATIONS
   ======================================== */

@keyframes counter-flash-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: var(--accent, #1DA1F2); }
    100% { transform: scale(1); }
}

.counter-flash {
    animation: counter-flash-anim 0.5s ease;
}

@keyframes realtime-flash-anim {
    0% { box-shadow: 0 0 0 0 rgba(29,161,242,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(29,161,242,0); }
    100% { box-shadow: 0 0 0 0 rgba(29,161,242,0); }
}

.realtime-flash {
    animation: realtime-flash-anim 1.5s ease;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; background: #e2e8f0; }
    .stagger-item { animation: none; opacity: 1; }
    .page-content { animation: none; }
    .btn:hover { transform: none; }
    .card-hover:hover { transform: none; }
    .ripple-effect { display: none; }
    .toast-enhanced.showing { animation: none; }
}