/**
 * Achievement Gamification Styles
 * 成就系统游戏化样式
 */

/* ===== NOTIFICATION CONTAINER ===== */
.achievement-notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .achievement-notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== ACHIEVEMENT NOTIFICATION ===== */
.achievement-notification {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: all;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.achievement-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Notification types */
.achievement-notification.unlock {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.achievement-notification.hint {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.achievement-notification.level-up {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Level-based colors */
.achievement-notification.level-micro {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.achievement-notification.level-basic {
    background: linear-gradient(135deg, #96e6a1 0%, #d4fc79 100%);
}

.achievement-notification.level-intermediate {
    background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
}

.achievement-notification.level-advanced {
    background: linear-gradient(135deg, #fdcbf1 0%, #ffd6a5 100%);
}

.achievement-notification.level-master {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    box-shadow: 0 8px 32px rgba(252, 182, 159, 0.5);
}

/* Shine effect on unlock */
.achievement-notification.unlock::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Notification icon */
.notification-icon {
    font-size: 40px;
    flex-shrink: 0;
    line-height: 1;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Notification content */
.notification-content {
    flex: 1;
    color: white;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-achievement-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}

.notification-description {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.notification-xp {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: inline-block;
}

/* Close button */
.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ===== CONFETTI ANIMATION ===== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall 3s linear forwards;
    pointer-events: none;
}

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

/* ===== XP AND LEVEL DISPLAY ===== */
.xp-level-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 12px 20px;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin: 10px 0;
}

.xp-level-number {
    font-size: 24px;
    font-weight: bold;
}

.xp-level-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xp-progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-top: 8px;
}

.xp-progress-fill {
    background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

.xp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shine 2s infinite;
}

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

/* ===== STREAK DISPLAY ===== */
.streak-display {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    padding: 16px;
    color: white;
    text-align: center;
    box-shadow: 0 4px 16px rgba(240, 147, 251, 0.3);
}

.streak-flame {
    font-size: 48px;
    margin-bottom: 8px;
    animation: flame-flicker 1s infinite alternate;
}

@keyframes flame-flicker {
    0% {
        transform: scale(1) rotate(-2deg);
        filter: brightness(1);
    }
    100% {
        transform: scale(1.1) rotate(2deg);
        filter: brightness(1.2);
    }
}

.streak-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 4px;
}

.streak-label {
    font-size: 14px;
    opacity: 0.9;
}

/* ===== ACHIEVEMENT HINTS ===== */
.achievement-hints {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.achievement-hints-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.achievement-hint-item {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.achievement-hint-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.achievement-hint-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.achievement-hint-emoji {
    font-size: 24px;
}

.achievement-hint-name {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.achievement-hint-progress-percent {
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
}

.achievement-hint-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.achievement-hint-progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 6px;
    overflow: hidden;
}

.achievement-hint-progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease-out;
}

/* ===== ACHIEVEMENT STATS CARDS ===== */
.gamification-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    color: white;
    text-align: center;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.stat-card-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Different card colors */
.stat-card.xp {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.streak {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-card.level {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.achievements {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* ===== ACHIEVEMENT WALL ===== */
.achievement-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    padding: 20px;
}

.achievement-wall-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.achievement-wall-item.unlocked {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border: 2px solid #4CAF50;
}

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

.achievement-wall-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.achievement-wall-emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.achievement-wall-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.achievement-wall-level {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 600;
}

/* Lock icon for locked achievements */
.achievement-wall-item.locked .achievement-wall-emoji::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
}

/* ===== SETTINGS TOGGLES ===== */
.gamification-settings {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.gamification-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.gamification-setting-item:last-child {
    border-bottom: none;
}

.gamification-setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gamification-setting-icon {
    font-size: 24px;
}

.gamification-setting-text {
    display: flex;
    flex-direction: column;
}

.gamification-setting-name {
    font-weight: 600;
    color: #333;
}

.gamification-setting-description {
    font-size: 12px;
    color: #666;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .achievement-notification {
        padding: 12px;
        gap: 10px;
    }
    
    .notification-icon {
        font-size: 32px;
    }
    
    .notification-achievement-name {
        font-size: 16px;
    }
    
    .notification-description {
        font-size: 12px;
    }
    
    .gamification-stats {
        grid-template-columns: 1fr;
    }
    
    .achievement-wall {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
        padding: 12px;
    }
    
    .achievement-wall-emoji {
        font-size: 36px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

.pulse-animation {
    animation: pulse 1s infinite;
}

.glow-animation {
    animation: glow 2s infinite;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .achievement-notification,
    .confetti,
    .notification-icon,
    .xp-progress-fill,
    .streak-flame,
    .achievement-wall-item,
    .stat-card {
        animation: none !important;
        transition: none !important;
    }
}
