/**
 * AI 분석 섹션 스타일
 * - 라이트/다크 모드 지원
 * - 투자자/실거주자 페르소나 지원
 * - RN UI 레이아웃 가이드 반영 (2026-01-14)
 */

/* ============================
 * 페르소나 색상 변수
 * ============================ */
:root {
    /* 투자자 색상 */
    --persona-investor-primary: #3B82F6;
    --persona-investor-light: #60A5FA;
    --persona-investor-bg: #EFF6FF;
    --persona-investor-bg-dark: rgba(59, 130, 246, 0.13);

    /* 실거주자 색상 */
    --persona-resident-primary: #059669;
    --persona-resident-light: #34D399;
    --persona-resident-bg: #ECFDF5;
    --persona-resident-bg-dark: rgba(5, 150, 105, 0.13);

    /* 점수 색상 */
    --score-good: #059669;
    --score-good-light: #34D399;
    --score-good-bg: #ECFDF5;
    --score-ok: #D97706;
    --score-ok-light: #FBBF24;
    --score-ok-bg: #FEF3C7;
    --score-caution: #DC2626;
    --score-caution-light: #F87171;
    --score-caution-bg: #FEE2E2;
}

/* ============================
 * AI 분석 섹션 컨테이너
 * ============================ */
.ai-analysis-section {
    padding-bottom: 1rem;
}

/* ============================
 * 페르소나 선택 UI
 * ============================ */
.persona-selection {
    margin-bottom: 1rem;
}

.persona-selection-label {
    font-size: 0.875rem;
    color: #6B7280;
    margin-bottom: 0.5rem;
}

.dark .persona-selection-label {
    color: #9CA3AF;
}

.persona-buttons {
    display: flex;
    gap: 0.75rem;
}

.persona-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #E5E7EB;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .persona-btn {
    border-color: #374151;
}

.persona-btn:hover {
    background: rgba(0, 0, 0, 0.02);
}

.dark .persona-btn:hover {
    background: rgba(255, 255, 255, 0.02);
}

.persona-btn.selected {
    border-width: 2px;
}

.persona-btn.investor.selected {
    border-color: var(--persona-investor-primary);
    background: var(--persona-investor-bg);
}

.dark .persona-btn.investor.selected {
    border-color: var(--persona-investor-light);
    background: var(--persona-investor-bg-dark);
}

.persona-btn.resident.selected {
    border-color: var(--persona-resident-primary);
    background: var(--persona-resident-bg);
}

.dark .persona-btn.resident.selected {
    border-color: var(--persona-resident-light);
    background: var(--persona-resident-bg-dark);
}

.persona-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.persona-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1F2937;
}

.dark .persona-label {
    color: #F9FAFB;
}

.persona-desc {
    font-size: 0.75rem;
    color: #6B7280;
    margin-top: 0.125rem;
}

.dark .persona-desc {
    color: #9CA3AF;
}

.persona-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-top: 0.375rem;
}

.persona-btn.investor .persona-completed-badge {
    background: rgba(59, 130, 246, 0.2);
    color: var(--persona-investor-primary);
}

.dark .persona-btn.investor .persona-completed-badge {
    color: var(--persona-investor-light);
}

.persona-btn.resident .persona-completed-badge {
    background: rgba(5, 150, 105, 0.2);
    color: var(--persona-resident-primary);
}

.dark .persona-btn.resident .persona-completed-badge {
    color: var(--persona-resident-light);
}

/* ============================
 * 점수 배지 (CompactScoreBadge)
 * ============================ */
.ai-score-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-score-icon {
    font-size: 1.25rem;
}

