/* ============================================================================
   VISUAL POLISH & MICRO-INTERACTIONS
   Professional animations, transitions, and modern design enhancements
   ============================================================================ */

/* ============================================================================
   1. SMOOTH TRANSITIONS - Apply to all interactive elements
   ============================================================================ */

.team-management-container * {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   2. STAT CARDS - Enhanced hover effects
   ============================================================================ */

.stat-card {
    position: relative;
    overflow: hidden;
    transform: translateZ(0); /* Hardware acceleration */
    will-change: transform, box-shadow;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / 10%), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 12px 24px rgb(0 0 0 / 12%),
        0 4px 8px rgb(0 0 0 / 8%);
}

.stat-icon {
    position: relative;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.stat-card:hover .stat-icon {
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* ============================================================================
   3. BUTTONS - Professional ripple effects and animations
   ============================================================================ */

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-icon {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

/* Ripple effect */
.btn-primary::after,
.btn-secondary::after,
.btn-danger::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 50%);
    transform: translate(-50%, -50%);
    transition:
        width 0.6s,
        height 0.6s;
}

.btn-primary:active::after,
.btn-secondary:active::after,
.btn-danger:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* Icon button hover */
.btn-icon {
    transition: all 0.2s ease;
}

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

.btn-icon:active {
    transform: scale(0.95);
}

/* ============================================================================
   4. ROLE BADGES - Modern gradient designs
   ============================================================================ */

.role-badge {
    position: relative;
    background: linear-gradient(135deg, var(--badge-from), var(--badge-to));
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
    transition: all 0.3s ease;
}

.role-badge.role-owner {
    --badge-from: #4a66e6;
    --badge-to: #6d28d9;

    animation: shimmer 3s ease-in-out infinite;
}

.role-badge.role-admin {
    --badge-from: #4a66e6;
    --badge-to: #1433d2;
}

.role-badge.role-member {
    --badge-from: #6b7280;
    --badge-to: #4b5563;
}

.role-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgb(0 0 0 / 15%);
}

@keyframes shimmer {
    0%,
    100% {
        box-shadow: 0 2px 4px rgb(139 92 246 / 30%);
    }

    50% {
        box-shadow: 0 4px 12px rgb(139 92 246 / 50%);
    }
}

/* ============================================================================
   5. STATUS BADGES - Pulse animations
   ============================================================================ */

.status-badge {
    position: relative;
    animation: fadeIn 0.3s ease;
}

.status-verified {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 8px rgb(16 185 129 / 30%);
}

.status-verified::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: pulse 2s ease-in-out infinite;
    opacity: 0;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
}

.status-pending {
    animation: pendingPulse 1.5s ease-in-out infinite;
}

@keyframes pendingPulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ============================================================================
   6. MEMBER ROWS - Smooth hover transitions
   ============================================================================ */

.member-row {
    transition: all 0.2s ease;
}

.member-row:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
}

.member-avatar {
    transition: all 0.3s ease;
}

.member-row:hover .member-avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 8px rgb(0 0 0 / 15%);
}

/* ============================================================================
   7. TEAM CARDS - Enhanced depth and shadows
   ============================================================================ */

.team-card {
    transition: all 0.3s ease;
    position: relative;
}

.team-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 var(--brand-primary);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.team-card:hover::after {
    box-shadow: 0 0 0 2px var(--brand-primary);
    opacity: 0.1;
}

/* ============================================================================
   8. MODAL ANIMATIONS - Smooth entry/exit
   ============================================================================ */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================================
   9. ACTIVITY ENTRIES - Fade in on load
   ============================================================================ */

.activity-entry {
    animation: fadeInUp 0.4s ease backwards;
}

.activity-entry:nth-child(1) {
    animation-delay: 0.05s;
}

.activity-entry:nth-child(2) {
    animation-delay: 0.1s;
}

.activity-entry:nth-child(3) {
    animation-delay: 0.15s;
}

.activity-entry:nth-child(4) {
    animation-delay: 0.2s;
}

.activity-entry:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-icon {
    transition: all 0.3s ease;
}

.activity-entry:hover .activity-icon {
    transform: scale(1.2) rotate(10deg);
}

/* ============================================================================
   10. TAB NAVIGATION - Smooth indicator
   ============================================================================ */

.team-tab {
    position: relative;
}

.team-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.team-tab.active::after {
    transform: scaleX(1);
}

.team-tab:hover::after {
    transform: scaleX(0.5);
}

.team-tab.active:hover::after {
    transform: scaleX(1);
}

/* ============================================================================
   11. EMPTY STATES - Breathing animation
   ============================================================================ */

.empty-state-icon {
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* ============================================================================
   12. COPY BUTTON - Success animation
   ============================================================================ */

.btn-copy {
    transition: all 0.2s ease;
}

.btn-copy:hover {
    transform: scale(1.05);
    background: var(--brand-light);
    color: var(--brand-primary);
}

.btn-copy:active {
    transform: scale(0.95);
}

.btn-copy.copied {
    background: #10b981;
    color: white;
    animation: successPop 0.4s ease;
}

@keyframes successPop {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================================================
   13. SVG ICONS - Color transitions
   ============================================================================ */

.stat-icon svg,
.activity-icon svg,
.btn-icon svg {
    transition: all 0.2s ease;
}

.stat-card:hover .stat-icon svg {
    stroke-width: 2.5;
}

.btn-icon:hover svg {
    stroke-width: 2.5;
}

/* ============================================================================
   14. LOADING STATES - Skeleton shimmer enhancement
   ============================================================================ */

.skeleton-card,
.skeleton-row,
.skeleton-entry {
    animation: skeletonFadeIn 0.3s ease;
}

@keyframes skeletonFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 0.7;
    }
}

/* ============================================================================
   15. FOCUS STATES - Accessibility with style
   Scoped to .team-management-container to match the rest of this file -
   the unscoped form-element selectors used to leak across every textarea
   and input in the app (most visibly the Kabiri Assistant chat textarea
   in the right-side panel, where we explicitly want no focus halo).
   ============================================================================ */

.team-management-container button:focus-visible,
.team-management-container input:focus-visible,
.team-management-container select:focus-visible,
.team-management-container textarea:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    animation: focusPulse 0.3s ease;
}

@keyframes focusPulse {
    0% {
        outline-offset: 2px;
    }

    50% {
        outline-offset: 4px;
    }

    100% {
        outline-offset: 2px;
    }
}

/* ============================================================================
   16. REDUCED MOTION - Respect user preferences
   ============================================================================ */

@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;
    }
}

/* ============================================================================
   17. DARK MODE - Enhanced shadows and glows
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .stat-card:hover {
        box-shadow:
            0 12px 24px rgb(0 0 0 / 40%),
            0 0 20px rgba(var(--brand-rgb), 0.2);
    }

    .btn-primary {
        box-shadow: 0 2px 8px rgba(var(--brand-rgb), 0.3);
    }

    .btn-primary:hover {
        box-shadow: 0 4px 16px rgba(var(--brand-rgb), 0.4);
    }

    .role-badge.role-owner {
        box-shadow: 0 2px 8px rgb(139 92 246 / 40%);
    }
}

/* ============================================================================
   18. PERFORMANCE OPTIMIZATIONS
   ============================================================================ */

.stat-card,
.member-row,
.activity-entry,
.team-card,
.btn-primary,
.btn-secondary,
.btn-danger {
    will-change: transform;
}

/* Remove will-change after animation */
.stat-card:not(:hover),
.member-row:not(:hover),
.activity-entry:not(:hover) {
    will-change: auto;
}
