/* ═══════════════════════════════════════════════════════════
   HOME TAB — Stitch Design (Based on Coby Care Reference)
   CSS-only overrides matching Google Stitch output
   ═══════════════════════════════════════════════════════════ */

/* ── App Logo — Coby + Gradient Text (Option D) ── */
.app-logo-gradient {
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: -0.8px !important;
    background: linear-gradient(135deg, #1E8F85, #2DA89B, #5CC9B8) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Progress Hero Circle (Stitch Key Component) ── */
.stitch-progress-hero {
    position: relative;
    overflow: hidden;
    background: #f4f4f1;
    border-radius: 24px;
    margin-top: 20px;
    padding: 24px 20px;
    display: none; /* 서클 제거 — Stitch 레퍼런스와 맞지 않음 */
}
[data-theme="dark"] .stitch-progress-hero {
    background: var(--ap-surface-1);
}
.stitch-progress-hero__wave {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 140%, rgba(13,115,119,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 130%, rgba(13,115,119,0.05) 0%, transparent 50%);
    pointer-events: none;
}
.stitch-progress-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.stitch-progress-hero__ring {
    position: relative;
    width: 140px;
    height: 140px;
}
.stitch-progress-hero__ring svg {
    width: 100%;
    height: 100%;
}
.stitch-progress-hero__pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    color: var(--ap-text);
    letter-spacing: -1px;
}
.stitch-progress-hero__msg {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ap-text-muted);
}

/* ── Hero Section — Bold Phase Display ── */
#homeHero {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 8px 0 0 !important;
    box-shadow: none !important;
    margin-bottom: 24px !important;
}
#homeGreeting {
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    color: #2DA89B !important;
}
#homeUserName {
    font-size: 32px !important;
    font-weight: 900 !important;
    letter-spacing: -1px !important;
    color: var(--ap-text) !important;
    line-height: 1.1 !important;
    margin-top: 4px !important;
}
#homeDayBig {
    font-size: 28px !important;
    font-weight: 900 !important;
    color: #2DA89B !important;
    -webkit-text-fill-color: #2DA89B !important;
    background: none !important;
    letter-spacing: -1px !important;
}

/* ── Journey Bar — Stitch Progress Card ── */
#homeJourneyBar {
    background: #f4f4f1 !important;
    border-radius: 24px !important;
    padding: 20px !important;
    box-shadow: none !important;
    margin-top: 20px !important;
    border: none !important;
    position: relative !important;
    overflow: hidden !important;
}
/* Subtle wave background effect */
#homeJourneyBar::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: radial-gradient(ellipse at 70% 120%, rgba(13,115,119,0.06) 0%, transparent 60%) !important;
    pointer-events: none !important;
}
#homeJourneyFill {
    background: linear-gradient(90deg, #1E8F85, #2DA89B, #4DB8A4) !important;
    border-radius: 4px !important;
    height: 8px !important;
}
#homePhaseIcon {
    width: 48px !important;
    height: 48px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #2DA89B, #1E8F85) !important;
    border-radius: 50% !important;
    font-size: 22px !important;
    box-shadow: 0 4px 16px rgba(13,115,119,0.2) !important;
    filter: grayscale(0) !important;
}
#homePhaseName {
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: -0.3px !important;
}
#homePhaseDesc {
    font-size: 15px !important;
    color: var(--ap-text-muted) !important;
    margin-top: 2px !important;
}

/* ── Coach Box — Soft Teal (Healing Teal 톤앤매너 통일) ── */
#homeCoachingBox {
    background: #E5F5F2 !important;
    border-radius: 24px !important;
    border: none !important;
    border-left: 4px solid #2DA89B !important;
    padding: 22px !important;
    margin-top: 20px !important;
    box-shadow: 0 2px 12px rgba(13,115,119,0.06) !important;
}
[data-theme="dark"] #homeCoachingBox {
    background: #0a2e30 !important;
    border-left-color: #3DBCC0 !important;
    box-shadow: none !important;
}
#homeCoachingBox img[alt="코비"] {
    width: 40px !important;
    height: 40px !important;
    border-radius: 0 !important;
    background: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}
#homePhaseMsg {
    font-size: 16px !important;
    line-height: 1.8 !important;
    color: #1E8F85 !important;
}
[data-theme="dark"] #homePhaseMsg {
    color: #a2f5f9 !important;
}

/* ── Coach expand/collapse (managed by coach.js) ── */
#homeCoachingBox {
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
    overflow: hidden !important;
}
/* display is controlled by coach.js (none → flex on confirm) */
#coachExpandBtn[style*="display: flex"],
#coachExpandBtn[style*="display:flex"] {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: rgba(13,115,119,0.08) !important;
    border: none !important;
    font-size: 14px !important;
    color: #2DA89B !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s !important;
}
#coachExpandBtn:active {
    transform: scale(0.9) !important;
}
#coachFadeOverlay {
    background: linear-gradient(transparent, #E5F5F2) !important;
    height: 50px !important;
}
[data-theme="dark"] #coachFadeOverlay {
    background: linear-gradient(transparent, #0a2e30) !important;
}

