/**
 * AIVOCA Gamification Styles
 * Version 2.0
 */

/* ============================================
   GAMIFICATION HEADER BAR (NAVBAR INTEGRATED)
   ============================================ */

.gamification-header-bar {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border-bottom: 1px solid rgba(0, 27, 55, 0.08);
    padding: 6px 0;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 12;
}

.gamification-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1279px;
    margin: 0 auto;
    padding: 0 30px;
}

.gamification-header-bar .gamification-item {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.gamification-header-bar .gam-xp-item {
    flex: 1;
    max-width: 200px;
}

.gamification-header-bar .gamification-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.gamification-header-bar .gamification-item-value {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
}

.xp-progress-mini {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.xp-progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.gamification-quick-links {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.gamification-quick-links a {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f0f1f3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 16px;
}

.gamification-quick-links a:hover {
    background: #667eea;
    color: #fff;
}

/* Adjust navbar_blank height when gamification bar is present */
body.has-gamification-bar .navbar_blank {
    height: 100px;
}

@media (max-width: 768px) {
    .gamification-header-bar {
        padding: 4px 0;
    }

    .gamification-header-inner {
        gap: 8px;
        padding: 0 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gamification-header-inner::-webkit-scrollbar {
        display: none;
    }

    .gamification-header-bar .gamification-item-icon {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .gamification-header-bar .gamification-item-value {
        font-size: 12px;
    }

    .gamification-quick-links a {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .gamification-header-bar .gam-xp-item {
        max-width: 120px;
    }
}

/* ============================================
   GAMIFICATION HEADER BAR (STANDALONE)
   ============================================ */

.gamification-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.gamification-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gamification-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.gamification-item-icon.xp {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gamification-item-icon.streak {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
}

.gamification-item-icon.coins {
    background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
    color: white;
}

.gamification-item-icon.level {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
}

.gamification-item-value {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.gamification-item-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   LEVEL BADGE
   ============================================ */

.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.level-badge.large {
    width: 60px;
    height: 60px;
    font-size: 24px;
}

/* ============================================
   STREAK FLAME
   ============================================ */

.streak-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.streak-icon {
    font-size: 20px;
    color: #ddd;
    transition: color 0.3s, transform 0.3s;
}

.streak-icon.active {
    color: #ff6b6b;
    animation: flame-pulse 1s ease infinite;
}

@keyframes flame-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.streak-count {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

/* ============================================
   XP PROGRESS BAR
   ============================================ */

.xp-progress-container {
    width: 100%;
    max-width: 300px;
}

.xp-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    color: #666;
}

.xp-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ============================================
   DAILY GOAL WIDGET
   ============================================ */

.daily-goal-widget {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.daily-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.daily-goal-title {
    font-weight: bold;
    color: #333;
}

.daily-goal-progress {
    text-align: center;
}

.daily-goal-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(#4ade80 var(--progress, 0%), #e0e0e0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    position: relative;
}

.daily-goal-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
}

.daily-goal-value {
    position: relative;
    z-index: 1;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.daily-goal-text {
    font-size: 14px;
    color: #888;
}

.daily-goal-widget.completed {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
}

.daily-goal-widget.completed .daily-goal-title,
.daily-goal-widget.completed .daily-goal-value,
.daily-goal-widget.completed .daily-goal-text {
    color: white;
}

/* ============================================
   ACHIEVEMENT BADGES
   ============================================ */

.achievement-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 12px;
    background: #f8f9fa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.achievement-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

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

.achievement-badge-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 10px;
}

.achievement-badge-icon.bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: white;
}

.achievement-badge-icon.silver {
    background: linear-gradient(135deg, #c0c0c0, #808080);
    color: white;
}

.achievement-badge-icon.gold {
    background: linear-gradient(135deg, #ffd700, #daa520);
    color: white;
}

.achievement-badge-icon.platinum {
    background: linear-gradient(135deg, #e5e4e2, #a0a0a0);
    color: #333;
}

.achievement-badge-icon.diamond {
    background: linear-gradient(135deg, #b9f2ff, #00bfff);
    color: #333;
}

.achievement-badge-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.achievement-badge-desc {
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* ============================================
   LEADERBOARD
   ============================================ */

.leaderboard {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.leaderboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.leaderboard-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
}

.leaderboard-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.leaderboard-tab.active,
.leaderboard-tab:hover {
    background: white;
    color: #667eea;
}

.leaderboard-list {
    padding: 15px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.leaderboard-item:hover {
    background: #f8f9fa;
}

.leaderboard-item.current-user {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
}

.leaderboard-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
}

.leaderboard-rank.gold {
    background: linear-gradient(135deg, #ffd700, #daa520);
    color: white;
}

.leaderboard-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #808080);
    color: white;
}

.leaderboard-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: white;
}

.leaderboard-user {
    flex: 1;
}

.leaderboard-username {
    font-weight: bold;
    color: #333;
}

.leaderboard-stats {
    font-size: 13px;
    color: #888;
}

.leaderboard-xp {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
}

/* ============================================
   SRS REVIEW CARD
   ============================================ */

.srs-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.srs-card-word {
    padding: 60px 40px;
    text-align: center;
}

.srs-card-english {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.srs-card-korean {
    font-size: 24px;
    color: #666;
}

.srs-card-example {
    font-size: 16px;
    color: #888;
    margin-top: 20px;
    line-height: 1.6;
}

.srs-rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #eee;
}

.srs-rating-btn {
    padding: 20px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.srs-rating-btn:hover {
    background: #f8f9fa;
}

.srs-rating-btn.again {
    color: #ff6b6b;
}

.srs-rating-btn.hard {
    color: #feca57;
}

.srs-rating-btn.good {
    color: #4ade80;
}

.srs-rating-btn.easy {
    color: #54a0ff;
}

.srs-rating-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.srs-rating-interval {
    font-size: 12px;
    opacity: 0.7;
}

/* ============================================
   FORGETTING CURVE CHART
   ============================================ */

.forgetting-curve {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.forgetting-curve-title {
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.forgetting-curve-chart {
    height: 200px;
    position: relative;
}

.forgetting-curve-line {
    stroke: #667eea;
    stroke-width: 3;
    fill: none;
}

.forgetting-curve-fill {
    fill: url(#gradient);
    opacity: 0.2;
}

.review-point {
    fill: #667eea;
    cursor: pointer;
}

.review-point:hover {
    r: 8;
}

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

@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;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

.notification-enter {
    animation: slideInRight 0.3s ease forwards;
}

.notification-exit {
    animation: slideOutRight 0.3s ease forwards;
}

.achievement-unlock-enter {
    animation: bounceIn 0.5s ease forwards;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .gamification-bar {
        flex-wrap: wrap;
        gap: 15px;
    }

    .gamification-item {
        flex: 1 1 40%;
        min-width: 100px;
    }

    .srs-rating-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .srs-card-english {
        font-size: 36px;
    }

    .leaderboard-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .gamification-item {
        flex: 1 1 100%;
    }

    .daily-goal-circle {
        width: 80px;
        height: 80px;
    }

    .daily-goal-circle::before {
        width: 64px;
        height: 64px;
    }
}

/* ============================================
   GAMIFICATION UI ANIMATIONS
   ============================================ */

/* Pulse animation for header items */
@keyframes gam-pulse-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.gam-pulse {
    animation: gam-pulse-anim 0.4s ease-in-out;
}

/* Toast area */
#gam-ui-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100000;
}

#gam-toast-area {
    position: fixed;
    top: 110px;
    right: 20px;
    width: 320px;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

@media (max-width: 480px) {
    #gam-toast-area {
        right: 10px;
        left: 10px;
        width: auto;
        top: 100px;
    }
}

/* Toast base */
.gam-toast {
    background: #fff;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    cursor: default;
}

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

/* Toast types */
.gam-toast-streak {
    border-left: 4px solid #ff6b6b;
    background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.gam-toast-achievement {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #fff 0%, #f5f7ff 100%);
}

/* Toast inner layout for achievements */
.gam-toast-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gam-toast-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.gam-toast-body {
    flex: 1;
    min-width: 0;
}

.gam-toast-title {
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.gam-toast-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gam-toast-reward {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    margin-top: 2px;
}

/* Level-up modal overlay */
.gam-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.gam-modal-content {
    background: #fff;
    border-radius: 24px;
    padding: 40px 36px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
    animation: gam-modal-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gam-modal-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Level-up specific */
.gam-levelup-icon {
    font-size: 56px;
    margin-bottom: 8px;
    animation: gam-bounce 0.6s ease 0.3s both;
}

@keyframes gam-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.gam-levelup-title {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.gam-levelup-levels {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 20px;
}

.gam-old-level {
    color: #999;
    font-weight: 600;
}

.gam-arrow {
    color: #667eea;
    font-size: 24px;
}

.gam-new-level {
    font-weight: 800;
    color: #667eea;
    font-size: 28px;
    animation: gam-bounce 0.5s ease 0.6s both;
}

.gam-levelup-message {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}

.gam-modal-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gam-modal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* Particles */
.gam-levelup-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.gam-particle {
    position: absolute;
    top: -20px;
    font-size: 20px;
    animation: gam-particle-fall linear forwards;
    opacity: 0.8;
}

@keyframes gam-particle-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(400px) rotate(360deg);
        opacity: 0;
    }
}
