/* 처방 검색 인터페이스 및 결과 목록 스타일 */

/* 검색 인터페이스 */
.prescription-search-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    margin-bottom: 2rem;
    border: 1px solid #f0f0f0;
}

.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1rem;
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-form button {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-form button:hover {
    background-color: #3a5a8a;
}

.search-form button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

#analyzeBtn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* 분석 시작 버튼 (독립 섹션) */
.analyze-btn {
    width: 100%;
    padding: 16px 24px;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3a5a8a 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(74, 108, 156, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.analyze-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #3a5a8a 0%, var(--primary-color) 100%);
    box-shadow: 0 6px 20px rgba(74, 108, 156, 0.4);
    transform: translateY(-2px);
}

.analyze-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 108, 156, 0.3);
}

.analyze-btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    box-shadow: none;
}

.analyze-btn i {
    font-size: 1.2rem;
}

.book-filter {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.book-filter label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.book-filter .filter-help {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: #6b7280;
}

.book-filter input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* 진행 상황 표시 */
.progress-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-step {
    margin-bottom: 1.5rem;
}

.progress-step:last-child {
    margin-bottom: 0;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.step-label {
    font-weight: 500;
    color: #333;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

/* 후보 목록 스타일 */
.prescription-candidates-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #fcfcfc;
    border: 1px solid #eee;
    border-radius: 12px;
}

.prescription-candidates-container label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.candidates-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #666;
    font-size: 0.95rem;
}

.candidates-loading i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.prescription-candidates-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.prescription-candidate-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 160, 0, 0.05);
    /* CSV Amber tint */
    border: 1px solid rgba(255, 160, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.prescription-candidate-item:hover {
    background-color: rgba(255, 160, 0, 0.1);
    border-color: #ffa000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 160, 0, 0.1);
}

.prescription-candidate-item.selected {
    background-color: #ffa000;
    border-color: #e69100;
    color: white;
}

.prescription-candidate-name {
    font-weight: 700;
    font-size: 1rem;
    color: #a56d00;
}

.prescription-candidate-item.selected .prescription-candidate-name {
    color: white;
}

.prescription-candidate-book {
    font-size: 0.8rem;
    color: #c48200;
}

.prescription-candidate-reference {
    font-size: 0.75rem;
    color: #9a6a1a;
    line-height: 1.35;
}

.prescription-candidate-item.selected .prescription-candidate-book {
    color: rgba(255, 255, 255, 0.9);
}

.prescription-candidate-item.selected .prescription-candidate-reference {
    color: rgba(255, 255, 255, 0.85);
}

.prescription-candidate-similarity {
    display: none;
}

.prescription-candidate-item.selected .prescription-candidate-similarity {
    color: white;
}

/* 선택된 처방 정보 스타일 */
.selected-prescription-info {
    display: none;
    background: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    border-radius: 4px 12px 12px 4px;
    margin-bottom: 1.5rem;
}

.selected-prescription-info.active {
    display: block;
}

.selected-prescription-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--primary-color);
}

.selected-prescription-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* 결과 없음 및 토글 스타일 */
.no-results {
    display: none;
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.no-results.active {
    display: block;
}

.search-results-toggle {
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-results-list.collapsed .search-results-toggle {
    transform: rotate(-180deg);
}

.search-results-list.collapsed .results-grid,
.search-results-list.collapsed .pagination-container {
    display: none !important;
}

/* 서적 제목 자동완성 드롭다운 */
.book-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 4px;
}

.book-suggestion-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background-color: white;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 0.95rem;
    color: #334155;
    transition: all 0.2s ease;
}

.book-suggestion-item:last-child {
    border-bottom: none;
}

.book-suggestion-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.book-suggestion-title {
    font-weight: 700;
    font-size: 1rem;
    color: #334155;
}

.book-suggestion-item:hover .book-suggestion-title {
    color: var(--primary-color);
}

.book-suggestion-info {
    font-size: 0.8rem;
    color: #64748b;
}

/* 선택 아이콘 추가 */
.book-suggestion-item::after,
.prescription-candidate-item::after {
    content: '\f054';
    /* fa-chevron-right */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    color: inherit;
}

.book-suggestion-item:hover::after,
.prescription-candidate-item:hover::after {
    opacity: 0.5;
}

.prescription-candidate-item,
.book-suggestion-item {
    position: relative;
    /* For absolute positioning of arrow */
}
