/**
 * SMM Panel - Modern Animations & Effects
 * Smooth transitions, micro-interactions, and loading states
 */

/* ========== KEYFRAME ANIMATIONS ========== */

/* Fade animations */
@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 fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

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

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

/* Slide animations */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

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

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

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

/* Pulse & glow */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
}

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

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

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

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

/* Toast slide */
@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* Progress bar */
@keyframes progressStripe {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* Ripple effect */
@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

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

.animate-fade-in { animation: fadeIn 0.4s ease-out both; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out both; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease-out both; }
.animate-fade-in-left { animation: fadeInLeft 0.5s ease-out both; }
.animate-fade-in-right { animation: fadeInRight 0.5s ease-out both; }
.animate-scale-in { animation: scaleIn 0.3s ease-out both; }
.animate-scale-up { animation: scaleUp 0.4s ease-out both; }
.animate-pop-in { animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) both; }
.animate-slide-in-right { animation: slideInRight 0.3s ease-out both; }
.animate-slide-in-left { animation: slideInLeft 0.3s ease-out both; }
.animate-slide-in-up { animation: slideInUp 0.3s ease-out both; }
.animate-slide-in-down { animation: slideInDown 0.3s ease-out both; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-bounce { animation: bounce 1s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-wiggle { animation: wiggle 0.5s ease-in-out; }

/* Staggered animation delays for lists */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

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

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-text-sm {
    height: 10px;
    margin-bottom: 6px;
    border-radius: 4px;
}

.skeleton-heading {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
    border-radius: 8px;
}

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

.skeleton-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.skeleton-btn {
    height: 36px;
    width: 120px;
    border-radius: 10px;
}

.skeleton-card {
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #f0f0f0;
}

.skeleton-stat {
    height: 80px;
    border-radius: 16px;
}

.skeleton-table-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-table-row .skeleton {
    height: 14px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 12px;
}

.skeleton-chart {
    width: 100%;
    height: 250px;
    border-radius: 16px;
}

/* Dark mode skeletons */
.dark .skeleton,
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    background-size: 200% 100%;
}

.dark .skeleton-card,
[data-theme="dark"] .skeleton-card {
    border-color: #374151;
}

.dark .skeleton-table-row,
[data-theme="dark"] .skeleton-table-row {
    border-bottom-color: #374151;
}

/* ========== MICRO INTERACTIONS ========== */

/* Hover lift effect */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Hover scale */
.hover-scale {
    transition: transform 0.2s ease;
}
.hover-scale:hover {
    transform: scale(1.02);
}

/* Hover glow */
.hover-glow {
    transition: box-shadow 0.3s ease;
}
.hover-glow:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
}

/* Active press effect */
.press-effect {
    transition: transform 0.1s ease;
}
.press-effect:active {
    transform: scale(0.97);
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}
.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10);
    opacity: 0;
    transition: transform 0.4s, opacity 0.8s;
}
.btn-ripple:active::after {
    transform: scale(0);
    opacity: 0.3;
    transition: 0s;
}

