/**
 * 병원서류·이미지AI 공통 레이아웃
 * - 두 페이지 모두 이 파일만 공유
 * - 페이지 전용: hospital_ai.css (병원서류), image_ai.css (이미지AI)
 *
 * 시각: /unified_search/css/modern_unified.css 토큰·앱 허브와 통일,
 * 배경은 크림·스카이 파스텔(의료 AI 존)로 앱 허브와 차별화.
 */

a, a:hover { text-decoration: none; }

/* ========== 공통: body, wrapper ========== */
body.hospital-document-ai-page {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: var(--gray-800, #1f2937);
    /* 크림-피치 계열로 통일해 우측 청록 기운 제거 */
    background:
        radial-gradient(circle at 0% 0%, rgba(248, 223, 202, 0.28), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(244, 226, 212, 0.24), transparent 24%),
        radial-gradient(circle at 100% 100%, rgba(236, 214, 205, 0.22), transparent 28%),
        linear-gradient(180deg, #fcfaf6 0%, #f5efe8 52%, #efe6de 100%);
    background-attachment: fixed;
}

@media (max-width: 768px) {
    body.hospital-document-ai-page {
        background-attachment: scroll;
    }
}

.hospital-document-ai-wrapper {
    min-height: calc(100vh - 200px);
    padding-top: calc(var(--header-height, 70px) + 18px);
    padding-bottom: 32px;
    background: transparent;
}

.hospital-document-ai-shell {
    position: relative;
    padding: 8px 0 0;
}

/* ========== 페이지 타이틀 (앱 service-studio-topbar 계열 글래스 카드) ========== */
.hospital-page-title {
    background: rgba(255, 250, 245, 0.84);
    color: var(--gray-900, #111827);
    padding: 16px 18px;
    margin: 0 auto 16px;
    max-width: 1160px;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius-2xl, 24px);
    border: 1px solid rgba(86, 103, 122, 0.08);
    box-shadow: 0 20px 46px rgba(67, 79, 92, 0.09);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

/* Bootstrap .container 미사용: 카드 안을 가로 전폭·대칭으로 채움 */
.hospital-page-title .hospital-title-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hospital-title-inner { display: flex; align-items: center; gap: 12px; justify-content: flex-start; }
.hospital-title-text { display: flex; flex-direction: column; gap: 6px; }
.hospital-title-heading { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hospital-title-heading h1 { font-size: clamp(1.45rem, 2.15vw, 2.35rem); font-weight: 800; margin: 0; color: var(--gray-900, #0f172a); line-height: 1.08; letter-spacing: -0.02em; }
.hospital-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 650;
    color: #a55d2e;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 244, 234, 0.94);
    border: 1px solid rgba(212, 138, 88, 0.14);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}
.hospital-title-badge i { color: #c97a3e; }
.hospital-title-subtext { font-size: 0.9375rem; font-weight: 500; color: #5a473a; margin: 0; line-height: 1.55; }

.hospital-mode-switch {
    width: min(620px, 100%);
    flex: 0 0 auto;
}

.hospital-mode-switch .hub-mode-pill {
    min-height: 104px;
    text-decoration: none !important;
}

.hospital-mode-switch .hub-mode-pill:hover,
.hospital-mode-switch .hub-mode-pill:focus,
.hospital-mode-switch .hub-mode-pill:focus-visible,
.hospital-mode-switch .hub-mode-pill:active {
    text-decoration: none !important;
}

.hospital-mode-switch .hub-mode-pill strong {
    font-size: 15px;
    line-height: 1.22;
}

.hospital-mode-switch .hub-mode-pill span {
    font-size: 12px;
    line-height: 1.4;
}

@media (min-width: 1201px) {
    .hospital-page-title {
        padding: 14px 16px;
        margin: 0 auto 14px;
        gap: 16px;
    }

    .hospital-title-heading h1 {
        font-size: 1.9rem;
    }

    .hospital-mode-switch .hub-mode-pill {
        min-height: 96px;
        padding: 12px 14px;
    }

    .hospital-mode-switch .hub-mode-pill strong {
        font-size: 14px;
    }

    .hospital-mode-switch .hub-mode-pill span {
        font-size: 11px;
        line-height: 1.35;
    }
}

/* ========== 컨테이너·그리드 ========== */
.hospital-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hospital-main-row { gap: 10px; }

.hospital-container .row {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.hospital-container .row:not(.hospital-main-row) [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    position: relative;
    width: 100%;
}

.hospital-container .row.hospital-main-row .col-lg-3 {
    flex: 0 0 25%;
    max-width: 25%;
    width: auto;
}

.hospital-container .row.hospital-main-row .col-lg-9 {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
}

.hospital-container .row.hospital-main-row [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    position: relative;
}

/* 헤더와 같은 수직선: 바깥열은 컨테이너 패딩(20px)만 쓰고, BS gutter는 두 열 사이에만 */
.hospital-document-ai-wrapper .hospital-container .row.hospital-main-row > [class*="col-"]:first-child {
    padding-left: 15px;
}
.hospital-document-ai-wrapper .hospital-container .row.hospital-main-row > [class*="col-"]:last-child {
    padding-right: 0;
}

@media (min-width: 768px) and (max-width: 991px) {
    .hospital-container .row .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .hospital-container .row .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
}

/* ========== 사이드바·채팅 공통 시각 (service-studio-panel 계열) ========== */
.hospital-document-ai-wrapper .hospital-sidebar {
    background: rgba(255, 250, 245, 0.84);
    border: 1px solid rgba(86, 103, 122, 0.09);
    border-radius: var(--radius-2xl, 24px);
    box-shadow: 0 22px 52px rgba(67, 79, 92, 0.09);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 16px;
    min-height: 600px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.hospital-document-ai-wrapper .hospital-sidebar .sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #3f3229;
    margin-bottom: 0;
    padding-bottom: 6px;
    border-bottom: none;
}

.hospital-document-ai-wrapper .hospital-sidebar .sidebar-title i {
    color: #9f6944;
    font-size: 0.8rem;
}

/* AI 서비스 탭 — 앱 hub-mode-pill 톤(라운드·섀도), 활성은 보험/의료 틸 그라데이션 */
.hospital-document-ai-wrapper .ai-service-tabs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.hospital-document-ai-wrapper .ai-service-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(80, 114, 139, 0.12);
    border-radius: var(--radius-lg, 14px);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700, #374151);
    text-decoration: none !important;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.06));
    transition: transform var(--transition-normal, 0.25s ease), box-shadow var(--transition-normal, 0.25s ease), border-color var(--transition-normal, 0.25s ease), background var(--transition-normal, 0.25s ease);
}
.hospital-document-ai-wrapper .ai-service-tab:hover {
    border-color: rgba(80, 114, 139, 0.28);
    background: rgba(242, 247, 250, 0.96);
    color: #50728b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.08));
}
.hospital-document-ai-wrapper .ai-service-tab.active {
    background: linear-gradient(135deg, #6f8da3 0%, #50728b 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 32px rgba(80, 114, 139, 0.28);
}
.hospital-document-ai-wrapper .ai-service-tab.active:hover {
    opacity: 0.96;
    color: #fff;
    transform: translateY(-1px);
}
.hospital-document-ai-wrapper .ai-service-tab i { font-size: 1.05rem; width: 22px; text-align: center; }

.hospital-document-ai-wrapper .service-note {
    font-size: 0.82rem;
    padding: 10px 12px;
    background: rgba(251, 247, 242, 0.78);
    border: 1px solid rgba(212, 138, 88, 0.08);
    border-radius: var(--radius-md, 10px);
    color: #5c493c;
    line-height: 1.5;
}
.hospital-document-ai-wrapper .service-note i { color: #a55d2e; }

/* 업로드 영역 공통 */
.hospital-document-ai-wrapper .upload-zone {
    border: 1px dashed rgba(181, 142, 112, 0.28);
    border-radius: var(--radius-lg, 14px);
    padding: 16px 10px;
    background: rgba(255, 245, 238, 0.78);
    transition: border-color 0.2s ease, background 0.2s ease;
}
.hospital-document-ai-wrapper .upload-zone:hover {
    border-color: rgba(159, 105, 68, 0.42);
    background: rgba(252, 238, 228, 0.92);
}
.hospital-document-ai-wrapper .upload-zone i { color: #9f6944; font-size: 1.5rem; }
.hospital-document-ai-wrapper .upload-zone p { font-size: 0.8rem; color: #5f4d40; }

/* 채팅 영역 */
.hospital-document-ai-wrapper .hospital-chat {
    border: 1px solid rgba(86, 103, 122, 0.09);
    box-shadow: 0 22px 52px rgba(67, 79, 92, 0.09);
    border-radius: var(--radius-2xl, 24px);
    min-height: calc(100vh - 250px);
    background: rgba(255, 250, 245, 0.84);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hospital-document-ai-wrapper .chat-header {
    border-bottom: 1px solid rgba(86, 103, 122, 0.1);
    background: rgba(255, 250, 245, 0.84);
}

/* ========== 모바일 반응형 ========== */
@media (max-width: 991.98px) {
    .hospital-document-ai-wrapper {
        padding-top: calc(var(--header-height, 70px) + 10px);
        padding-bottom: 28px;
    }
}

@media (max-width: 480px) {
    .hospital-document-ai-wrapper {
        padding-top: calc(var(--header-height, 70px) + 10px);
    }

    .hospital-page-title {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 12px;
        padding: 14px;
        border-radius: 18px;
    }

    .hospital-mode-switch {
        width: 100%;
    }

    .hospital-mode-switch.hub-mode-switch {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .hospital-mode-switch .hub-mode-pill {
        min-height: 78px;
        padding: 10px 8px;
        border-radius: 14px;
    }

    .hospital-mode-switch .hub-mode-pill strong {
        font-size: 12px;
        line-height: 1.2;
    }

    .hospital-mode-switch .hub-mode-pill span {
        font-size: 10px;
        line-height: 1.3;
    }

    .hospital-container {
        padding: 0 5px;
    }

    .hospital-document-ai-wrapper .hospital-sidebar,
    .hospital-document-ai-wrapper .hospital-chat {
        border-radius: 18px;
    }
}

@media (max-width: 1024px) {
    .hospital-document-ai-wrapper { padding-top: calc(var(--header-height, 70px) + 8px); }
    /* 전폭이어도 좌우 패딩·마진 대칭 유지 — margin-left/right만 0으로 두면 auto 중앙정렬이 깨져 왼쪽 붕 뜸 */
    .hospital-page-title {
        max-width: none;
        width: 100%;
        margin: 0 0 14px 0;
        padding-left: 16px;
        padding-right: 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-sizing: border-box;
    }
    .hospital-container { padding: 0; }
    .hospital-container .row.g-4 > main.hospital-chat {
        padding-left: 0;
        padding-right: 0;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .hospital-document-ai-wrapper .chat-header {
        position: sticky;
        z-index: 100;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px 16px !important;
        margin: 0 10px;
        width: calc(100% - 20px);
        background: linear-gradient(180deg, rgba(84, 68, 57, 0.94) 0%, rgba(66, 53, 45, 0.94) 100%) !important;
        border-radius: 16px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 10px 24px rgba(66, 53, 45, 0.18);
    }
    .hospital-document-ai-wrapper .chat-header h5 {
        display: flex;
        align-items: center;
        margin: 0;
        color: #ffffff !important;
        font-size: 1.05rem !important;
        font-weight: 700 !important;
    }
    .hospital-document-ai-wrapper .chat-header h5 i { color: #ffffff !important; }
    .hospital-document-ai-wrapper .chat-header-actions {
        display: flex;
        align-items: center;
    }
    .hospital-document-ai-wrapper .chat-header-icon-btn {
        background: rgba(255, 245, 238, 0.96) !important;
        border-color: rgba(181, 142, 112, 0.2) !important;
        color: #7b5a44 !important;
    }
    .hospital-document-ai-wrapper .chat-header-icon-btn:hover {
        background: rgba(252, 238, 228, 0.98) !important;
        color: #8d5a39 !important;
    }
    .hospital-sidebar { display: none; }
    .hospital-chat { margin-bottom: 56px; border: none; border-radius: 0; box-shadow: none; }
}

@media (max-width: 992px) {
    .hospital-chat { height: auto; min-height: 500px; }
    .hospital-sidebar { max-height: none; margin-bottom: 20px; }
}