/* ── Confirm Button — On salmon bg ── */
#coachConfirmBtn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 14px !important;
    background: rgba(255,255,255,0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    color: #1E8F85 !important;
    border: none !important;
    border-radius: 16px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: transform 0.2s, background 0.2s !important;
}
#coachConfirmBtn:active {
    transform: scale(0.96) !important;
    background: rgba(255,255,255,0.85) !important;
}
#coachConfirmBox {
    text-align: center !important;
    margin-top: 16px !important;
}

/* ── Daily Quote Widget ── */
.daily-quote-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f4f4f1;
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
[data-theme="dark"] .daily-quote-card {
    background: var(--ap-surface-1);
}
.daily-quote-icon {
    width: 32px; height: 32px;
    background: rgba(45,168,155,0.06);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.daily-quote-icon .material-symbols-outlined {
    font-size: 16px !important;
}
.daily-quote-category {
    display: none; /* 카테고리 라벨 숨김 — 색상/아이콘으로 충분 */
}
.daily-quote-text {
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: var(--ap-text-muted, #8A9199) !important;
    font-weight: 400 !important;
    font-style: italic !important;
    margin: 0 !important;
}

/* ── Exercise CTA — White Card (Stitch Bento Style) ── */
#homePrimaryCard {
    background: #fff !important;
    border-radius: 24px !important;
    padding: 24px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04) !important;
    color: var(--ap-text) !important;
    position: relative !important;
    overflow: visible !important;
    min-height: 160px !important;
}
[data-theme="dark"] #homePrimaryCard {
    background: var(--ap-surface-1) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2) !important;
}
#homePrimaryLabel {
    color: var(--ap-text-muted) !important;
    font-size: 15px !important;
}
#homePrimaryTitle {
    color: var(--ap-text) !important;
    font-size: 22px !important;
    font-weight: 900 !important;
    letter-spacing: -0.5px !important;
}
#homePrimaryDesc {
    color: var(--ap-text-secondary) !important;
    font-size: 14px !important;
}
/* Condition badge on white card */
#homeConditionBadge {
    background: #fd8269 !important;
    color: #fff !important;
}

/* Exercise list toggle — teal on white */
#homePrimaryCard > div[onclick*="toggleHomeExerciseList"] {
    background: #f4f4f1 !important;
    border-radius: 14px !important;
    color: var(--ap-text) !important;
}
#homePrimaryCard > div[onclick*="toggleHomeExerciseList"] span {
    color: var(--ap-text-secondary) !important;
}

/* Start button — Full gradient CTA (Stitch key element) */
#homePrimaryBtn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 18px !important;
    background: linear-gradient(135deg, #1E8F85, #2DA89B) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 20px !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    box-shadow: 0 8px 24px rgba(13,115,119,0.25) !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    letter-spacing: -0.3px !important;
}
#homePrimaryBtn:active {
    transform: scale(0.97) !important;
    box-shadow: 0 4px 12px rgba(13,115,119,0.15) !important;
}
#homePrimaryTime { display: none !important; }

/* Exercise list items — fix white-on-white text */
#homePrimaryCard * {
    color: var(--ap-text) !important;
}
#homePrimaryCard #homePrimaryDesc,
#homePrimaryCard span[style*="color:rgba(255,255,255"] {
    color: var(--ap-text-secondary) !important;
}
#homePrimaryCard #homePrimaryLabel {
    color: var(--ap-text-muted) !important;
}
/* Exercise list expanded items */
#homeExListBody div {
    background: #f4f4f1 !important;
    color: var(--ap-text) !important;
    border-radius: 14px !important;
    margin-bottom: 6px !important;
}
#homeExListBody div span,
#homeExListBody div div {
    color: var(--ap-text) !important;
}
#homeExListBody div small,
#homeExListBody div [style*="opacity"] {
    color: var(--ap-text-muted) !important;
}
/* Start button stays teal */
#homePrimaryBtn {
    color: #fff !important;
}
#homePrimaryBtn * {
    color: #fff !important;
}

/* ── Learning Card — Surface Card (match Stitch) ── */
#homeLearningCard {
    background: #f4f4f1 !important;
    border-radius: 24px !important;
    padding: 22px !important;
    margin-bottom: 16px !important;
    box-shadow: none !important;
    color: var(--ap-text) !important;
}
[data-theme="dark"] #homeLearningCard {
    background: var(--ap-surface-1) !important;
}
#homeLearningCard > div:first-child > div {
    color: var(--ap-text) !important;
    font-weight: 800 !important;
}
#homeLearningCard > div:first-child > span {
    color: var(--ap-text-muted) !important;
}
/* Learning list items — white cards */
#homeLearningList > div {
    background: #fff !important;
    border-radius: 16px !important;
    color: var(--ap-text) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    padding: 14px 16px !important;
}
[data-theme="dark"] #homeLearningList > div {
    background: var(--ap-surface-2) !important;
}
#homeLearningList > div span[style*="font-size:18px"],
#homeLearningList > div span[style*="font-size:14px"],
#homeLearningList > div span[style*="font-size:12px"] {
    color: var(--ap-text) !important;
}
#homeLearningList > div div[style*="font-weight:700"],
#homeLearningList > div div[style*="font-weight: 700"],
#homeLearningList > div div[style*="font-weight:600"],
#homeLearningList > div div[style*="font-weight: 600"] {
    color: var(--ap-text) !important;
}
/* Learning card text uses CSS variables now — no white text override needed */