/* ========== GLASSMORPHISM ========== */

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-subtle {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dark .glass,
[data-theme="dark"] .glass {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========== GRADIENT BORDERS ========== */

.gradient-border {
    position: relative;
    border: none !important;
}
.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ========== ENHANCED CARDS ========== */

.card-modern {
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-modern:hover {
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.dark .card-modern,
[data-theme="dark"] .card-modern {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.06);
}

.dark .card-modern:hover,
[data-theme="dark"] .card-modern:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ========== ENHANCED STAT CARDS ========== */

.stat-card-modern {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, linear-gradient(90deg, #3b82f6, #8b5cf6));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.stat-card-modern:hover::before {
    opacity: 1;
}

.stat-card-modern .stat-icon-modern {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.stat-card-modern:hover .stat-icon-modern {
    transform: scale(1.1) rotate(-5deg);
}

.stat-card-modern .stat-value-modern {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-top: 16px;
}

.stat-card-modern .stat-label-modern {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    margin-top: 4px;
    letter-spacing: 0.01em;
}

.dark .stat-card-modern,
[data-theme="dark"] .stat-card-modern {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.06);
}

/* ========== ENHANCED BADGES ========== */

.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

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

.badge-modern.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ========== ENHANCED BUTTONS ========== */

.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.btn-modern:active {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}

.btn-modern-primary {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: white;
}

.btn-modern-primary:hover {
    background: linear-gradient(135deg, #000000, #111827);
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.3);
}

.btn-modern-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

.btn-modern-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
}

.btn-modern-outline {
    background: transparent;
    color: #374151;
    border: 1.5px solid #e5e7eb;
}

.btn-modern-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-modern-ghost {
    background: transparent;
    color: #6b7280;
    box-shadow: none !important;
}

.btn-modern-ghost:hover {
    background: #f3f4f6;
    color: #374151;
    transform: none;
}

/* ========== ENHANCED INPUTS ========== */

.input-modern {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    font-size: 0.875rem;
    color: #111827;
    transition: all 0.2s ease;
    outline: none;
}

.input-modern::placeholder {
    color: #9ca3af;
}

.input-modern:hover {
    border-color: #d1d5db;
}

.input-modern:focus {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.input-modern.input-error {
    border-color: #ef4444;
}

.input-modern.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.dark .input-modern,
[data-theme="dark"] .input-modern {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.dark .input-modern:focus,
[data-theme="dark"] .input-modern:focus {
    border-color: #f9fafb;
    box-shadow: 0 0 0 3px rgba(249, 250, 251, 0.08);
}

/* ========== ENHANCED TABLES ========== */

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.table-modern tbody td {
    padding: 14px 16px;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f9fafb;
    transition: background 0.15s ease;
}

.table-modern tbody tr {
    transition: all 0.15s ease;
}

.table-modern tbody tr:hover {
    background: #f9fafb;
}

.table-modern tbody tr:hover td {
    color: #111827;
}

.dark .table-modern thead th,
[data-theme="dark"] .table-modern thead th {
    background: #1f2937;
    border-bottom-color: #374151;
}

.dark .table-modern tbody td,
[data-theme="dark"] .table-modern tbody td {
    color: #d1d5db;
    border-bottom-color: #1f2937;
}

.dark .table-modern tbody tr:hover,
[data-theme="dark"] .table-modern tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ========== ENHANCED TOOLTIPS ========== */

.tooltip-modern {
    position: relative;
}

.tooltip-modern::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 6px 12px;
    background: #111827;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 100;
}

.tooltip-modern::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111827;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 100;
}

.tooltip-modern:hover::after,
.tooltip-modern:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== NOTIFICATION DOT ========== */

.notification-dot {
    position: relative;
}

.notification-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.notification-dot.dot-success::after {
    background: #10b981;
}

.notification-dot.dot-warning::after {
    background: #f59e0b;
}

/* ========== PAGE TRANSITIONS ========== */

.page-enter {
    animation: fadeInUp 0.4s ease-out both;
}

.page-content > *:nth-child(1) { animation-delay: 0s; }
.page-content > *:nth-child(2) { animation-delay: 0.05s; }
.page-content > *:nth-child(3) { animation-delay: 0.1s; }
.page-content > *:nth-child(4) { animation-delay: 0.15s; }
.page-content > *:nth-child(5) { animation-delay: 0.2s; }

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.dark .loading-overlay,
[data-theme="dark"] .loading-overlay {
    background: rgba(17, 24, 39, 0.8);
}

.spinner-modern {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #111827;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-modern-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-modern-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.dark .spinner-modern,
[data-theme="dark"] .spinner-modern {
    border-color: #374151;
    border-top-color: #f9fafb;
}

/* Dots loader */
.dots-loader {
    display: flex;
    gap: 4px;
    align-items: center;
}

.dots-loader span {
    width: 6px;
    height: 6px;
    background: #6b7280;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.dots-loader span:nth-child(2) { animation-delay: 0.1s; }
.dots-loader span:nth-child(3) { animation-delay: 0.2s; }

/* Progress bar animated */
.progress-modern {
    height: 6px;
    background: #f3f4f6;
    border-radius: 100px;
    overflow: hidden;
}

.progress-modern-bar {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-modern-bar.progress-striped {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.15) 10px,
        rgba(255, 255, 255, 0.15) 20px
    ),
    linear-gradient(90deg, #3b82f6, #8b5cf6);
    animation: progressStripe 1s linear infinite;
}

/* ========== EMPTY STATE MODERN ========== */

.empty-state-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-modern .empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #9ca3af;
    margin-bottom: 20px;
    animation: popIn 0.5s ease-out both;
}

.empty-state-modern h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
}

.empty-state-modern p {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 360px;
}

.dark .empty-state-modern .empty-icon,
[data-theme="dark"] .empty-state-modern .empty-icon {
    background: linear-gradient(135deg, #1f2937, #374151);
    color: #6b7280;
}

/* ========== 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 {
        animation: none;
        background: #f0f0f0;
    }
    
    .dark .skeleton,
    [data-theme="dark"] .skeleton {
        background: #1f2937;
    }
}
