/* ============================================
   OUDIFY — Gamification Styles
   Streak widgets, KP counter, profile, badges, reward toasts
   ============================================ */

/* ============================================
   1. Sidebar Gamification Widgets
   ============================================ */
.sidebar-gamification {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3) 0;
    margin-top: auto;
    border-top: 1px solid var(--border-glass);
    padding-top: var(--space-3);
    flex-shrink: 0;
    overflow: hidden;
}

/* --- Streak Widget --- */
.streak-widget {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: default;
    min-width: 0;
}

.streak-widget:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.streak-widget__flame {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.4));
}

.streak-widget__flame--active {
    animation: flamePulse 1.5s ease-in-out infinite;
}

.streak-widget__info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.streak-widget__count {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.streak-widget__label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.streak-widget__freeze {
    font-size: 9px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* --- KP Counter --- */
.kp-counter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: default;
    min-width: 0;
}

.kp-counter:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.kp-counter__icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(212, 165, 116, 0.4));
}

.kp-counter__value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.kp-counter__label {
    font-size: 9px;
    color: var(--text-muted);
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

/* --- Daily Goal Ring --- */
.daily-ring {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: default;
    min-width: 0;
}

.daily-ring:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.daily-ring__svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transform: rotate(-90deg);
}

.daily-ring__track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}

.daily-ring__progress {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.daily-ring__progress--complete {
    stroke: var(--success);
    filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.4));
}

.daily-ring__info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.daily-ring__text {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daily-ring__sub {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   2. Profile Page
   ============================================ */
.profile-page {
    max-width: 700px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
}

.profile-header__avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(212, 165, 116, 0.05));
    border: 2px solid var(--border-glass-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    box-shadow: 0 0 30px rgba(212, 165, 116, 0.1);
}

.profile-header__info {
    flex: 1;
    min-width: 0;
}

.profile-header__name {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.profile-header__title {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    font-weight: 500;
}

/* --- Stats Row --- */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.profile-stat {
    padding: var(--space-5);
    text-align: center;
}

.profile-stat__icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-2);
    display: block;
}

.profile-stat__value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.profile-stat__label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* --- Level Progress --- */
.level-progress {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.level-progress__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.level-progress__title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.level-progress__remaining {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.level-progress__bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.level-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-gold));
    border-radius: var(--radius-full);
    transition: width 800ms cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.level-progress__fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    border-radius: var(--radius-full);
}

/* --- Weekly Grid --- */
.weekly-grid {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.weekly-grid__title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.weekly-grid__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
}

.weekly-grid__day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all var(--transition-base);
}

.weekly-grid__day--active {
    background: rgba(74, 222, 128, 0.06);
    border-color: rgba(74, 222, 128, 0.15);
}

.weekly-grid__day--today {
    border-color: var(--border-glass-accent);
}

.weekly-grid__day-name {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.weekly-grid__day-status {
    font-size: 1.25rem;
    line-height: 1;
}

.weekly-grid__day-kp {
    font-size: 9px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* --- Badge Collection --- */
.badge-section {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.badge-section__title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.badge-section__count {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.badge-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-3);
}

.badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    transition: all var(--transition-base);
    cursor: default;
    text-align: center;
}

.badge-card--earned {
    border-color: rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.04);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.06);
}

.badge-card--earned:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.1);
}

.badge-card--locked {
    opacity: 0.35;
    filter: grayscale(1);
}

.badge-card--locked:hover {
    opacity: 0.55;
    filter: grayscale(0.5);
}

.badge-card__icon {
    font-size: 1.75rem;
    line-height: 1;
}

.badge-card__name {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
}

.badge-card__desc {
    font-size: 9px;
    line-height: 1.3;
    max-width: 100%;
}

/* --- Profile League --- */
.profile-league {
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
}

.profile-league__header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.profile-league__icon {
    font-size: 2rem;
    line-height: 1;
}

.profile-league__name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
}

.profile-league__hint {
    margin-top: 2px;
}

/* --- Goal Selector --- */
.goal-selector {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.goal-selector__title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.goal-selector__options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.goal-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all var(--transition-base);
}

.goal-option:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.goal-option.active {
    background: rgba(212, 165, 116, 0.08);
    border-color: var(--border-glass-accent);
}

.goal-option__emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.goal-option__info {
    flex: 1;
}

.goal-option__name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.goal-option__desc {
    font-size: 10px;
    color: var(--text-muted);
}

/* ============================================
   3. Reward Toast System
   ============================================ */
.reward-toast {
    position: fixed;
    bottom: calc(var(--space-8) + var(--bottom-bar-height, 0px) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
    z-index: calc(var(--z-toast) + 10);
    opacity: 0;
    pointer-events: none;
    transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.reward-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.reward-toast--kp {
    border-color: rgba(212, 165, 116, 0.3);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(212, 165, 116, 0.1);
}

.reward-toast--badge {
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(251, 191, 36, 0.1);
}

.reward-toast--level {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(139, 92, 246, 0.1);
}

.reward-toast--streak {
    border-color: rgba(251, 146, 60, 0.3);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(251, 146, 60, 0.1);
}

.reward-toast--goal {
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(74, 222, 128, 0.1);
}

.reward-toast__icon {
    font-size: 1.25rem;
    line-height: 1;
}

.reward-toast__text {
    font-weight: 600;
}

.reward-toast__sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 400;
}

/* ============================================
   4. KP Float Animation
   ============================================ */
.kp-float {
    position: fixed;
    pointer-events: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--accent-primary);
    z-index: calc(var(--z-toast) + 20);
    animation: kpFloat 1.2s ease-out forwards;
    text-shadow: 0 0 10px rgba(212, 165, 116, 0.4);
}

@keyframes kpFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

@keyframes flamePulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.4));
    }

    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 12px rgba(251, 146, 60, 0.6));
    }
}

/* ============================================
   5. Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar-gamification {
        display: none;
        /* Handled differently on mobile */
    }

    .profile-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
    }

    .profile-stat {
        padding: var(--space-3);
    }

    .profile-stat__value {
        font-size: var(--text-xl);
    }

    .profile-header {
        padding: var(--space-6);
    }

    .profile-header__avatar {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .badge-gallery {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .goal-selector__options {
        grid-template-columns: 1fr;
    }

    .reward-toast {
        left: var(--space-4);
        right: var(--space-4);
        transform: translateX(0) translateY(100px);
        border-radius: var(--radius-lg);
    }

    .reward-toast.visible {
        transform: translateX(0) translateY(0);
    }
}