/* path : ui-enhancements.css */
/* ========================================
   UI ENHANCEMENTS
   - Skeleton loaders
   - Success animations
   - Confetti effect
   ======================================== */

/* ----------------------------------------
   1. SKELETON LOADERS
   Animated placeholders while content loads
   ---------------------------------------- */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(111, 175, 166, 0.08) 0%,
        rgba(233, 193, 173, 0.15) 50%,
        rgba(111, 175, 166, 0.08) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Skeleton text lines */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

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

.skeleton-text-sm {
    height: 0.875em;
}

.skeleton-text-lg {
    height: 1.5em;
}

/* Skeleton title */
.skeleton-title {
    height: 2em;
    width: 60%;
    margin-bottom: 1em;
}

/* Skeleton avatar/image */
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
}

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

/* Skeleton card */
.skeleton-card {
    background: white;
    border: 1px solid rgba(111, 175, 166, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    overflow: hidden;
}

/* Skeleton button */
.skeleton-button {
    height: 48px;
    width: 150px;
    border-radius: 8px;
}

/* Skeleton form field */
.skeleton-input {
    height: 48px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Skeleton grid */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

/* ----------------------------------------
   2. SUCCESS ANIMATIONS
   Celebratory feedback after actions
   ---------------------------------------- */

/* Success checkmark animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.success-checkmark .circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #6FAFA6;
    fill: none;
    animation: circle-draw 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark .check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    stroke: #6FAFA6;
    fill: none;
    animation: check-draw 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes circle-draw {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes check-draw {
    100% {
        stroke-dashoffset: 0;
    }
}

/* Success pulse ring */
.success-pulse {
    position: relative;
    display: inline-block;
}

.success-pulse::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid #6FAFA6;
    border-radius: 50%;
    animation: pulse-ring 1s ease-out;
    opacity: 0;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Success bounce */
.success-bounce {
    animation: success-bounce 0.5s ease;
}

@keyframes success-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-15px);
    }
    50% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(-10px);
    }
}

/* Success scale in */
.success-scale-in {
    animation: success-scale-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes success-scale-in {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ----------------------------------------
   3. CONFETTI EFFECT
   Celebratory particle animation
   ---------------------------------------- */

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall linear forwards;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.square {
    border-radius: 2px;
}

.confetti.ribbon {
    width: 5px;
    height: 15px;
    border-radius: 2px;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Confetti color variations */
.confetti.color-1 { background: #6FAFA6; }
.confetti.color-2 { background: #e9c1ad; }
.confetti.color-3 { background: #3F7F76; }
.confetti.color-4 { background: #f5e1d8; }
.confetti.color-5 { background: #d4a594; }
.confetti.color-6 { background: #FFD700; }

/* ----------------------------------------
   4. LOADING STATES
   ---------------------------------------- */

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(111, 175, 166, 0.2);
    border-top-color: #6FAFA6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

/* Dots loading */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #6FAFA6;
    border-radius: 50%;
    animation: dots-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes dots-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ----------------------------------------
   5. TRANSITIONS FOR CONTENT LOADING
   ---------------------------------------- */

.fade-in-content {
    animation: fade-in-content 0.4s ease-out;
}

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

/* Staggered children animation */
.stagger-children > * {
    opacity: 0;
    animation: fade-in-content 0.4s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }