/* JW FC Tracker 프론트엔드 스타일
 * 접두사: .jwfct- (FC 충돌 방지)
 * 대상: 20-60대 여성, 모바일 우선
 */

/* ── 히트맵 래퍼 ─────────────────────────────── */
.jwfct-heatmap-wrap {
    margin: 20px 0;
    background: var(--fcom-card-bg, #fff);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.jwfct-heatmap-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fcom-text-color, #374151);
    margin: 0 0 12px;
}

.jwfct-heatmap-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* SVG 히트맵 */
.jwfct-heatmap-svg {
    display: block;
    min-width: 640px;
}

/* 범례 */
.jwfct-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 11px;
    color: #9ca3af;
    justify-content: flex-end;
}

.jwfct-legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* 툴팁 */
.jwfct-tooltip {
    position: fixed;
    background: rgba(17,24,39,.9);
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 99999;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .15s;
}

.jwfct-tooltip.is-visible {
    opacity: 1;
}

/* ── 챌린지 트래커 래퍼 ───────────────────────── */
.jwfct-challenge-section {
    margin: 16px 0;
}

.jwfct-challenge-card {
    background: var(--fcom-card-bg, #fff);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.jwfct-challenge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 6px;
}

.jwfct-challenge-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--fcom-text-color, #374151);
    margin: 0;
}

.jwfct-badge-complete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #E91E63, #F48FB1);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: .3px;
}

/* 아이콘 그리드 */
.jwfct-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.jwfct-icon-cell {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    border-radius: 3px;
    cursor: default;
    transition: transform .1s;
    flex-shrink: 0;
}

.jwfct-icon-cell:hover {
    transform: scale(1.2);
}

/* 아이콘 색 농도 (data-level) */
.jwfct-icon-cell[data-level="0"] { opacity: .15; }
.jwfct-icon-cell[data-level="1"] { opacity: .4; }
.jwfct-icon-cell[data-level="2"] { opacity: .65; }
.jwfct-icon-cell[data-level="3"] { opacity: .82; }
.jwfct-icon-cell[data-level="4"] { opacity: 1; }

/* 미래(빈) 칸 */
.jwfct-icon-cell.is-future {
    opacity: .08;
    cursor: default;
}

/* 진행률 바 */
.jwfct-progress-wrap {
    margin-top: 6px;
}

.jwfct-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.jwfct-progress-bar-bg {
    background: #f3f4f6;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.jwfct-progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: #E91E63;
    transition: width .4s ease;
}

/* 필터 탭 */
.jwfct-filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.jwfct-filter-tab {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.jwfct-filter-tab:hover {
    border-color: #E91E63;
    color: #E91E63;
}

.jwfct-filter-tab.is-active {
    background: #E91E63;
    border-color: #E91E63;
    color: #fff;
}

/* 로딩 / 에러 */
.jwfct-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #f3f4f6;
    border-top-color: #E91E63;
    border-radius: 50%;
    animation: jwfct-spin .6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes jwfct-spin {
    to { transform: rotate(360deg); }
}

.jwfct-loading-text {
    font-size: 13px;
    color: #9ca3af;
    padding: 12px 0;
}

.jwfct-empty-text {
    font-size: 13px;
    color: #9ca3af;
    padding: 8px 0;
}

/* ── 다크모드 ─────────────────────────────────── */
html.dark .jwfct-heatmap-wrap,
html.dark .jwfct-challenge-card {
    background: #555555;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

html.dark .jwfct-heatmap-title,
html.dark .jwfct-challenge-name {
    color: #CFD3DC;
}

html.dark .jwfct-progress-label {
    color: #A3A6AD;
}

html.dark .jwfct-progress-bar-bg {
    background: #303030;
}

html.dark .jwfct-filter-tab {
    background: #303030;
    border-color: #424243;
    color: #9ca3af;
}

html.dark .jwfct-filter-tab:hover {
    border-color: #E91E63;
    color: #E91E63;
}

html.dark .jwfct-filter-tab.is-active {
    background: #E91E63;
    border-color: #E91E63;
    color: #fff;
}

/* 반응형 */
@media (max-width: 600px) {
    .jwfct-heatmap-wrap,
    .jwfct-challenge-card {
        padding: 12px;
        border-radius: 8px;
    }

    .jwfct-icon-cell {
        width: 17px;
        height: 17px;
        font-size: 13px;
    }

    .jwfct-icon-grid {
        gap: 3px;
    }
}
