/**
 * FIN TOOL - 통합 스타일시트
 * 모든 페이지에서 이 파일 하나만 불러오면 됨
 * 
 * 구조:
 * 1. Design Tokens (변수)
 * 2. Reset & Base
 * 3. Layout
 * 4. Components
 * 5. Navigation
 */

/* ========================================
   1. DESIGN TOKENS
   ======================================== */

:root {
    /* Colors */
    --primary: #0F1F38;
    --primary-bg: #E7EEF6;
    --accent: #B89E5F;
    --text-main: #191F28;
    --text-sub: #8B95A1;
    --text-muted: rgba(20, 20, 20, 0.55);
    --line: rgba(20, 20, 20, 0.08);
    --white: #FFFFFF;
    --bg-base: #FAFAFA;
    --card-bg: rgba(255, 255, 255, 0.95);
    
    /* Shadows - 통일된 1종 */
    --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.06);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    --shadow-nav: 0 -1px 0 var(--line);
    
    /* Border Radius - 통일 */
    --radius-L: 22px;
    --radius-M: 16px;
    --radius-S: 12px;
    
    /* Spacing - 8pt 그리드 */
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    
    /* Layout */
    --max-width: 480px;
    --nav-height: 64px;
}

/* ========================================
   2. RESET & BASE
   ======================================== */

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f5f3ee;
    background-image: url('/assets/images/bg_texture.png'); 
    background-blend-mode: soft-light;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.5;
    letter-spacing: -0.02em;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ========================================
   3. LAYOUT
   ======================================== */

.app {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 20px 100px;
}

/* Safe Area 대응 */
@supports (padding: env(safe-area-inset-bottom)) {
    .app { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}

/* ========================================
   4. COMPONENTS
   ======================================== */

/* --- Header --- */
.header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-bottom: 10px;
}

.logo-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo {
    font-family: 'Nunito', 'Poppins', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.01em;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo-accent {
    color: var(--accent);
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.02em;
}

.logo-sub {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.btn-noti {
    font-size: 24px;
    color: var(--text-main);
}

/* --- Cards (통일된 스타일) --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-L);
    padding: var(--space-4);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-4);
}

.card-m {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-M);
    padding: 18px;
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-3);
}

/* --- Asset Card (총 자산) --- */
.asset-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-L);
    padding: var(--space-4);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-4);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-text {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 500;
}

.amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
}

.amount span {
    font-size: 20px;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    background: #E8F3FF;
    color: #1B64DA;
    border-radius: var(--radius-S);
    font-size: 13px;
    font-weight: 600;
}

/* --- Chart (도넛) --- */
.chart-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
}

.donut {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #E5E7EB;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    /* 애니메이션 초기 상태 - 데이터 로드 전에는 숨김 */
    opacity: 0;
    transform: scale(0.3) rotate(-180deg);
}

.donut::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: var(--white);
    border-radius: 50%;
    z-index: 2;
}