/* ── Recovery Ring Card ── */
.recovery-ring-card {
    background: #fff !important;
    border-radius: 24px !important;
    padding: 24px 20px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04) !important;
    border: none !important;
}
[data-theme="dark"] .recovery-ring-card {
    background: var(--ap-surface-1) !important;
}
.recovery-score-value {
    font-size: 40px !important;
    font-weight: 900 !important;
    letter-spacing: -1.5px !important;
}
.recovery-metric {
    background: #f4f4f1 !important;
    border-radius: 14px !important;
    padding: 10px 18px !important;
    border: none !important;
}
[data-theme="dark"] .recovery-metric {
    background: var(--ap-surface-2) !important;
}

/* ── Coach Card (hidden old version) ── */
.coach-msg-card {
    background: #E5F5F2 !important;
    border-radius: 24px !important;
    padding: 22px !important;
    box-shadow: 0 2px 12px rgba(13,115,119,0.06) !important;
    border: none !important;
    color: #1E8F85 !important;
}
.coach-msg-card::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 4px !important;
    background: linear-gradient(180deg, #2DA89B, #4DB8A4) !important;
    border-radius: 4px 0 0 4px !important;
    display: block !important;
}
.coach-msg-card .coach-body {
    background: rgba(255,255,255,0.5) !important;
    border-radius: 16px !important;
    padding: 16px 18px !important;
    color: #1E8F85 !important;
}
.coach-msg-card .coach-label {
    color: #1E8F85 !important;
}
.coach-msg-card .coach-sublabel {
    color: #2DA89B !important;
}
.coach-msg-card .coach-btn {
    background: rgba(255,255,255,0.6) !important;
    color: #1E8F85 !important;
    border: none !important;
    border-radius: 16px !important;
    backdrop-filter: blur(8px) !important;
}

/* ── Condition Buttons — Clean, no border ── */
.condition-btn {
    border: none !important;
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 14px 0 !important;
}
[data-theme="dark"] .condition-btn {
    background: var(--ap-surface-2) !important;
}
.condition-btn:active {
    transform: scale(0.95) !important;
}

/* ── Tab Bar — Frosted Glass (Stitch BottomNav) ── */
.tab-bar {
    background: rgba(249,249,246,0.8) !important;
    backdrop-filter: blur(40px) !important;
    -webkit-backdrop-filter: blur(40px) !important;
    border-top: none !important;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.04) !important;
    border-radius: 32px 32px 0 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 8px) !important;
}
[data-theme="dark"] .tab-bar {
    background: rgba(18,31,34,0.8) !important;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.3) !important;
}
.tab-item {
    border-radius: 20px !important;
    padding: 8px 16px !important;
    transition: all 0.2s ease !important;
}
.tab-item.active {
    background: rgba(13,115,119,0.1) !important;
    color: #2DA89B !important;
    font-weight: 700 !important;
}

/* ── XP Bar ── */
#xpBarContainer, .xp-bar-container {
    background: #fff !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.03) !important;
    margin-bottom: 20px !important;
    border: none !important;
}
[data-theme="dark"] #xpBarContainer,
[data-theme="dark"] .xp-bar-container {
    background: var(--ap-surface-1) !important;
}

/* ── Header (리커버리24) ── */
.action-plan-container > div:first-child,
#pName {
    font-weight: 900 !important;
    letter-spacing: -0.5px !important;
}

/* ── Stagger Animation ── */
#tabHome > div {
    opacity: 0;
    transform: translateY(20px);
    animation: stitchEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
#tabHome > div:nth-child(1) { animation-delay: 0ms; }
#tabHome > div:nth-child(2) { animation-delay: 100ms; }
#tabHome > div:nth-child(3) { animation-delay: 200ms; }
#tabHome > div:nth-child(4) { animation-delay: 300ms; }
#tabHome > div:nth-child(5) { animation-delay: 400ms; }
#tabHome > div:nth-child(6) { animation-delay: 500ms; }
#tabHome > div:nth-child(7) { animation-delay: 600ms; }
#tabHome > div:nth-child(8) { animation-delay: 700ms; }
#tabHome > div:nth-child(9) { animation-delay: 800ms; }

@keyframes stitchEnter {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Overall spacing ── */
#tabHome {
    padding-bottom: 120px !important;
}
