/* ================================
 * 로딩 오버레이
 * ================================ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.loading-overlay .loading-modal {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}
.spinner {
    width: 50px; height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-text { font-size: 1.2em; color: #333; font-weight: bold; text-align: center; }

/* ================================
 * 리포트 / 대시보드 컴포넌트
 * ================================ */
.report-container { font-family: 'Noto Sans KR', sans-serif; }
.report-section { margin-bottom: 40px; }
.report-section h3 {
    border-left: 5px solid #4CAF50;
    padding-left: 15px;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 1.4em;
}
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.metric-card {
    background: white;
    padding: 25px 20px;
    border-radius: 16px;
    border: 1px solid #eee;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}
.metric-card:hover { transform: translateY(-5px); }
.metric-card .label { font-size: 0.95em; color: #7f8c8d; margin-bottom: 10px; }
.metric-card .value { font-size: 1.5em; font-weight: 800; color: #2c3e50; letter-spacing: -0.5px; }
.metric-card .sub-text { font-size: 0.85em; color: #95a5a6; margin-top: 5px; }

.metric-card.highlight { background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%); border: 2px solid #4CAF50; }
.metric-card.highlight .value { color: #2e7d32; }

.metric-card.warning { background: #fff3e0; border: 1px solid #ffe0b2; }
.metric-card.warning .value { color: #e65100; }

.strategy-table { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; border: 1px solid #eee; margin-bottom: 20px; }
.strategy-table th { background: #f8f9fa; padding: 15px; text-align: left; font-weight: bold; color: #444; border-bottom: 1px solid #eee; }
.strategy-table td { padding: 15px; border-bottom: 1px solid #eee; color: #555; vertical-align: middle; }
.strategy-table tr:last-child td { border-bottom: none; }

.copy-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 2px dashed #bdc3c7;
    margin-top: 15px;
    position: relative;
}
.copy-box h4 { margin-top: 0; color: #2c3e50; margin-bottom: 15px; }
.copy-content { white-space: pre-wrap; line-height: 1.6; color: #34495e; font-family: monospace; font-size: 1.1em; }

/* ================================
 * 낙찰 물건 선택 카드
 * ================================ */
.bid-selection-container {
    margin-bottom: 30px;
}

.bid-selection-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2em;
}

.bid-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

.bid-card {
    flex: 0 0 280px;
    background: white;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.bid-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #ddd;
}

.bid-card.active {
    border-color: #4CAF50;
    background-color: #f1f8e9;
    box-shadow: 0 0 0 1px #4CAF50;
}

.bid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bid-type.badge {
    background: #eee;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #555;
}

.bid-date {
    font-size: 12px;
    color: #888;
}

.bid-address {
    font-weight: bold;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
}

.bid-price {
    font-size: 14px;
    color: #666;
}

.selected-mark {
    margin-top: 10px;
    font-size: 13px;
    color: #4CAF50;
    font-weight: bold;
    text-align: right;
}

/* ================================
 * 전략 분석 폼
 * ================================ */
.strategy-form-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-submit:hover {
    background: #45a049;
}

/* ================================
 * 결과 컨테이너
 * ================================ */
.result-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.markdown-body {
    line-height: 1.6;
    color: #333;
}

.markdown-body h2 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 30px;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.markdown-body th {
    background-color: #f8f9fa;
}

.markdown-body blockquote {
    background: #f1f8e9;
    border-left: 5px solid #4CAF50;
    margin: 20px 0;
    padding: 15px;
}

/* ================================
 * 모바일 반응형
 * ================================ */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* ================================
 * 인쇄 스타일
 * ================================ */
@media print {
    body * {
        visibility: hidden;
    }

    body, .container, .result-container {
        background: white !important;
        background-color: white !important;
    }

    .result-container, .result-container * {
        visibility: visible;
    }

    .result-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        box-shadow: none;
        border: none;
        background: white;
    }

    .btn-print,
    .result-header button,
    .page-header,
    header,
    footer,
    .strategy-form-container,
    .bid-selection-container,
    .alert,
    #loadingOverlay {
        display: none !important;
    }

    .report-container {
        font-size: 12pt;
        line-height: 1.6;
        color: black;
    }

    .report-section h3 {
        color: black;
        page-break-after: avoid;
    }

    .strategy-table, .dashboard-grid {
        page-break-inside: avoid;
    }

    .metric-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
