/* ==============================================
   Growth Journey V2 - 귀여운 카드 그리드 UI
   ============================================== */

/* ── Modal Wrap & Overlay ── */
.gj-modal-wrap {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.gj-modal-wrap.show {
    display: flex;
    animation: gjModalFadeIn 0.3s ease-out;
}

.gj-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: gjOverlayFadeIn 0.3s ease-out;
}

/* ── Modal Container ── */
.gj-modal {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
    animation: gjModalSlideIn 0.3s ease-out;
}

.gj-modal-inner {
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    overflow: hidden;
    height: auto;
}

/* ── Header ── */
.gj-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.gj-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.gj-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.gj-header-icon .lucide-icon {
    width: 24px;
    height: 24px;
    color: #81C784;
}
.gj-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.3;
}
.gj-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0 0;
    line-height: 1.3;
}
.gj-close {
    width: 36px;
    height: 36px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gj-close .lucide-icon {
    width: 20px;
    height: 20px;
}

.gj-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #334155;
}

/* ── Body ── */
.gj-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    overscroll-behavior: contain;
}
.gj-body::-webkit-scrollbar {
    width: 4px;
}
.gj-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* ── Loading ── */
.gj-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 0.875rem;
}
.gj-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #81C784;
    border-radius: 50%;
    animation: gjSpin 0.8s linear infinite;
}
@keyframes gjSpin {
    to { transform: rotate(360deg); }
}

/* ── Modal Animations ── */
@keyframes gjModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gjOverlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

@keyframes gjModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes gjModalSlideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Empty State ── */
.gj-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
}
.gj-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gj-empty-icon .lucide-icon {
    width: 48px;
    height: 48px;
    color: #94a3b8;
}
.gj-empty-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    margin: 0 0 6px 0;
}
.gj-empty-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

