/* =============================================
   CLEAN LEVEL SYSTEM UI
   ============================================= */

/* Sidebar Level Display */
.sidebar-level {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 10px 0;
    padding: 6px 10px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 30px;
    width: fit-content;
}

.level-badge {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.level-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: #a78bfa;
}

/* Settings Level Card */
.level-card {
    background: rgba(139, 92, 246, 0.06);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.level-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.level-rank {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-rank i {
    font-size: 1.2rem;
    color: #fbbf24;
}

.level-rank span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.level-number {
    font-size: 0.85rem;
    font-weight: 500;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Progress Bar */
.level-progress {
    margin-bottom: 12px;
}

.progress-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-stats {
    text-align: right;
    font-size: 0.75rem;
    color: #94a3b8;
}

.progress-stats span:first-child {
    color: #a78bfa;
    font-weight: 600;
}

/* Next Level Info */
.level-next {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    color: #64748b;
}

.level-next i {
    font-size: 0.7rem;
    color: #8b5cf6;
}

/* Level Up Toast */
.level-up-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1e1b2e;
    border-left: 3px solid #fbbf24;
    border-radius: 12px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.level-up-toast-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.level-up-toast-content {
    flex: 1;
}

.level-up-toast-title {
    font-weight: 600;
    color: #fbbf24;
    font-size: 0.85rem;
}

.level-up-toast-message {
    font-size: 0.75rem;
    color: #cbd5e1;
}

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

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

/* XP Popup Toast */
.xp-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: min(340px, calc(100vw - 48px));
    background: rgba(15, 13, 28, 0.96);
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.28s ease, opacity 0.28s ease;
    z-index: 11000;
}

.xp-popup.enter {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.xp-popup.exit {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
}

.xp-popup-inner {
    display: grid;
    grid-template-columns: 72px auto;
    gap: 14px;
    padding: 16px;
}

.xp-cover {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.06);
}

.xp-info {
    display: grid;
    gap: 6px;
}

.xp-amount {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.xp-title {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.3;
}

.xp-meta {
    font-size: 0.75rem;
    color: #94a3b8;
}

.xp-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}

.xp-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
    transition: width 0.5s ease;
}

/* =============================================
   XP POPUP WITH TOTAL XP DISPLAY
   ============================================= */

/* Progress container - wraps bar and XP stats */
.xp-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

/* Update existing xp-bar */
.xp-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

/* Keep existing xp-fill */
.xp-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* XP Stats container */
.xp-stats {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: rgba(139, 92, 246, 0.12);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Current XP number */
.xp-current {
    color: #c4b5fd;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Inter', monospace;
}

/* Separator */
.xp-separator {
    color: #64748b;
    font-weight: 500;
}

/* Next level XP requirement */
.xp-next {
    color: #94a3b8;
    font-weight: 500;
    font-family: 'Inter', monospace;
}

/* XP Label */
.xp-label {
    color: #8b5cf6;
    font-size: 0.65rem;
    font-weight: 500;
    margin-left: 2px;
}

/* Animation when XP updates */
@keyframes xpNumberPulse {
    0% {
        transform: scale(1);
        color: #c4b5fd;
    }
    50% {
        transform: scale(1.1);
        color: #e9d5ff;
        text-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    }
    100% {
        transform: scale(1);
        color: #c4b5fd;
    }
}

.xp-current.xp-updated {
    animation: xpNumberPulse 0.4s ease;
}

/* Upgraded Settings Card tweaks */
.settings-level-card .level-badge-image {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(99,102,241,0.12));
    display:flex;
    align-items:center;
    justify-content:center;
    color: #fff;
    font-size: 18px;
    margin-right: 10px;
}

.settings-level-card .level-title-wrap .level-title {
    font-size: 0.95rem;
    font-weight:700;
    color: #e6e9f2;
}
.settings-level-card .level-title-wrap .level-subtitle {
    font-size: 0.72rem;
    color: #9aa7c7;
}

.settings-level-card .progress-row {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}

.settings-level-card .progress-percent {
    font-size: 0.82rem;
    color: #aab8d6;
    min-width:48px;
    text-align:right;
}

.settings-level-card .xp-delta {
    margin-top:8px;
    display:inline-block;
    padding:6px 10px;
    background: rgba(34,197,94,0.12);
    color: #9be9a8;
    border-radius: 999px;
    font-weight:700;
    font-size:0.85rem;
    box-shadow: 0 6px 18px rgba(34,197,94,0.06);
    transform-origin: right center;
    transition: transform 0.28s ease, opacity 0.3s ease;
}

.settings-level-card .xp-delta.show {
    display:inline-block;
    transform: translateY(-4px) scale(1.02);
    opacity: 1;
}

.settings-level-card .level-actions .btn.small {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.04);
    color: #cbd5e1;
    padding:6px 10px;
    border-radius:10px;
    font-size:0.8rem;
}

/* ============================================
   XP QUEUE STATUS CARD - SETTINGS PAGE
   ============================================ */

.queue-status-card {
    background: rgba(139, 92, 246, 0.06);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.queue-status-card h3 {
    margin-bottom: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.queue-stat-item {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    border-radius: 16px;
    text-align: center;
}

.queue-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.queue-value {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.queue-max {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.queue-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.queue-progress .progress-track {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.queue-progress .progress-fill {
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.queue-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
    min-width: 45px;
    text-align: right;
}

.queue-message {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(139, 92, 246, 0.08);
}

.queue-message i {
    font-size: 0.9rem;
}

.queue-message.has-queue {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.queue-message.has-queue i {
    color: #fbbf24;
}

/* Animation for queue updates */
@keyframes queuePulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.6; transform: scale(1); }
}

.queue-value.updated {
    animation: queuePulse 0.4s ease;
}