/* ================================
 * 헤더 & 폼
 * ================================ */
.ai-analysis-header {
    text-align: center;
    margin-bottom: 40px;
}

.ai-analysis-header h1 {
    font-size: 2.5rem;
    color: #2d5016;
    margin-bottom: 15px;
}

.ai-analysis-header p {
    color: #666;
    font-size: 1.1rem;
}

.analysis-form-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.badge {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
}

.badge.required {
    background-color: #ff5252;
}

.badge.optional {
    background-color: #aaa;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Pretendard', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: #3cb371;
    outline: none;
    box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.1);
}

.file-upload-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    background: #f9f9f9;
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload-wrapper:hover {
    border-color: #3cb371;
    background: #f0fdf4;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.file-upload-placeholder .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
    color: #3cb371;
}

.file-upload-placeholder .text {
    color: #666;
    font-size: 0.95rem;
}

.file-upload-placeholder small {
    color: #999;
    font-size: 0.8em;
}

.form-actions {
    text-align: center;
}

.btn-analyze {
    background: linear-gradient(135deg, #2d5016 0%, #3cb371 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-analyze:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(60, 179, 113, 0.3);
}

.btn-analyze:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ================================
 * 결과 컨테이너
 * ================================ */
.analysis-result-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    border-top: 5px solid #3cb371;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.result-header h2 {
    color: #2d5016;
    margin: 0;
}

.btn-print {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    color: #555;
}

.btn-print:hover {
    background: #e9ecef;
}

/* ================================
 * 마크다운 스타일
 * ================================ */
.markdown-body {
    line-height: 1.8;
    color: #333;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    font-weight: bold;
    color: #111;
}

.markdown-body h2 {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5em;
    color: #2d5016;
}

.markdown-body h3 {
    color: #3cb371;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 20px;
    margin-bottom: 1.5em;
}

.markdown-body li {
    margin-bottom: 0.5em;
}

.markdown-body blockquote {
    margin: 1.5em 0;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-left: 5px solid #3cb371;
    color: #555;
}

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

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

.markdown-body th {
    background-color: #f1f8e9;
    font-weight: bold;
    color: #2d5016;
}

.markdown-body tr:nth-child(even) {
    background-color: #fcfcfc;
}

/* ================================
 * 리포트 / 대시보드 컴포넌트
 * ================================ */
.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; }

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #ffcdd2;
}

/* ================================
 * 버튼
 * ================================ */
.btn-new {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 20px !important;
    background: linear-gradient(135deg, #3cb371 0%, #2e8b57 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    text-decoration: none !important;
    font-weight: bold !important;
    transition: all 0.3s ease !important;
    font-size: 0.95rem !important;
    box-shadow: 0 4px 10px rgba(60, 179, 113, 0.3) !important;
}

.btn-new:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(60, 179, 113, 0.4) !important;
    background: linear-gradient(135deg, #2e8b57 0%, #3cb371 100%) !important;
    color: white !important;
}

/* ================================
 * 결과 콘텐츠
 * ================================ */
.result-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.result-content .strategy-table,
.result-content table {
    min-width: 600px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

/* ================================
 * 모바일 반응형
 * ================================ */
@media (max-width: 768px) {
    .ai-analysis-header h1 {
        font-size: 2rem;
    }

    .result-content {
        margin: 0 -20px;
        padding: 0 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .metric-card {
        padding: 20px 15px !important;
    }

    .metric-card .value {
        font-size: 1.3em !important;
    }

    .strategy-table,
    .result-content table {
        font-size: 0.85em;
    }

    .strategy-table th,
    .strategy-table td,
    .result-content table th,
    .result-content table td {
        padding: 10px 8px !important;
    }

    .report-section h3 {
        font-size: 1.2em !important;
    }
}

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

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

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

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

    .btn-print,
    .result-actions,
    .page-header,
    header,
    footer,
    .analysis-form-container,
    .history-section,
    .alert {
        display: none !important;
    }

    .markdown-body {
        font-size: 12pt;
        line-height: 1.6;
        color: black;
    }

    .markdown-body h1, .markdown-body h2, .markdown-body h3 {
        color: black;
        page-break-after: avoid;
    }

    .markdown-body table {
        page-break-inside: avoid;
    }

    .markdown-body blockquote {
        border-left-color: #333;
        background-color: #f5f5f5;
    }
}
