/* ============================================================
   My Achievements — Portal Gamification Section
   Premium card-based design with soft gradients & micro-animations
   ============================================================ */

/* ---------- Section wrapper ---------- */
.achievements-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 50%, #fef9f4 100%);
    border-radius: 24px;
    padding: 40px 32px;
    margin-top: 32px;
    position: relative;
    overflow: hidden;
}

.achievements-section::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.achievements-section::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ---------- Section header ---------- */
.achievements-header {
    text-align: center;
    margin-bottom: 36px;
    position: relative;
    z-index: 1;
}

.achievements-header h2 {
    font-size: 1.85rem;
    font-weight: 800;
    color: #2a2a2a;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.achievements-header p {
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 400;
    margin: 0;
}

/* ---------- Sub-section titles ---------- */
.achievements-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 12px;
    position: relative;
    z-index: 1;
}

.achievements-category-title .ach-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.achievements-category-title .ach-icon.earned {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.achievements-category-title .ach-icon.progress {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.achievements-category-title .ach-icon.locked {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #94a3b8;
}

.achievements-category-title h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.achievements-category-title .ach-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
}

/* ---------- Divider ---------- */
.achievements-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.15), transparent);
    margin: 28px 0;
    border: none;
}

/* ---------- Badge card (shared) ---------- */
.achievement-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.achievement-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.12);
}

/* ---------- Badge image ---------- */
.achievement-card .badge-img-wrap {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: relative;
}

.achievement-card .badge-img-wrap img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.achievement-card:hover .badge-img-wrap img {
    transform: scale(1.1);
}

/* Earned card shimmer ring */
.achievement-card.earned .badge-img-wrap {
    background: linear-gradient(135deg, #fef3c7, #fde68a, #fef3c7);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15), 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* In-progress greyscale */
.achievement-card.in-progress .badge-img-wrap img {
    filter: grayscale(55%) opacity(0.75);
}

/* Locked greyscale */
.achievement-card.locked .badge-img-wrap img {
    filter: grayscale(100%) opacity(0.4);
}

.achievement-card.locked .badge-img-wrap {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

/* ---------- Badge name ---------- */
.achievement-card .badge-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.3;
}

/* ---------- Badge description ---------- */
.achievement-card .badge-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.4;
    margin-bottom: 12px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Unlocked label ---------- */
.badge-unlocked-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.badge-unlocked-label .fa {
    font-size: 0.7rem;
}

/* ---------- Earned date ---------- */
.badge-earned-date {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 500;
}

.badge-earned-date .fa {
    margin-right: 4px;
    color: #cbd5e1;
}

/* ---------- Progress bar ---------- */
.badge-progress-wrap {
    width: 100%;
    margin-top: auto;
    padding-top: 8px;
}

.badge-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.badge-progress-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
    width: 0%;
    transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.badge-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.badge-progress-text {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 8px;
}

.badge-progress-text span {
    color: #6366f1;
    font-weight: 700;
}

/* ---------- CTA keep going ---------- */
.badge-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #6366f1;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background 0.3s ease, transform 0.2s ease;
    cursor: default;
}

.achievement-card:hover .badge-cta {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    transform: scale(1.03);
}

/* ---------- Locked overlay & tooltip ---------- */
.badge-locked-overlay {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    cursor: default;
    margin-top: auto;
}

.badge-locked-overlay .fa {
    font-size: 0.7rem;
}

/* CSS tooltip */
.ach-tooltip-wrap {
    position: relative;
}

.ach-tooltip-wrap .ach-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1e293b;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 10px;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ach-tooltip-wrap .ach-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

.ach-tooltip-wrap:hover .ach-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Confetti canvas ---------- */
#achievementConfettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ---------- Empty state ---------- */
.achievements-empty {
    text-align: center;
    padding: 32px 16px;
    color: #94a3b8;
}

.achievements-empty .fa {
    font-size: 2.4rem;
    margin-bottom: 12px;
    color: #cbd5e1;
}

.achievements-empty p {
    font-size: 0.88rem;
    margin: 0;
    font-weight: 500;
}

/* ---------- XP badge (optional reward text) ---------- */
.badge-xp {
    display: inline-block;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 12px;
    margin-top: 6px;
    letter-spacing: 0.04em;
}

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
    .achievements-section {
        padding: 24px 16px;
        border-radius: 16px;
        margin-top: 20px;
    }

    .achievements-header h2 {
        font-size: 1.45rem;
    }

    .achievement-card {
        padding: 20px 16px;
    }

    .achievement-card .badge-img-wrap {
        width: 72px;
        height: 72px;
    }

    .achievement-card .badge-img-wrap img {
        width: 58px;
        height: 58px;
    }
}

