/* CatsEye 게이미피케이션 스타일 */

/* ===== 스켈레톤 UI ===== */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* 레벨 위젯 스켈레톤 - 심플 프로그레스 바 */
.level-widget-skeleton {
    width: 70px;
    height: 32px;
    border-radius: 16px;
    background: linear-gradient(90deg, #E8E8E8 0%, #F5F5F5 50%, #E8E8E8 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton .skeleton-icon-sm,
.skeleton .skeleton-text,
.skeleton .skeleton-bar,
.skeleton .skeleton-badge {
    background: linear-gradient(90deg, #E5E5E7 25%, #F5F5F7 50%, #E5E5E7 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* 프로필 페이지 스켈레톤 */
.profile-gamification.skeleton {
    pointer-events: none;
}

.profile-gamification.skeleton .skeleton-icon-sm {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.profile-gamification.skeleton .skeleton-level-text {
    width: 80px;
    height: 14px;
}

.profile-gamification.skeleton .skeleton-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.profile-gamification.skeleton .profile-level {
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-gamification.skeleton .profile-badges {
    display: flex;
    gap: 4px;
}

/* ===== XP 획득 팝업 ===== */
.xp-popup {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.xp-popup.show {
    opacity: 1;
    transform: translateX(0);
}

.xp-popup-content {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: #fff;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.xp-amount {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.xp-reason {
    font-size: 13px;
    opacity: 0.9;
}

/* ===== 레벨업 모달 ===== */
.levelup-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.levelup-modal.show {
    opacity: 1;
}

.levelup-modal-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.levelup-modal-content {
    background: linear-gradient(180deg, #1D1D1F 0%, #2D2D30 100%);
    border-radius: 32px;
    padding: 48px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    position: relative;
    overflow: hidden;
    animation: levelupBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes levelupBounce {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.levelup-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    border-radius: 2px;
    animation: confettiFall 2s ease-out forwards;
}

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

.levelup-icon {
    font-size: 80px;
    margin-bottom: 16px;
    animation: iconPulse 1s ease infinite;
}

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

.levelup-modal-content h2 {
    color: #FFD700;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 20px rgba(255, 215, 0, 0.5);
}

.levelup-level {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.levelup-title {
    color: #86868B;
    font-size: 18px;
    margin-bottom: 32px;
}

/* ===== 출석 모달 ===== */
.attendance-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.attendance-modal.show {
    opacity: 1;
}

.attendance-modal-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.attendance-modal-content {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.attendance-modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1D1D1F;
    margin-bottom: 16px;
}

.attendance-xp {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.attendance-xp .xp-earned {
    font-size: 32px;
    font-weight: 800;
    color: #007AFF;
}

.attendance-xp .bonus-xp {
    font-size: 18px;
    font-weight: 600;
    color: #FF9500;
}

.streak-info {
    font-size: 15px;
    color: #34C759;
    font-weight: 600;
    margin-bottom: 20px;
}

.attendance-calendar {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.attendance-day {
    width: 40px;
    height: 50px;
    border-radius: 12px;
    background: #F5F5F7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.attendance-day.checked {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: #fff;
}

.attendance-day.today {
    border: 2px solid #007AFF;
}

.attendance-day .day-name {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.7;
}

.attendance-day .day-icon {
    font-size: 16px;
    font-weight: 700;
}

/* ===== 뱃지 토스트 ===== */
.badge-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.badge-toast-content {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1D1D1F;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(255, 165, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-toast .badge-icon {
    font-size: 32px;
}

.badge-toast .badge-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.badge-toast .badge-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.8;
}

.badge-toast .badge-name {
    font-size: 16px;
    font-weight: 700;
}

/* ===== 레벨 위젯 (네비게이션) ===== */
.level-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--accent-light, rgba(0, 122, 255, 0.1));
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.level-widget:hover {
    background: var(--accent-light, rgba(0, 122, 255, 0.2));
    transform: scale(1.02);
}

.level-widget .level-icon {
    font-size: 20px;
}

.level-widget .level-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.level-widget .level-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
}

.xp-progress-mini {
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.xp-progress-mini .xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #5856D6);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ===== 통계 모달 ===== */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-modal.show {
    opacity: 1;
}

.stats-modal-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.stats-modal-content {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

.stats-modal-content .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F5F5F7;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868B;
    transition: all 0.2s;
}

.stats-modal-content .modal-close:hover {
    background: #E5E5E7;
    color: #1D1D1F;
}

/* 모바일: 단일 컬럼 */
.stats-body {
    display: block;
}

/* PC 2컬럼 레이아웃 */
@media (min-width: 900px) {
    .stats-modal-content {
        max-width: 900px;
        padding: 40px;
    }

    .stats-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .stats-left,
    .stats-right {
        min-width: 0;
    }

    .stats-left {
        border-right: 1px solid #E5E5E7;
        padding-right: 40px;
    }

    .stats-right {
        padding-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .missions-section {
        margin-bottom: 0;
    }

    .missions-list {
        max-height: none;
    }

    .level-big-icon {
        font-size: 64px;
    }

    .stats-header {
        margin-bottom: 32px;
    }

    .level-title {
        font-size: 22px;
    }

    .stats-rank .rank-num {
        font-size: 32px;
    }

    .total-xp {
        font-size: 36px;
    }
}

/* 섹션 타이틀 */
.stats-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #007AFF;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.stats-level-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-big-icon {
    font-size: 56px;
}

.level-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.level-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
}

.level-num {
    font-size: 14px;
    color: #86868B;
}

.stats-rank {
    text-align: right;
}

.stats-rank .rank-label {
    display: block;
    font-size: 12px;
    color: #86868B;
    margin-bottom: 4px;
}

.stats-rank .rank-num {
    font-size: 24px;
    font-weight: 800;
    color: #007AFF;
}

.stats-xp-section {
    margin-bottom: 24px;
}

.xp-display {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.total-xp {
    font-size: 28px;
    font-weight: 800;
    color: #1D1D1F;
}

.xp-to-next {
    font-size: 13px;
    color: #86868B;
}

.max-level {
    font-size: 14px;
    color: #FFD700;
    font-weight: 600;
}

.xp-progress-bar {
    width: 100%;
    height: 8px;
    background: #F5F5F7;
    border-radius: 4px;
    overflow: hidden;
}

.xp-progress-bar .xp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #5856D6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-item {
    background: #F5F5F7;
    padding: 16px;
    border-radius: 16px;
    text-align: center;
}

.stat-item .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1D1D1F;
    margin-bottom: 4px;
}

.stat-item .stat-label {
    font-size: 12px;
    color: #86868B;
}

.badges-section h4,
.recent-xp-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 12px;
}

.badges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #F5F5F7;
    border-radius: 20px;
    cursor: help;
}

.badge-item .badge-icon {
    font-size: 18px;
}

.badge-item .badge-name {
    font-size: 13px;
    font-weight: 500;
    color: #1D1D1F;
}

.no-badges {
    color: #86868B;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.recent-xp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-xp-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #F5F5F7;
    border-radius: 12px;
}

.recent-xp-item .xp-desc {
    font-size: 14px;
    color: #1D1D1F;
}

.recent-xp-item .xp-amount {
    font-size: 14px;
    font-weight: 600;
    color: #007AFF;
}

/* ===== 프로필 페이지 게이미피케이션 ===== */
.profile-gamification {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.profile-level {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-light, rgba(0, 122, 255, 0.1));
    border-radius: 20px;
}

.profile-level .level-icon {
    font-size: 18px;
}

.profile-level .level-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent, #007AFF);
}

.profile-badges {
    display: flex;
    gap: 4px;
}

.profile-badge {
    font-size: 20px;
    cursor: help;
    transition: transform 0.2s;
}

.profile-badge:hover {
    transform: scale(1.2);
}

/* ===== 미션 섹션 ===== */
.missions-section {
    margin-bottom: 24px;
}

.missions-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 12px;
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #F5F5F7;
    border-radius: 16px;
    transition: all 0.2s;
}

.mission-item.can-claim {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border: 2px solid #4CAF50;
}

.mission-item.completed {
    background: #E8E8E8;
    opacity: 0.7;
}

.mission-item.clickable {
    cursor: pointer;
}

.mission-item.clickable:hover {
    background: #E8E8EA;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mission-item.clickable:active {
    transform: translateY(0);
}

.mission-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
    flex-shrink: 0;
}

.mission-info {
    flex: 1;
    min-width: 0;
}

.mission-title {
    font-size: 14px;
    font-weight: 600;
    color: #1D1D1F;
    margin-bottom: 2px;
}

.mission-desc {
    font-size: 12px;
    color: #86868B;
    margin-bottom: 4px;
}

.mission-missing {
    background: #FFF3E0;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-size: 11px;
    line-height: 1.4;
}

.mission-missing .missing-label {
    color: #E65100;
    font-weight: 600;
    margin-right: 4px;
}

.mission-missing .missing-items {
    color: #F57C00;
}

.mission-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007AFF, #5856D6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.mission-item.can-claim .mission-progress-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.mission-progress-text {
    font-size: 11px;
    color: #86868B;
    font-weight: 500;
}

.mission-reward {
    flex-shrink: 0;
}

.mission-reward .xp-badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.mission-reward .btn {
    padding: 8px 16px;
    font-size: 12px;
    animation: pulse 1.5s infinite;
}

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

.mission-check {
    width: 32px;
    height: 32px;
    background: #4CAF50;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.completed-missions {
    margin-top: 16px;
}

.completed-label {
    font-size: 12px;
    color: #86868B;
    margin-bottom: 8px;
    font-weight: 500;
}

.completed-missions .mission-item {
    padding: 12px 16px;
}

.completed-missions .mission-icon {
    width: 32px;
    height: 32px;
    font-size: 20px;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 768px) {
    .xp-popup {
        top: auto;
        bottom: 100px;
        right: 50%;
        transform: translateX(50%) translateY(20px);
    }

    .xp-popup.show {
        transform: translateX(50%) translateY(0);
    }

    .levelup-modal-content {
        padding: 32px 24px;
    }

    .levelup-icon {
        font-size: 60px;
    }

    .levelup-modal-content h2 {
        font-size: 26px;
    }

    .stats-modal-content {
        padding: 24px;
        max-height: 85vh;
    }

    .stats-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .stats-level-display {
        justify-content: center;
    }

    .stats-rank {
        text-align: center;
    }

    .level-widget {
        padding: 4px 10px;
    }

    .level-widget .level-icon {
        font-size: 18px;
    }

    .level-widget .level-number {
        font-size: 11px;
    }

    .xp-progress-mini {
        width: 32px;
    }

    .badge-toast {
        bottom: 80px;
        left: 16px;
        right: 16px;
        transform: translateX(0) translateY(20px);
    }

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

    .badge-toast-content {
        width: 100%;
        justify-content: center;
    }

    .attendance-calendar {
        gap: 4px;
    }

    .attendance-day {
        width: 36px;
        height: 46px;
    }
}