/* ── Card Grid ── */
.gj-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Category Card ── */
.gj-category-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 16px 14px 14px;
    border: 1.5px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    opacity: 0;
    transform: translateY(12px);
}
.gj-category-card.gj-card-enter {
    animation: gjCardEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes gjCardEnter {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.gj-category-card:hover {
    border-color: var(--card-accent, #e2e8f0);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--card-accent, #000) 15%, transparent);
    transform: translateY(-2px);
}
.gj-category-card:hover .gj-card-img {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

/* ── Card Visual (이미지/이모지) ── */
.gj-card-visual {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gj-card-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 14px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
    transform: scale(1.35);
    transform-origin: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.gj-card-img:hover {
    transform: scale(1.4);
}
.gj-card-emoji,
.gj-card-emoji-fallback {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.04);
}

/* ── Card Info ── */
.gj-card-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gj-card-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.gj-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.gj-card-level {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

/* ── Progress Bar ── */
.gj-card-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gj-card-progress-track {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.gj-card-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}
.gj-card-progress-text {
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Level Range ── */
.gj-card-level-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    color: #94a3b8;
    padding: 0 2px;
}

/* ── Legacy Card mode (dashboard 상단 띠) ── */
.growth-journey-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
}
.growth-journey-card-image {
    width: 44px;
    height: 44px;
    object-fit: contain;
}
.growth-journey-card-emoji {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.growth-journey-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.growth-journey-card-category {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}
.growth-journey-card-level {
    font-size: 0.75rem;
    font-weight: 600;
}
.growth-journey-card-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #81C784 0%, #66BB6A 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.growth-journey-card-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(129, 199, 132, 0.35);
}
.growth-journey-card-loading,
.growth-journey-card-empty {
    padding: 12px;
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
}

/* ── Dashboard trigger button ── */
.growth-journey-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(129, 199, 132, 0.4);
    background: rgba(129, 199, 132, 0.08);
    color: #4caf50;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.growth-journey-trigger-btn:hover {
    background: rgba(129, 199, 132, 0.16);
    transform: translateY(-1px);
}
.growth-journey-trigger-btn .lucide-icon {
    width: 18px;
    height: 18px;
}

/* ── PC 해상도 최적화 (스크롤 없이 한 화면에 보이도록) ── */
@media (min-width: 521px) {
    .gj-modal {
        max-height: 90vh;
    }
    .gj-modal-inner {
        max-height: 90vh;
    }
    .gj-header {
        padding: 16px 20px 12px;
    }
    .gj-body {
        padding: 12px;
    }
    .gj-grid {
        gap: 10px;
    }
    .gj-category-card {
        padding: 14px 10px 14px;
        gap: 8px;
    }
    .gj-card-visual {
        width: 64px;
        height: 64px;
    }
    .gj-card-img {
        width: 64px;
        height: 64px;
    }
    .gj-card-name {
        font-size: 0.78rem;
    }
    .gj-card-level {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    .gj-card-progress-track {
        height: 5px;
    }
    .gj-card-progress-text {
        font-size: 0.68rem;
        min-width: 28px;
    }
    .gj-card-level-range {
        font-size: 0.6rem;
    }
}

/* ── Mobile Responsive ── */
@media (max-width: 520px) {
    .gj-modal-wrap {
        padding: 10px 10px;
        align-items: flex-end;
        justify-content: center;
    }
    .gj-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 20px);
        height: auto;
        margin: 0;
        border-radius: 12px 12px 0 0;
        display: flex;
        flex-direction: column;
        animation: gjModalSlideUpMobile 0.3s ease-out;
    }
    .gj-modal-inner {
        max-height: calc(100dvh - 20px);
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    .gj-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: none;
    }
    .gj-header {
        padding: 12px 16px 10px;
        flex-shrink: 0;
    }
    .gj-header-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 1.1rem;
    }
    .gj-header-icon .lucide-icon {
        width: 20px;
        height: 20px;
    }
    .gj-title {
        font-size: 1rem;
    }
    .gj-subtitle {
        font-size: 0.75rem;
        margin-top: 2px;
    }
    .gj-body {
        padding: 12px;
        flex: 1;
        min-height: 0;
    }
    .gj-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .gj-category-card {
        padding: 10px 8px 8px;
        border-radius: 14px;
        gap: 8px;
    }
    .gj-card-visual {
        width: 56px;
        height: 56px;
    }
    .gj-card-img {
        width: 56px;
        height: 56px;
        transform: scale(1.35);
        transform-origin: center;
    }
    .gj-card-emoji,
    .gj-card-emoji-fallback {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    .gj-category-card {
        padding: 12px 10px 10px;
        border-radius: 16px;
    }
    .gj-card-name {
        font-size: 0.75rem;
    }
    .gj-card-level {
        font-size: 0.62rem;
        padding: 2px 6px;
    }
    .gj-card-progress-text {
        font-size: 0.62rem;
    }
}

@media (max-width: 360px) {
    .gj-modal {
        max-height: 96vh;
        height: auto;
    }
    .gj-modal-inner {
        max-height: 96vh;
        height: auto;
    }
    .gj-header {
        padding: 10px 14px 8px;
    }
    .gj-body {
        padding: 10px;
    }
    .gj-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .gj-category-card {
        padding: 8px 6px 6px;
        gap: 6px;
    }
    .gj-card-visual {
        width: 48px;
        height: 48px;
    }
    .gj-card-img {
        width: 48px;
        height: 48px;
    }
    /* body, dailylife, identity 카테고리 이미지 확대 (작은 모바일) */
    .gj-category-card[data-slug="body"] .gj-card-img,
    .gj-category-card[data-slug="dailylife"] .gj-card-img,
    .gj-category-card[data-slug="identity"] .gj-card-img {
        transform: scale(1.35);
        transform-origin: center;
    }
    .gj-card-emoji,
    .gj-card-emoji-fallback {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        border-radius: 14px;
    }
}

/* ── Image Lightbox ── */
.gj-image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.gj-image-lightbox.show {
    opacity: 1;
    pointer-events: all;
}
.gj-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.gj-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 1;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.gj-image-lightbox.show .gj-lightbox-content {
    transform: scale(1);
}
.gj-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}
.gj-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}
.gj-lightbox-close .lucide-icon {
    width: 24px;
    height: 24px;
}
.gj-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.05);
}
.gj-lightbox-info {
    color: white;
    font-size: 1rem;
    text-align: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 모바일 라이트박스 */
@media (max-width: 520px) {
    .gj-lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
        padding: 20px;
    }
    .gj-lightbox-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.6);
    }
    .gj-lightbox-close .lucide-icon {
        width: 20px;
        height: 20px;
    }
    .gj-lightbox-image {
        max-height: 70vh;
    }
    .gj-lightbox-info {
        font-size: 0.9rem;
        padding: 10px 16px;
    }
}
