/* 처방 추출 결과 및 디버깅 전용 스타일 */
.csv-info-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    border: 1px solid #eef2f6;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
}

.source-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-badge-csv {
    background-color: #ffa000;
    color: white;
}

.source-badge-db {
    background-color: var(--primary-color);
    color: white;
}

/* 데이터 출처 범례 스타일 */
.data-source-legend {
    background: #fdfdfd;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #f0f0f0;
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.25rem;
}

.legend-items {
    display: flex;
    gap: 2rem;
}

.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
}

.legend-color-box {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
}

.legend-color-box.csv {
    background-color: #ffa000;
    /* Restored amber color for CSV legend */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.legend-color-box.db {
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(74, 109, 167, 0.2);
}

.legend-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.legend-text strong {
    font-size: 0.95rem;
    color: #333;
}

.legend-text span {
    font-size: 0.85rem;
    color: #777;
    line-height: 1.4;
}

.db-result-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    border: 1px solid #eef2f6;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.prescription-info-compact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f8fafc;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    min-width: 80px;
}

.info-value {
    font-size: 1rem;
    color: #334155;
    font-weight: 500;
}

.info-value.highlight {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
}

.info-value.score {
    color: #64748b;
    font-size: 0.9rem;
}

.source-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 0.85rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.csv-info-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.csv-info-items-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.csv-text {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    line-height: 1.6;
    color: #333;
}

/* 검색 결과 목록 */
.search-results-list {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.search-results-list h3 {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    transition: margin-bottom 0.3s ease;
}

.search-results-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.batch-action-btn {
    height: 34px;
    padding: 0 0.85rem;
    border: 1px solid rgba(140, 168, 198, 0.72);
    border-radius: 9px;
    background: #fff;
    color: #2f5e95;
    font-size: 0.83rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.batch-action-btn:hover:not(:disabled) {
    border-color: rgba(123, 156, 197, 0.85);
    background: #f6f9ff;
}

.batch-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.batch-status {
    margin-top: 0.85rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.batch-metrics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.batch-status .progress-bar {
    background: #e2e8f0;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.batch-status .progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #4b6f9d);
    transition: width 0.3s ease;
}

.search-results-list.collapsed {
    padding: 1.25rem 2rem;
}

.search-results-list.collapsed h3 {
    margin-bottom: 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.result-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.result-card.selected {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.result-card-score {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-card-score.pending {
    background-color: #cbd5f0;
    color: #4c5b7a;
}

.result-card-score.in-progress {
    background-color: #fde68a;
    color: #92400e;
}

.result-card-score.failed {
    background-color: #fecaca;
    color: #991b1b;
}

.result-card-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.result-card-preview {
    font-size: 0.85rem;
    color: #888;
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 페이지네이션 스타일 */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.pagination-container .dr-page-btn,
.pagination-container .dr-page-nav {
    min-width: 34px;
    height: 34px;
    padding: 0 0.62rem;
    border-radius: 9px;
    border: 1px solid rgba(140, 168, 198, 0.72);
    background: white;
    color: #2f5e95;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-container .dr-page-btn:hover,
.pagination-container .dr-page-nav:hover {
    border-color: rgba(123, 156, 197, 0.85);
    background: #f6f9ff;
}

.pagination-container .dr-page-btn.is-active {
    border-color: #4a6da7;
    background: #4a6da7;
    color: #fff;
}

.pagination-container .dr-page-btn:disabled,
.pagination-container .dr-page-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-container .dr-page-ellipsis {
    color: #5f7591;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0 0.12rem;
}

.page-info {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0 1rem;
}

/* 디버깅 정보 스타일 */
.debug-container {
    margin-top: 3rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 16px;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.debug-container h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #495057;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.debug-tabs {
    display: flex;
    gap: 0.5rem;
    background: #e9ecef;
    padding: 0.4rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: none;
    position: relative;
    /* For glider positioning */
    z-index: 0;
}

.debug-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    transition: color 0.2s ease;
    /* Only color transition */
    position: relative;
    z-index: 2;
    /* Above glider */
}

.debug-tab:hover {
    color: #495057;
    /* Remove background hover */
}

.debug-tab.active {
    color: var(--primary-color);
    background: transparent;
    box-shadow: none;
}

.debug-tab-glider {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Chewy elastic effect */
    height: calc(100% - 0.8rem);
    /* Match height minus padding */
    top: 0.4rem;
    /* Match top padding */
}

.debug-content {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #d4d4d4;
    line-height: 1.6;
    border: 1px solid #333;
}

.debug-log-item {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #2d2d2d;
    display: flex;
    gap: 0.75rem;
}

.debug-log-item:last-child {
    border-bottom: none;
}

/* 확장 분석 결과 스타일 */
.expand-results-container {
    margin-top: 3rem;
    padding: 2rem;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.expand-results-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: #f1f5f9;
    padding: 0.4rem;
    border-radius: 10px;
}

.expand-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.expand-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #334155;
}

.expand-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.expand-tab-content {
    display: none;
}

.expand-tab-content.active {
    display: block;
}

.expand-source-text-container {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid #f1f5f9;
}

.expand-source-text-container h5 {
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #334155;
}

.debug-log-item.step-start {
    color: #1976d2;
    font-weight: 600;
}

.debug-log-item.step-complete {
    color: #2e7d32;
}

.debug-log-item.step-improve {
    color: #f57c00;
}

@media (max-width: 768px) {
    .csv-info-items-row {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}
