/* Badge Celebration Styles */

/* Full screen celebration overlay */
.badge-celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.badge-celebration-overlay.active {
    opacity: 1;
    visibility: visible;
}

.badge-celebration-container {
    text-align: center;
    transform: scale(0.5);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

.badge-celebration-overlay.active .badge-celebration-container {
    transform: scale(1);
    opacity: 1;
}

.badge-celebration-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 20px;
    animation: titlePulse 1s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.badge-celebration-icon {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
}

.badge-celebration-icon img,
.badge-celebration-icon > div {
    width: 100%;
    height: 100%;
    animation: badgeBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    filter: drop-shadow(0 0 30px var(--badge-color, #fbbf24));
}

.badge-celebration-icon > div svg {
    width: 100%;
    height: 100%;
}

@keyframes badgeBounce {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    70% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.badge-glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--badge-color, #fbbf24);
    opacity: 0;
    animation: glowRingExpand 1.5s ease-out infinite;
}

.badge-glow-ring:nth-child(1) { animation-delay: 0s; }
.badge-glow-ring:nth-child(2) { animation-delay: 0.3s; }
.badge-glow-ring:nth-child(3) { animation-delay: 0.6s; }

@keyframes glowRingExpand {
    0% {
        width: 100px;
        height: 100px;
        opacity: 0.8;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

.badge-celebration-name {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--badge-color, #fbbf24);
}

.badge-celebration-description {
    font-size: 1rem;
    color: #aaa;
    max-width: 400px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.badge-celebration-button {
    background: linear-gradient(135deg, var(--badge-color, #fbbf24), var(--badge-color-dark, #d4a017));
    color: #000;
    border: none;
    padding: 15px 50px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.badge-celebration-button:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.4);
}

/* Confetti container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Toast notification */
.badge-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid var(--badge-color, #fbbf24);
    border-radius: 16px;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9998;
    transform: translateX(400px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 350px;
}

.badge-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.badge-toast-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.badge-toast-icon img,
.badge-toast-icon > div {
    width: 100%;
    height: 100%;
}

.badge-toast-icon > div svg {
    width: 100%;
    height: 100%;
}

.badge-toast-content {
    flex: 1;
}

.badge-toast-label {
    font-size: 0.75rem;
    color: var(--badge-color, #fbbf24);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.badge-toast-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.badge-toast-description {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
}

/* Badge grid for profile/dashboard */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: transform 0.2s, background 0.2s;
}

.badge-item:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.1);
}

.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.badge-item-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 0.5rem;
}

.badge-item-icon img {
    width: 100%;
    height: 100%;
}

.badge-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

.badge-item-status {
    font-size: 0.75rem;
    color: #888;
}

.badge-item-status.unlocked {
    color: #10b981;
}

/* Progress bar for badges */
.badge-progress {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.badge-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.badge-progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.badge-progress-count {
    font-size: 0.85rem;
    color: #888;
}

.badge-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.badge-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #0052FF, #00D4AA);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Streak display */
.streak-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.streak-icon {
    font-size: 1.5rem;
}

.streak-count {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f59e0b;
}

.streak-label {
    font-size: 0.85rem;
    color: #888;
}

/* Secret Badge Celebration */
.badge-secret .badge-celebration-container {
    position: relative;
}

.badge-secret-label {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 6px;
    margin-bottom: 0.5rem;
    animation: secretPulse 1.5s ease-in-out infinite;
}

@keyframes secretPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.badge-secret-sparkles {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    pointer-events: none;
}

.badge-secret-sparkles .sparkle {
    position: absolute;
    color: #fbbf24;
    font-size: 1.2rem;
    animation: sparkleFloat 2s ease-in-out infinite;
    opacity: 0;
}

.badge-secret-sparkles .sparkle:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.badge-secret-sparkles .sparkle:nth-child(2) { top: 5%; left: 85%; animation-delay: 0.3s; }
.badge-secret-sparkles .sparkle:nth-child(3) { top: 40%; left: 0%; animation-delay: 0.6s; }
.badge-secret-sparkles .sparkle:nth-child(4) { top: 35%; left: 95%; animation-delay: 0.9s; }
.badge-secret-sparkles .sparkle:nth-child(5) { top: 70%; left: 5%; animation-delay: 1.2s; }
.badge-secret-sparkles .sparkle:nth-child(6) { top: 65%; left: 90%; animation-delay: 1.5s; }

@keyframes sparkleFloat {
    0% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}

.badge-secret .badge-celebration-icon img,
.badge-secret .badge-celebration-icon > div {
    animation: secretBadgeReveal 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes secretBadgeReveal {
    0% { transform: scale(0) rotate(-360deg); filter: brightness(3) blur(10px); }
    40% { filter: brightness(2) blur(5px); }
    70% { transform: scale(1.15) rotate(10deg); filter: brightness(1.2) blur(0); }
    85% { transform: scale(0.95) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); filter: brightness(1) blur(0); }
}

.badge-secret .badge-glow-ring {
    border-color: #fbbf24;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

/* Submission Approved Celebration */
.badge-approval .approval-check-wrap {
    width: 140px;
    height: 140px;
    margin: 0 auto 1.5rem;
}

.badge-approval .approval-check {
    width: 100%;
    height: 100%;
}

.badge-approval .approval-check-bg {
    fill: none;
    stroke: rgba(16, 185, 129, 0.15);
    stroke-width: 4;
}

.badge-approval .approval-check-ring {
    fill: none;
    stroke: #10b981;
    stroke-width: 4;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    stroke-linecap: round;
    transform-origin: center;
    animation: approvalRingDraw 0.8s ease-out 0.2s forwards;
}

@keyframes approvalRingDraw {
    to { stroke-dashoffset: 0; }
}

.badge-approval .approval-check-mark {
    fill: none;
    stroke: #10b981;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: approvalCheckDraw 0.5s ease-out 0.8s forwards;
}

@keyframes approvalCheckDraw {
    to { stroke-dashoffset: 0; }
}

.badge-approval .approval-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.75rem;
    animation: fadeInUp 0.5s ease-out 1.2s both;
}

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

.badge-approval .badge-celebration-title {
    animation: approvalTitleGlow 2s ease-in-out infinite;
}

@keyframes approvalTitleGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
    50% { text-shadow: 0 0 25px rgba(16, 185, 129, 0.6), 0 0 50px rgba(16, 185, 129, 0.2); }
}

/* Responsive */
@media (max-width: 600px) {
    .badge-celebration-icon {
        width: 150px;
        height: 150px;
    }

    .badge-celebration-name {
        font-size: 1.5rem;
    }

    .badge-toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }

    .badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
