﻿/* ==================== 계산기 결과 영역 고도화 CSS ==================== */

/* 결과 섹션 공통 */
.result-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 1단: KPI 카드 그리드 ==================== */

.kpi-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 16px;
    margin-bottom: 30px;
    width: 100%;
}

.kpi-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 16px;
    min-height: 140px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

/* 호버 효과 */
.kpi-card:hover {
    border-color: #8b5cf6;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.12);
    transform: translateY(-3px);
}

/* KPI 카드 라벨 (상단) */
.kpi-card-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
    word-break: normal !important;
    overflow-wrap: normal !important;
    max-width: 100%;
    box-sizing: border-box;
}

/* KPI 카드 값 (중앙, 가장 큼) */
.kpi-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
    word-break: normal !important;
    overflow-wrap: normal !important;
    white-space: normal;
    margin: 6px 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* KPI 카드 단위 (아래, 작은 글씨) */
.kpi-card-unit {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
    margin-top: 2px;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* 주요 KPI 카드 강조 (Primary) */
.kpi-card.primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    color: white;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
    position: relative;
}

.kpi-card.primary::before {
    content: '★';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 1.2rem;
    opacity: 0.6;
}

.kpi-card.primary .kpi-card-label {
    color: rgba(255, 255, 255, 0.85);
}

.kpi-card.primary .kpi-card-value {
    color: #ffffff;
}

.kpi-card.primary .kpi-card-unit {
    color: rgba(255, 255, 255, 0.7);
}

.kpi-card.primary:hover {
    border-color: #8b5cf6;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35);
}

/* 반응형: 태블릿 */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .kpi-card {
        padding: 20px 14px;
        height: auto;
        min-height: 130px;
    }

    .kpi-card-value {
        font-size: 1.6rem;
    }
}

/* 반응형: 모바일 */
@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .kpi-card {
        padding: 18px 14px;
        height: auto;
        min-height: 110px;
        min-width: auto;
        flex-shrink: 1;
    }

    .kpi-card-value {
        font-size: 1.5rem;
        word-break: normal !important;
        overflow-wrap: normal !important;
    }

    .kpi-card-label {
        font-size: 0.8rem;
    }

    .kpi-card-unit {
        font-size: 0.7rem;
    }
}

/* ==================== 2단: 한 줄 요약 (Insight Summary) ==================== */

.insight-summary {
    background: #f9fafb;
    border-left: 4px solid #8b5cf6;
    padding: 18px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    line-height: 1.6;
    font-size: 0.95rem;
    color: #374151;
}

.insight-summary strong {
    color: #1f2937;
    font-weight: 600;
}

/* ==================== 3단: 상세내역 (Accordion) ==================== */

.details-section {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

.details-section summary {
    padding: 16px 18px;
    background: #f3f4f6;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
}

.details-section summary:hover {
    background: #e5e7eb;
}

.details-section summary::marker {
    color: #8b5cf6;
}

.details-section[open] summary {
    background: #e9d5ff;
    color: #6d28d9;
}

.details-content {
    padding: 20px 18px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

/* 상세내역 표 */
.details-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.9rem;
}

.details-table tr {
    border-bottom: 1px solid #f3f4f6;
}

.details-table tr:last-child {
    border-bottom: none;
}

.details-table td {
    padding: 12px 8px;
}

.details-table td:first-child {
    color: #6b7280;
    font-weight: 500;
    width: 60%;
}

.details-table td:last-child {
    text-align: right;
    color: #1f2937;
    font-weight: 600;
}

.details-table .label {
    color: #4b5563;
}

.details-table .value {
    color: #8b5cf6;
}

/* 상세내역 리스트 */
.details-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.details-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.details-list li:last-child {
    border-bottom: none;
}

.details-list li span:first-child {
    color: #6b7280;
}

.details-list li span:last-child {
    color: #1f2937;
    font-weight: 600;
}

/* ==================== 알림 박스 ==================== */

.alert-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 14px 16px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #92400e;
    line-height: 1.5;
}

.alert-box strong {
    color: #b45309;
}

/* ==================== 추가: 계산 중 상태 ==================== */

.result-section.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==================== 텍스트 유틸리티 ==================== */

.text-amount {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    white-space: nowrap;
}

.text-percentage {
    font-weight: 600;
    color: #8b5cf6;
}

/* ==================== 데스크톱 추가 개선 ==================== */

@media (min-width: 1025px) {
    .kpi-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .insight-summary {
        font-size: 1rem;
        padding: 20px 22px;
    }
}