.ai-score-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.ai-score-grade {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.ai-score-grade.good {
    background: var(--score-good-bg);
    color: var(--score-good);
}

.dark .ai-score-grade.good {
    background: rgba(5, 150, 105, 0.2);
    color: var(--score-good-light);
}

.ai-score-grade.ok {
    background: var(--score-ok-bg);
    color: var(--score-ok);
}

.dark .ai-score-grade.ok {
    background: rgba(217, 119, 6, 0.2);
    color: var(--score-ok-light);
}

.ai-score-grade.caution {
    background: var(--score-caution-bg);
    color: var(--score-caution);
}

.dark .ai-score-grade.caution {
    background: rgba(220, 38, 38, 0.2);
    color: var(--score-caution-light);
}

.ai-score-persona {
    font-size: 0.75rem;
    color: #6B7280;
}

.dark .ai-score-persona {
    color: #9CA3AF;
}

.ai-score-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================
 * 섹션 탭 (SectionTabChip)
 * ============================ */
.section-tabs-container {
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.section-tabs-container::-webkit-scrollbar {
    display: none;
}

.section-tabs {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

.section-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.875rem;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.dark .section-tab {
    border-color: #374151;
    background: #374151;
    color: #9CA3AF;
}

.section-tab:hover {
    background: #F3F4F6;
}

.dark .section-tab:hover {
    background: #4B5563;
}

.section-tab.active {
    border-width: 1px;
}

.section-tab.active.investor {
    border-color: var(--persona-investor-primary);
    background: var(--persona-investor-bg);
    color: var(--persona-investor-primary);
}

.dark .section-tab.active.investor {
    border-color: var(--persona-investor-light);
    background: var(--persona-investor-bg-dark);
    color: var(--persona-investor-light);
}

.section-tab.active.resident {
    border-color: var(--persona-resident-primary);
    background: var(--persona-resident-bg);
    color: var(--persona-resident-primary);
}

.dark .section-tab.active.resident {
    border-color: var(--persona-resident-light);
    background: var(--persona-resident-bg-dark);
    color: var(--persona-resident-light);
}

.section-tab-icon {
    font-size: 0.875rem;
}

/* ============================
 * 로그인 필요 UI
 * ============================ */
.login-required-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border: 1px solid var(--persona-investor-primary);
    border-radius: 0.75rem;
    background: var(--persona-investor-bg);
}

.dark .login-required-box {
    background: var(--persona-investor-bg-dark);
    border-color: var(--persona-investor-light);
}

.login-required-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 9999px;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.login-required-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 0.25rem;
}

.dark .login-required-title {
    color: #F9FAFB;
}

.login-required-desc {
    font-size: 0.875rem;
    color: #6B7280;
    text-align: center;
    margin-bottom: 1rem;
}

.dark .login-required-desc {
    color: #9CA3AF;
}

.login-required-buttons {
    display: flex;
    gap: 0.75rem;
}

.login-btn-primary {
    padding: 0.5rem 1.25rem;
    background: var(--persona-investor-primary);
    color: white !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.login-btn-primary:hover {
    background: #2563EB;
}

.login-btn-secondary {
    padding: 0.5rem 1.25rem;
    background: transparent;
    color: var(--persona-investor-primary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid var(--persona-investor-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.dark .login-btn-secondary {
    color: var(--persona-investor-light);
    border-color: var(--persona-investor-light);
}

.login-btn-secondary:hover {
    background: rgba(59, 130, 246, 0.1);
}

/* ============================
 * 면책 조항
 * ============================ */
.ai-disclaimer {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #F9FAFB;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: #9CA3AF;
    text-align: center;
}

.dark .ai-disclaimer {
    background: #1F2937;
    color: #6B7280;
}

/* ============================
 * 기본 섹션 스타일 (투자자/실거주자 공통)
 * ============================ */
.ai-summary,
.ai-station,
.ai-school,
.ai-nature,
.ai-life,
.ai-conclusion,
.ai-price,
.ai-supply,
.ai-regulation,
.ai-commute,
.ai-education,
.ai-environment {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left-width: 4px;
    border-left-style: solid;
}

/* 섹션 제목 */
.ai-summary h4,
.ai-station h4,
.ai-school h4,
.ai-nature h4,
.ai-life h4,
.ai-conclusion h4,
.ai-price h4,
.ai-supply h4,
.ai-regulation h4,
.ai-commute h4,
.ai-education h4,
.ai-environment h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* 섹션 내용 */
.ai-summary p,
.ai-station p,
.ai-school p,
.ai-nature p,
.ai-life p,
.ai-conclusion p,
.ai-price p,
.ai-supply p,
.ai-regulation p,
.ai-commute p,
.ai-education p,
.ai-environment p {
    margin: 0;
    line-height: 1.6;
    color: #374151;
}

/* 종합 평가 (Summary) - 파란색 */
.ai-summary {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left-color: #3b82f6;
}

/* 역세권 (Station) - 주황색 */
.ai-station {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left-color: #f59e0b;
}

/* 학세권 (School) - 에메랄드 */
.ai-school {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left-color: #10b981;
}

/* 숲세권 (Nature) - 녹색 */
.ai-nature {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #22c55e;
}

/* 슬세권 (Life) - 보라색 */
.ai-life {
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border-left-color: #a855f7;
}

/* 투자 결론 (Conclusion) - 진파랑 */
.ai-conclusion {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #2563eb;
}

/* 다크 모드 스타일 */
.dark .ai-summary,
.dark .ai-station,
.dark .ai-school,
.dark .ai-nature,
.dark .ai-life,
.dark .ai-conclusion {
    border-left-width: 4px;
}

/* 다크모드 제목 */
.dark .ai-summary h4,
.dark .ai-station h4,
.dark .ai-school h4,
.dark .ai-nature h4,
.dark .ai-life h4,
.dark .ai-conclusion h4 {
    color: #f3f4f6;
}

/* 다크모드 내용 */
.dark .ai-summary p,
.dark .ai-station p,
.dark .ai-school p,
.dark .ai-nature p,
.dark .ai-life p,
.dark .ai-conclusion p {
    color: #e5e7eb;
}

/* 다크모드 배경 */
.dark .ai-summary {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
    border-left-color: #60a5fa;
}

.dark .ai-station {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-left-color: #fbbf24;
}

.dark .ai-school {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-left-color: #34d399;
}

.dark .ai-nature {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    border-left-color: #4ade80;
}

.dark .ai-life {
    background: linear-gradient(135deg, #4a044e 0%, #581c87 100%);
    border-left-color: #c084fc;
}

.dark .ai-conclusion {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    border-left-color: #93c5fd;
}

/* 강조 텍스트 */
.ai-summary strong,
.ai-station strong,
.ai-school strong,
.ai-nature strong,
.ai-life strong,
.ai-conclusion strong {
    font-weight: 600;
}

.dark .ai-summary strong,
.dark .ai-station strong,
.dark .ai-school strong,
.dark .ai-nature strong,
.dark .ai-life strong,
.dark .ai-conclusion strong {
    color: #ffffff;
}

/* 외부 데이터 섹션 스타일 */
.ai-external-data {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.ai-external-data h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.ai-external-data h5 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
}

.ai-data-facilities,
.ai-data-price {
    padding: 0.5rem 0;
}

/* 다크모드 외부 데이터 섹션 */
.dark .ai-external-data {
    background: #1e293b;
    border-color: #334155;
}

.dark .ai-external-data h4,
.dark .ai-external-data h5 {
    color: #f1f5f9;
}

.dark .ai-external-data p {
    color: #94a3b8;
}

/* ============================
 * 투자자 페르소나 섹션 스타일
 * ============================ */

/* 가격·시세 분석 (Price) - 청록색 */
.ai-price {
    background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
    border-left-color: #06b6d4;
}

.dark .ai-price {
    background: linear-gradient(135deg, #083344 0%, #164e63 100%);
    border-left-color: #22d3ee;
}

/* 수요·공급 분석 (Supply) - 인디고 */
.ai-supply {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-left-color: #6366f1;
}

.dark .ai-supply {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-left-color: #a5b4fc;
}

/* 규제·리스크 분석 (Regulation) - 빨간색 */
.ai-regulation {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-left-color: #ef4444;
}

.dark .ai-regulation {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-left-color: #f87171;
}

/* ============================
 * 실거주자 페르소나 섹션 스타일
 * ============================ */

/* 교통·통근 분석 (Commute) - 주황색 (Station과 동일) */
.ai-commute {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border-left-color: #f97316;
}

.dark .ai-commute {
    background: linear-gradient(135deg, #431407 0%, #7c2d12 100%);
    border-left-color: #fb923c;
}

/* 교육·학군 분석 (Education) - 에메랄드 */
.ai-education {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left-color: #10b981;
}

.dark .ai-education {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-left-color: #34d399;
}

/* 환경·쾌적성 분석 (Environment) - 녹색 */
.ai-environment {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #22c55e;
}

.dark .ai-environment {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    border-left-color: #4ade80;
}

/* ============================
 * 신규 섹션 다크모드 텍스트
 * ============================ */
.dark .ai-price h4,
.dark .ai-supply h4,
.dark .ai-regulation h4,
.dark .ai-commute h4,
.dark .ai-education h4,
.dark .ai-environment h4 {
    color: #f3f4f6;
}

.dark .ai-price p,
.dark .ai-supply p,
.dark .ai-regulation p,
.dark .ai-commute p,
.dark .ai-education p,
.dark .ai-environment p {
    color: #e5e7eb;
}

/* 강조 텍스트 - 신규 섹션 */
.ai-price strong,
.ai-supply strong,
.ai-regulation strong,
.ai-commute strong,
.ai-education strong,
.ai-environment strong {
    font-weight: 600;
}

.dark .ai-price strong,
.dark .ai-supply strong,
.dark .ai-regulation strong,
.dark .ai-commute strong,
.dark .ai-education strong,
.dark .ai-environment strong {
    color: #ffffff;
}

/* ============================
 * 반응형 조정
 * ============================ */
@media (max-width: 640px) {
    .ai-summary,
    .ai-station,
    .ai-school,
    .ai-nature,
    .ai-life,
    .ai-conclusion,
    .ai-price,
    .ai-supply,
    .ai-regulation,
    .ai-commute,
    .ai-education,
    .ai-environment {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .ai-summary h4,
    .ai-station h4,
    .ai-school h4,
    .ai-nature h4,
    .ai-life h4,
    .ai-conclusion h4,
    .ai-price h4,
    .ai-supply h4,
    .ai-regulation h4,
    .ai-commute h4,
    .ai-education h4,
    .ai-environment h4 {
        font-size: 0.9rem;
    }

    .ai-summary p,
    .ai-station p,
    .ai-school p,
    .ai-nature p,
    .ai-life p,
    .ai-conclusion p,
    .ai-price p,
    .ai-supply p,
    .ai-regulation p,
    .ai-commute p,
    .ai-education p,
    .ai-environment p {
        font-size: 0.875rem;
    }

    /* 페르소나 선택 버튼 - 모바일 */
    .persona-buttons {
        flex-direction: column;
    }

    .persona-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.875rem;
    }

    .persona-icon {
        margin-bottom: 0;
    }

    .persona-text {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    /* 섹션 탭 - 모바일 */
    .section-tabs {
        flex-wrap: nowrap;
    }

    /* 로그인 필요 UI - 모바일 */
    .login-required-buttons {
        flex-direction: column;
        width: 100%;
    }

    .login-btn-primary,
    .login-btn-secondary {
        width: 100%;
        text-align: center;
    }
}