/* 스켈레톤 상태 - 로딩 중에는 보이게 */
.donut.skeleton-donut {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* 애니메이션 활성화 - 회전하며 나타나기 */
.donut.animate {
    animation: donut-reveal 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes donut-reveal {
    0% { 
        transform: scale(0.3) rotate(-180deg); 
        opacity: 0;
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1;
    }
}

.legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    /* 애니메이션은 JS에서 처리 (API 로드 타이밍 때문) */
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 6px;
}

.percent {
    font-weight: 600;
}

/* --- Section Title --- */
.section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin: var(--space-4) 0 var(--space-2);
    padding: 0 2px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.section-title a {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
}

.more {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 400;
    cursor: pointer;
}

/* --- Mission Card (오늘의 학습) --- */
.mission-card {
    background: var(--white);
    border-radius: var(--radius-M);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.mission-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.mission-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mission-row:first-child {
    padding-top: 0;
}

.m-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.m-info p {
    font-size: 13px;
    color: var(--text-sub);
}

/* --- Buttons --- */
.btn-action {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-disabled {
    background: #F2F4F6;
    color: #B0B8C1;
    cursor: not-allowed;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-full {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* --- Portfolio Item --- */
.pf-item {
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: var(--radius-M);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.pf-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 16px;
    flex-shrink: 0;
}

.bg-navy { background: var(--primary-bg); color: var(--primary); }
.bg-gray { background: #F2F4F6; color: #505050; }
.bg-gold { background: #FFF9E8; color: var(--accent); }

.pf-info {
    flex: 1;
}

.pf-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.pf-ticker {
    font-size: 12px;
    color: var(--text-sub);
}

.pf-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* --- Input --- */
.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-S);
    font-size: 16px;
    background: var(--white);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   5. NAVIGATION
   ======================================== */

/* --- Bottom Tab Bar (네이비 스타일) --- */
.nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 440px;
    margin: 0 auto;
    background: var(--primary);
    height: var(--nav-height);
    border-radius: 32px;
    box-shadow: 0 8px 24px rgba(15, 31, 56, 0.25);
    z-index: 100;
}

.nav-inner {
    height: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    text-align: center;
    cursor: pointer;
    padding: 8px 12px;
    transition: color 0.2s;
    text-decoration: none;
}

.nav-item.active {
    color: var(--white);
    font-weight: 600;
}

.nav-item i {
    display: block;
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-item.active i {
    color: var(--accent);
}

/* Safe Area 대응 */
@supports (padding: env(safe-area-inset-bottom)) {
    .nav { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ========================================
   6. UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-sub { color: var(--text-sub); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ========================================
   7. LEARN PAGE COMPONENTS
   ======================================== */

/* --- Streak Badge --- */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.streak-badge i {
    font-size: 16px;
}

/* --- Card Header --- */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-sub {
    font-size: 13px;
    color: var(--text-sub);
}

/* --- Week Progress --- */
.week-progress {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.week-day {
    text-align: center;
}

.day-label {
    display: block;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.day-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F2F4F6;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: transparent;
    transition: all 0.2s;
}

.week-day.completed .day-dot {
    background: #E8F5E9;
    color: #4CAF50;
}

.week-day.today .day-dot {
    border: 2px solid var(--primary);
    background: var(--white);
}

/* --- Study Time --- */
.study-time {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--text-sub);
}

.study-time strong {
    margin-left: auto;
    color: var(--text-main);
}

/* --- Unlock Card --- */
.unlock-card {
    background: var(--white);
    border-radius: var(--radius-M);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: all 0.3s;
}

.unlock-card.unlocked {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border: 2px solid #4CAF50;
}

.unlock-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.unlock-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s;
}

.unlock-icon.locked {
    background: #FFF3E0;
    color: #FF9800;
}

.unlock-icon.unlocked {
    background: #4CAF50;
    color: #fff;
}

.unlock-info {
    flex: 1;
}

.unlock-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.unlock-desc {
    font-size: 13px;
    color: var(--text-sub);
}

.unlock-conditions {
    display: flex;
    gap: 12px;
}

.condition {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #F5F5F5;
    border-radius: var(--radius-S);
    font-size: 13px;
    color: var(--text-sub);
    transition: all 0.2s;
}

.condition.completed {
    background: #E8F5E9;
    color: #4CAF50;
}

.condition-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.condition.completed .condition-check {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

/* --- News Card --- */
.news-card {
    background: var(--white);
    border-radius: var(--radius-M);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    transition: all 0.2s;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.news-card.read {
    opacity: 0.7;
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.news-category {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.news-time {
    font-size: 12px;
    color: var(--text-sub);
}

.news-badges {
    display: flex;
    gap: 4px;
}

.mini-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.mini-badge.read {
    background: #E3F2FD;
    color: #1976D2;
}

.news-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.news-summary {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 16px;
    line-height: 1.5;
}

.news-footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.news-progress {
    flex: 1;
    height: 4px;
    background: #F2F4F6;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

/* --- Quiz Card --- */
.quiz-card {
    background: linear-gradient(135deg, var(--primary) 0%, #1A2F50 100%);
    border-radius: var(--radius-L);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    color: #fff;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.quiz-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
}

.quiz-reward {
    font-size: 12px;
    color: var(--accent);
}

.quiz-reward i {
    margin-right: 4px;
}

.quiz-question {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.4;
}

.quiz-options {
    display: flex;
    gap: 12px;
}

.quiz-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: var(--radius-M);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.quiz-btn:hover {
    background: rgba(255,255,255,0.2);
}

.quiz-btn:active {
    transform: scale(0.95);
}

.quiz-label {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
}

.quiz-btn.selected {
    background: rgba(255,255,255,0.3);
}

.quiz-btn.correct {
    background: #4CAF50 !important;
}

.quiz-btn.wrong {
    background: #F44336 !important;
}

/* --- History Item --- */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border-radius: var(--radius-S);
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.history-date {
    font-size: 13px;
    color: var(--text-sub);
    min-width: 44px;
}

.history-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-title {
    font-size: 14px;
    font-weight: 500;
}

.history-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
}

/* ========================================
   8. STRATEGY PAGE COMPONENTS
   ======================================== */

/* --- Page Title --- */
.page-title {
    margin-bottom: 20px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-title p {
    font-size: 14px;
    color: var(--text-sub);
}

/* --- Help Button --- */
.help-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--text-sub);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Tray Card (10칸 바구니) --- */
.tray-card {
    background: var(--white);
    border-radius: var(--radius-L);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.tray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tray-label {
    font-size: 16px;
    font-weight: 600;
}

.tray-count {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
}

.tray-slots {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.tray-slot {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.2s;
}

.tray-slot.empty {
    background: #F2F4F6;
    color: var(--text-sub);
    border: 1px dashed var(--line);
}

.tray-slot.filled {
    color: #fff;
    cursor: pointer;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tray-slot.filled:hover {
    transform: scale(1.1);
}

.tray-slot.filled i {
    font-size: 14px;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.tray-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-sub);
}

.summary-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* --- AI Feedback --- */
.ai-feedback {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-bg);
    border-radius: var(--radius-M);
    padding: 16px;
    margin-bottom: 24px;
}

.ai-avatar {
    font-size: 32px;
    line-height: 1;
}

.ai-message {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.4;
}

/* --- Clear Button --- */
.clear-btn {
    font-size: 12px;
    color: var(--text-sub);
    background: none;
    border: none;
    padding: 4px 8px;
}

.clear-btn:hover {
    color: var(--text-main);
}

/* --- Block Grid --- */
.block-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.block-option {
    background: var(--white);
    border: 2px solid var(--line);
    border-radius: var(--radius-M);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.block-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.block-option:active {
    transform: scale(0.95);
}

.block-option.selected {
    border-color: var(--accent);
    background: #FFFBF0;
}

.block-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 22px;
}

.block-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.block-count {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 4px;
}

.block-etf {
    font-size: 10px;
    color: var(--text-sub);
}

/* --- Backtest Preview --- */
.backtest-preview {
    margin-bottom: 24px;
}

.backtest-card {
    background: var(--white);
    border-radius: var(--radius-M);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
}

.backtest-stat {
    text-align: center;
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
}

.stat-value.positive {
    color: #10B981;
}

.stat-value.negative {
    color: #EF4444;
}

/* --- Save Section --- */
.save-section {
    text-align: center;
    margin-bottom: 24px;
}

.save-hint {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 8px;
}

/* --- Toast Message --- */
.toast-message {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.toast-message.fade-out {
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========================================
   9. PROFILE PAGE COMPONENTS
   ======================================== */

/* --- Profile Card --- */
.profile-card {
    background: linear-gradient(135deg, var(--primary) 0%, #1A2F50 100%);
    border-radius: var(--radius-L);
    padding: 24px;
    margin-bottom: 24px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 12px;
}

.profile-info {
    margin-bottom: 12px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-email {
    font-size: 13px;
    opacity: 0.7;
}

.profile-level {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-badge {
    background: var(--accent);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.level-title {
    font-size: 12px;
    opacity: 0.7;
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat-item {
    text-align: center;
    padding: 12px 4px;
    background: #F8F9FA;
    border-radius: var(--radius-S);
}

.stat-icon {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    font-size: 10px;
    color: var(--text-sub);
    margin-top: 2px;
}

/* --- Badge Scroll --- */
.badge-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
    -webkit-overflow-scrolling: touch;
}

.badge-scroll::-webkit-scrollbar {
    display: none;
}

.badge-item {
    flex-shrink: 0;
    width: 72px;
    padding: 12px 8px;
    background: var(--white);
    border-radius: var(--radius-M);
    text-align: center;
    box-shadow: var(--shadow);
}

.badge-item.locked {
    opacity: 0.4;
}

.badge-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.badge-name {
    font-size: 10px;
    color: var(--text-sub);
    display: block;
}

.badge-item.earned .badge-name {
    color: var(--text-main);
    font-weight: 500;
}

/* --- Menu Section --- */
.menu-section {
    margin-bottom: 24px;
}

.menu-group-title {
    font-size: 11px;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 20px 0 8px;
    padding-left: 4px;
}

.menu-list {
    background: var(--white);
    border-radius: var(--radius-M);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #F8F9FA;
}

.menu-item:active {
    background: #F2F4F6;
}

.menu-item i:first-child {
    font-size: 20px;
    color: var(--text-sub);
    width: 24px;
    text-align: center;
}

.menu-item span {
    flex: 1;
    font-size: 15px;
}

.menu-item i:last-child {
    color: #CCC;
    font-size: 18px;
}

.menu-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.menu-badge.new {
    background: #FFF3CD;
    color: #856404;
}

.menu-badge.success {
    background: #D4EDDA;
    color: #155724;
}

.menu-badge.admin {
    background: linear-gradient(135deg, #0F1F38 0%, #1a2f4d 100%);
    color: #FFFFFF;
    font-weight: 600;
}

/* --- Logout Section --- */
.logout-section {
    margin-bottom: 24px;
    text-align: center;
}

.btn-logout {
    background: #F2F4F6;
    color: var(--text-sub);
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
}

.btn-logout:hover {
    background: #E5E8EB;
}

.btn-logout i {
    margin-right: 6px;
}

.version-text {
    font-size: 11px;
    color: #AAA;
    margin-top: 16px;
}

/* ========================================
   10. FOOTER
   ======================================== */

.footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 24px;
}

.footer p {
    font-size: 11px;
    color: #AAA;
}

/* ========================================
   11. PORTFOLIO REAL - 실제 포트폴리오 연동
   ======================================== */

/* 스와이프 캐러셀 */
.account-swiper {
    width: 100%;
    padding-bottom: 24px;
}

.account-swiper .swiper-slide {
    height: auto;
}

.account-swiper .slide-content {
    padding: 0;
}

.account-swiper .swiper-pagination {
    bottom: 0;
}

.account-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: var(--line);
    opacity: 1;
}

.account-swiper .swiper-pagination-bullet-active {
    background: var(--primary);
    width: 20px;
    border-radius: 4px;
}

/* 계좌 라벨 */
.account-label {
    font-size: 11px;
    color: var(--accent);
    background: rgba(184, 158, 95, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: auto;
    margin-right: 8px;
}

/* 계좌 없음 상태 */
.no-account-state {
    text-align: center;
    padding: 32px 16px;
}

.no-account-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.no-account-icon i {
    font-size: 28px;
    color: var(--primary);
}

.no-account-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.no-account-state p {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 20px;
}

.btn-connect-account {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-M);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-connect-account:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 31, 56, 0.3);
}

.btn-connect-account i {
    font-size: 16px;
}

/* 포트폴리오 없음 상태 */
.no-portfolio-state {
    text-align: center;
    padding: 24px;
    background: var(--bg-base);
    border-radius: var(--radius-M);
}

.no-portfolio-state p {
    font-size: 13px;
    color: var(--text-sub);
}

/* 포트폴리오 목록 컨테이너 */
.pf-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 스켈레톤 로딩 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-S);
}

.skeleton-text {
    display: inline-block;
}

.skeleton-donut {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
    background-size: 200% 100% !important;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 로딩 상태 */
.asset-card.loading {
    pointer-events: none;
}

/* 수익률 배지 색상 */
.badge.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.badge.positive i {
    color: #059669;
}

.badge.negative i {
    color: #DC2626;
}

/* ========================================
   12. PIN 모달
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-container {
    background: var(--white);
    border-radius: var(--radius-L);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-container .modal-header {
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.modal-container .modal-header i {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.modal-container .modal-header.warning i {
    color: #F59E0B;
}

.modal-container .modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.modal-container .modal-body {
    padding: 24px;
}

.modal-container .modal-desc {
    font-size: 14px;
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.pin-input-wrap {
    margin-bottom: 16px;
}

.pin-input-wrap label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.pin-input-wrap input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius-M);
    font-size: 24px;
    font-weight: 600;
    transition: border-color 0.2s;
}

.pin-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
}

.pin-error {
    background: #FEE2E2;
    color: #DC2626;
    padding: 12px;
    border-radius: var(--radius-S);
    font-size: 13px;
    text-align: center;
}

.modal-container .modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
}

.modal-container .modal-footer button {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-M);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.modal-container .btn-secondary {
    background: var(--bg-base);
    color: var(--text-sub);
}

.modal-container .btn-secondary:hover {
    background: var(--line);
}

.modal-container .btn-primary {
    background: var(--primary);
    color: var(--white);
}

.modal-container .btn-primary:hover {
    background: #1a2d4a;
}

/* ========================================
   API KEY MODALS
   ======================================== */

/* 모달 오버레이 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 모달 시트 (바텀시트 스타일) */
.modal-sheet {
    background: var(--white);
    width: 100%;
    max-width: var(--max-width);
    border-radius: var(--radius-L) var(--radius-L) 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-sheet.small {
    max-height: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-sheet .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--white);
}

.modal-sheet .modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-sheet .modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-base);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-sheet .modal-close:hover {
    background: var(--line);
    color: var(--text-main);
}

.modal-sheet .modal-body {
    padding: 24px;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-label .required {
    color: #DC2626;
}

.form-input,
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-M);
    font-size: 15px;
    color: var(--text-main);
    background: var(--white);
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 31, 56, 0.1);
}

.form-input::placeholder {
    color: var(--text-sub);
}

.form-hint {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 6px;
}

/* 아이콘 포함 인풋 */
.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-right: 48px;
}

.input-icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.input-icon-btn:hover {
    color: var(--text-main);
}

/* 버튼 스타일 */
.btn-full {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-M);
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-full.primary {
    background: var(--primary);
    color: var(--white);
}

.btn-full.primary:hover {
    background: #1a2d4a;
}

.btn-full.outline {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--line);
}

.btn-full.outline:hover {
    background: var(--bg-base);
    border-color: var(--primary);
}

/* 도움말 링크 */
.help-link {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-sub);
    font-size: 13px;
}

.help-link a {
    color: var(--primary);
    text-decoration: none;
}

.help-link a:hover {
    text-decoration: underline;
}

/* 현재 계좌 정보 */
.current-account-info {
    background: var(--bg-base);
    border-radius: var(--radius-M);
    padding: 16px;
    margin-bottom: 20px;
}

.current-account-info .account-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.current-account-info .account-type {
    font-size: 13px;
    color: var(--text-sub);
}

.current-account-info .account-key-preview {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--text-sub);
    font-family: monospace;
}

/* 액션 버튼 그리드 */
.account-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-btn {
    padding: 14px;
    border-radius: var(--radius-M);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.action-btn.outline {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--line);
}

.action-btn.outline:hover {
    background: var(--bg-base);
    border-color: var(--primary);
}

.action-btn.danger-outline {
    background: var(--white);
    color: #DC2626;
    border: 1.5px solid #FEE2E2;
}

.action-btn.danger-outline:hover {
    background: #FEE2E2;
}

.action-btn.danger {
    background: #DC2626;
    color: var(--white);
}

.action-btn.danger:hover {
    background: #B91C1C;
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 20px 0;
}

/* 설정 버튼 */
.btn-settings {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: var(--bg-base);
    color: var(--primary);
}

.label-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-badge {
    background: var(--accent);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

/* 계좌 없음 상태 */
.no-account-card {
    text-align: center;
    padding: 40px 20px;
}

.no-account-card .icon {
    font-size: 48px;
    color: var(--text-sub);
    margin-bottom: 16px;
}

.no-account-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.no-account-card p {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 24px;
}

.btn-connect {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: var(--white);
    padding: 14px 28px;
    border-radius: var(--radius-M);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-connect:hover {
    background: #1a2d4a;
    transform: translateY(-1px);
}

/* ========================================
   SKELETON SHIMMER (로딩 애니메이션)
   ======================================== */

/* 쉬머 애니메이션 키프레임 */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 기본 스켈레톤 */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-S);
}

/* 스켈레톤 텍스트 */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.lg {
    height: 32px;
    width: 60%;
}

.skeleton-text.md {
    height: 20px;
    width: 40%;
}

.skeleton-text.sm {
    height: 14px;
    width: 30%;
}

/* 스켈레톤 원형 (차트용) */
.skeleton-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* 스켈레톤 아이템 (포트폴리오 리스트용) */
.skeleton-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-M);
    margin-bottom: 8px;
}

.skeleton-item .skeleton-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.skeleton-item .skeleton-info {
    flex: 1;
}

.skeleton-item .skeleton-value {
    width: 50px;
    height: 20px;
}

/* 스켈레톤 카드 */
.skeleton-card {
    background: var(--white);
    border-radius: var(--radius-L);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* 차트 영역 스켈레톤 */
.skeleton-chart-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 20px;
}

.skeleton-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-legend-item .skeleton-label {
    height: 14px;
    width: 80px;
}

.skeleton-legend-item .skeleton-percent {
    height: 14px;
    width: 30px;
}

/* 로딩 상태 숨기기/보이기 */
.loading-skeleton {
    display: block;
}

.loading-skeleton.hidden {
    display: none;
}

.loaded-content {
    display: none;
}

.loaded-content.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