@media (max-width: 575.98px) {
    .achievements-section {
        padding: 20px 12px;
    }

    .achievements-header h2 {
        font-size: 1.3rem;
    }
}

/* ---------- New Badge Redesign Styles ---------- */

.achievements-section {
    background: transparent !important;
    padding: 20px 0 !important;
    box-shadow: none !important;
}

.achievements-section::before,
.achievements-section::after {
    display: none !important;
}

.badge-row {
    transition: all 0.3s ease;
}

.badge-earned-ring {
    border: 3px solid #10b981;
    padding: 4px;
}

.badge-checkmark {
    color: #10b981;
    background: white;
    border-radius: 50%;
}

.badge-checkmark-lg {
    color: #10b981;
    background: white;
    border-radius: 50%;
    border: 3px solid white;
}

.locked-grayscale {
    filter: grayscale(100%) opacity(0.5);
}

.confetti-bg {
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.1) 0%, transparent 60%);
    background-color: #fffaf0 !important;
}

.cursor-pointer {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cursor-pointer:hover {
    transform: translateY(-3px);
}

/* ---------- Level Tracker Card (Portal Home) ---------- */
.level-tracker-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%) !important;
    /* background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 20%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 10l-5 15h10l-5 15' stroke='rgba(255,255,255,0.03)' stroke-width='2' fill='none'/%3E%3C/svg%3E") !important; */
    border-radius: 24px;
    padding: 28px 24px;
    color: #ffffff !important;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
    position: relative;
    overflow: hidden;
    margin-top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.level-tracker-card .level-title {
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
    opacity: 0.95;
}

.level-tracker-progress-wrap {
    margin-bottom: 24px;
}

.level-tracker-progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.level-tracker-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00FF87 0%, #60EFFF 100%);
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.6);
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.level-tracker-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: trackerShimmer 2s infinite;
}

@keyframes trackerShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.level-tracker-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.level-tracker-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}

.tracker-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tracker-stat-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(4px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    color: #ffffff;
}

.tracker-stat-item:hover .tracker-stat-circle {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    border-color: #ffffff;
}

.tracker-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

.tracker-dot {
    position: absolute;
    top: -4px;
    right: 0;
    width: 10px;
    height: 10px;
    background: #fbbf24;
    border-radius: 50%;
    box-shadow: 0 0 10px #fbbf24;
    border: 2px solid #1e1b4b;
}

.reveal-code-btn {
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-weight: 800;
    font-size: 0.9rem;
    margin-top: 24px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reveal-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    filter: brightness(1.1);
}

/* ---------- Mobile Responsiveness Enhancements ---------- */
@media (max-width: 991.98px) {
    #accountOffCanvas {
        width: 100% !important;
        max-width: 380px !important;
        z-index: 22222 !important;
    }

    .level-tracker-card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    .level-tracker-card .level-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
        letter-spacing: 1.5px;
    }

    .tracker-stat-circle {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .tracker-stat-label {
        font-size: 0.6rem;
    }

    .level-tracker-progress-labels {
        font-size: 0.6rem;
    }

    .reveal-code-btn {
        padding: 12px 16px;
        font-size: 0.8rem;
        margin-top: 18px;
    }

    .level-tracker-stats-grid {
        gap: 8px;
    }
}
