/* ============================================================
   업무기준 AI 검색 전용 스타일
   ============================================================ */



/* --- API Key 섹션 --- */
.ref-api-section {
    background: #f8f9ff;
    border: 1px solid #e8ecf4;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}
.api-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.api-status.disconnected {
    background: #fff3e0;
    color: #e65100;
}
.api-status.connected {
    background: #e8f5e9;
    color: #2e7d32;
}
.api-hint {
    font-size: 0.75rem;
    color: #bbb;
    margin: 6px 0 12px;
}
.api-hint a {
    color: #667eea;
}
.api-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.api-input-row input {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.api-input-row input:focus {
    border-color: #667eea;
}
.btn-connect {
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-connect:hover {
    background: #5a6fd6;
}
.api-options {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.remember-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    line-height: 1.5;
}
.remember-label input {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    margin-top: 2px;
}
.warning-text {
    font-size: 0.75rem;
    color: #e57373;
}
.tutorial-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}
.disconnect-btn {
    background: none;
    border: none;
    color: #bbb;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: underline;
}

/* --- 수록 문서 안내 --- */
.ref-docs-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
}
.doc-chip {
    font-size: 0.8rem;
    padding: 6px 14px;
    background: #f0f4ff;
    border: 1px solid #d8e0f0;
    border-radius: 20px;
    color: #555;
    font-weight: 500;
}
.doc-chip.coming-soon {
    opacity: 0.5;
    border-style: dashed;
}

/* --- 검색 영역 --- */
.ref-search-area {
    margin-bottom: 24px;
}
.search-box {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #fff;
    border: 2px solid #e0e4f0;
    border-radius: 16px;
    padding: 12px 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.search-box:focus-within {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
}
.search-box textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    color: #333;
}
.search-box textarea::placeholder {
    color: #bbb;
}
.search-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.search-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.search-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* --- 예시 질문 칩 --- */
.example-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    justify-content: center;
}
.example-chip {
    font-size: 0.82rem;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e0e4f0;
    border-radius: 20px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.example-chip:hover {
    background: #f0f4ff;
    border-color: #667eea;
    transform: translateY(-1px);
}

/* --- 진행 상태 표시 --- */
.ref-progress {
    margin: 24px 0;
}
.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    opacity: 0.4;
    transition: opacity 0.3s;
}
.progress-step.active {
    opacity: 1;
}
.progress-step.done {
    opacity: 0.6;
}
.step-indicator {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
}
.progress-step.active .step-dot {
    background: #667eea;
    animation: dotPulse 1s infinite;
}
.progress-step.done .step-dot {
    background: #4caf50;
}
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}
.step-text {
    font-size: 0.9rem;
    color: #666;
}

/* --- 결과 표시 --- */
.ref-result {
    background: #fff;
    border: 1px solid #e0e4f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
    border-bottom: 1px solid #e8ecf4;
}
.result-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.copy-btn {
    background: none;
    border: 1px solid #d0d5e0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    color: #667eea;
    font-family: inherit;
    transition: all 0.2s;
}
.copy-btn:hover {
    background: #f0f4ff;
}
.result-body {
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
}
.result-body strong {
    color: #667eea;
}
.result-sources {
    padding: 12px 20px;
    background: #fafbff;
    border-top: 1px solid #eef0f8;
    font-size: 0.8rem;
    color: #999;
}
.result-sources a {
    color: #667eea;
    text-decoration: underline;
}

/* --- 하단 출처 안내 --- */
.ref-footer-note {
    text-align: center;
    font-size: 0.78rem;
    color: #bbb;
    line-height: 1.8;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}
.ref-footer-note a {
    color: #667eea;
    text-decoration: underline;
}

/* --- 모달 (diary 패턴 재사용) --- */
.ref-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.ref-modal-overlay.show {
    display: flex;
}
.ref-modal {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}
/* 튜토리얼 스텝 */
.tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.btn-primary {
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.w-100 { width: 100%; }

/* --- Toast --- */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}
.toast {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.2s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* --- 반응형 --- */
@media (max-width: 600px) {
    .ref-header h1 { font-size: 1.5rem; }
    .ref-main { padding: 12px 12px 40px; }
    .search-box { padding: 10px; }
    .example-chips { justify-content: flex-start; }
    .api-input-row { flex-direction: column; }
    .btn-connect { width: 100%; }
}
