/* ============================================================
   MEDI82 사용자 페이지 공통 스타일
   파일명: front.css
   배치 경로: /css/front.css
   ============================================================ */
/* --- CSS 변수 --- */
:root {
    --pink: #E06B8A;
    --pink-light: #FCF0F3;
    --pink-dark: #C4556E;
    --dark: #3C3C3C;
    --dark-soft: #5A5A5A;
    --gray: #9E9E9E;
    --gray-light: #F5F5F5;
    --border: #E8E8E8;
    --white: #FFFFFF;
    --blue: #4A90D9;
    --green: #4CAF50;
    --orange: #FF9800;
    --red: #E53935;
    --max-width: 1200px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --transition: all 0.2s ease;
}
/* --- 리셋 --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }    /* 가로 스크롤 방지 (html에만, body는 fixed 작동하도록 유지) */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
    color: var(--dark);
    background: var(--white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
}
a { color: var(--pink); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--pink-dark); }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
/* ============================================================
   쿠키 동의 배너
   ============================================================ */
.cookie-banner {
    position: fixed;                 /* 상단 고정 */
    left: 0;
    right: 0;
    top: 0;
    z-index: 200;                    /* 헤더(100)보다 위 */
    background: #202124;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.cookie-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.cookie-text { font-size: 13px; line-height: 1.5; color: #E8EAED; flex: 1; }
.cookie-btns { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.cookie-btn.accept { background: var(--pink); color: #fff; }
.cookie-btn.accept:hover { background: var(--pink-dark); }
.cookie-btn.decline { background: rgba(255,255,255,0.1); color: #fff; }
.cookie-btn.decline:hover { background: rgba(255,255,255,0.2); }
/* ============================================================
   사이트 헤더
   ============================================================ */
.site-header {
    height: 60px;
    background: rgba(255, 255, 255, 0.75);   /* 반투명 흰색 */
    backdrop-filter: blur(10px);              /* 유리 효과 */
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(232, 232, 232, 0.6);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}
/* fixed 헤더 높이만큼 site-main에만 공간 확보 (쿠키 배너는 영향 X) */
.site-main { margin-top: 60px; }
.header-inner {
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-link { display: flex; align-items: center; text-decoration: none; }
.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: 6px;
}
.logo-suffix {
    font-size: 15px;
    font-weight: 600;
    color: var(--pink);
    margin-left: 2px;
}
.header-right { display: flex; gap: 12px; align-items: center; }

/* ============================================================
   홈페이지 초기화 버튼
   - 위치: 헤더 우측 "자동 언어 감지" 배지 왼쪽
   - 형태: 원형 + 테두리 없음 + 중앙 ↻ 화살표 아이콘
   - 높이: 자동언어감지 배지(약 26px)와 동일한 수준
   - 터치 영역: 시각적 크기보다 20~30% 넓게 (모바일 터치 정확도 개선)
     → padding 으로 영역 확장, 실제 원형은 내부 아이콘 span 에 배경색 적용
   ============================================================ */
.reset-btn {
    /* 버튼 자체 = 터치 영역 (시각 원형보다 넓음) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;   /* 전체 클릭 영역 = 26px(아이콘) + 8px(좌우 padding) = 34px */
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}
.reset-btn:hover { opacity: 0.7; }
.reset-btn:active { opacity: 0.5; }

/* 실제 시각적 원형 (테두리 없음, 단색 배경) */
.reset-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(252, 240, 243, 0.7);
    color: #E06B8A;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    /* ↻ 살짝 위로 보정 (폰트 baseline 때문) */
    padding-bottom: 2px;
    user-select: none;
}
.lang-sel {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--white);
    cursor: pointer;
    font-family: inherit;
    color: var(--dark);
}
.lang-sel:focus { outline: none; border-color: var(--pink); }
/* ============================================================
   메인 영역 (배경 이미지 + 반투명 오버레이)
   ============================================================ */
.site-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: url('/images/bg.png') center/cover no-repeat fixed;
}
.site-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 0;
    pointer-events: none;
}
.site-main > * {
    position: relative;
    z-index: 1;
}
/* ============================================================
   히어로 영역 (초기 화면)
   ============================================================ */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: calc(100vh - 200px);
    transform: translateY(-50px);   /* 중간 영역 내용 위로 50px 이동 */
}
.hero-logo { margin-bottom: 12px; }
.hero-logo-text {
    font-size: 52px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: 10px;
}
.hero-logo-suffix {
    font-size: 28px;
    font-weight: 600;
    color: var(--pink);
    margin-left: 4px;
}
.hero-subtitle {
    font-size: 17px;
    color: var(--dark-soft);
    line-height: 1.7;
    margin-bottom: 36px;
}
.hero-subtitle small { font-size: 14px; color: var(--gray); }
/* --- 검색바 (반투명) --- */
.search-box {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 32px;
}
.search-wrap {
    display: flex;
    align-items: center;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 32px;
    padding: 5px 6px 5px 22px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.2s;
}
.search-wrap:focus-within {
    border-color: var(--pink);
    background: rgba(255, 255, 255, 0.85);
}
.search-icon { font-size: 20px; margin-right: 10px; color: var(--gray); }
.search-input {
    flex: 1;
    min-width: 0;           /* flex 자식 overflow 방지 (모바일 화살표 탈출 수정) */
    border: none;
    outline: none;
    font-size: 16px;
    padding: 14px 0 14px 10px;   /* 좌측 패딩 10px (타이핑 시작 위치 우측 이동) */
    background: transparent;
    font-family: inherit;
    color: var(--dark);
    caret-color: transparent;    /* 기본 상태: 브라우저 기본 커서 숨김 (핑크 커서와 겹침 방지) */
}
.search-input:focus {
    caret-color: auto;           /* focus 시 브라우저 기본 커서 복원 */
}
.search-input::placeholder { color: var(--gray); }
.search-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--pink);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.search-btn:hover { background: var(--pink-dark); }
.search-btn:disabled { background: var(--gray); cursor: default; }
/* --- 추천 질문 카드 --- */
.suggest-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 560px;
    width: 100%;
    margin: 0 auto 40px;
}
.suggest-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    font-size: 16px;   /* 기존 14px → +2px */
    color: var(--dark);
    text-align: left;
    font-family: inherit;
    transition: all 0.15s;
}
.suggest-card:hover {
    background: rgba(252, 240, 243, 0.8);
    border-color: var(--pink);
}
.suggest-card .s-icon { font-size: 22px; flex-shrink: 0; }
/* --- 히어로 하단 배지 --- */
.hero-badges {
    display: flex;
    gap: 28px;
    font-size: 15px;   /* 기존 13px → +2px */
    color: var(--dark-soft);
    flex-wrap: wrap;
    justify-content: center;
}
/* ============================================================
   채팅 영역 (대화 모드)
   ============================================================ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 200px);
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}
.chat-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-start;
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-avatar.av-user { background: #FFF4B8; color: #191919; }   /* 옅은 노란색 */
.chat-avatar.av-ai { background: var(--pink-light); color: var(--pink); }
.chat-avatar.av-admin { background: var(--pink); color: #fff; }
.chat-bubble {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.7;
    word-break: break-word;
}
.chat-bubble.b-user {
    background: #FFF4B8;           /* 옅은 노란색 */
    color: #191919;                /* 진한 검정 (가독성) */
    border-top-right-radius: 4px;
}
.chat-bubble.b-ai {
    background: rgba(255, 255, 255, 0.85);
    color: var(--dark);
    border-top-left-radius: 4px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chat-bubble.b-admin {
    background: var(--pink);
    color: #fff;
    border-top-left-radius: 4px;
}
.chat-bubble p { margin: 0; }
.chat-bubble p + p { margin-top: 8px; }
.chat-bubble strong { font-weight: 700; }
/* --- 로딩 상태 --- */
.loading-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
}
.loading-text { font-size: 14px; color: var(--dark-soft); }
.loading-dots { display: inline-flex; gap: 4px; }
.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pink);
    animation: pulse 1s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}
/* --- 하단 입력바 --- */
.chat-input-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chat-input-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
}
.chat-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid rgba(232, 232, 232, 0.7);
    border-radius: 26px;
    padding: 4px 6px 4px 18px;
    background: rgba(245, 245, 245, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.chat-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 12px 0;
    background: transparent;
    font-family: inherit;
}
.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--pink);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.chat-send:hover { background: var(--pink-dark); }
.chat-send:disabled { background: var(--gray); cursor: default; }
/* ============================================================
   사이트 푸터 (3컬럼)
   ============================================================ */
.site-footer {
    background: var(--dark);
    color: rgba(255,255,255,.55);
    padding: 12px 24px;
    font-size: 11px;
    line-height: 1.5;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}
.footer-left { 
    flex-shrink: 0; 
    display: flex; 
    align-items: center; 
    gap: 14px; 
}
.footer-left a {
    color: rgba(255,255,255,.55);
    font-size: 12px;
    transition: color .15s;
}
.footer-left a:hover { color: #fff; }
.footer-center { flex: 1; text-align: center; }
.footer-logo {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #fff;
}
.footer-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 15px;   /* 사용자 조정 (기존 11px → 15px) */
    line-height: 1.6;
}
.footer-right { flex-shrink: 0; display: flex; gap: 8px; }
.footer-right a {
    color: rgba(255,255,255,.45);
    font-size: 10px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 4px;
    transition: all .15s;
}
.footer-right a:hover {
    color: #fff;
    border-color: rgba(255,255,255,.4);
}
/* ============================================================
   반응형 (모바일)
   ============================================================ */
@media (max-width: 768px) {
    /* === 모바일 가로 공백 방지 === */
    .site-header, .site-main, .site-footer { width: 100%; max-width: 100vw; }
    .site-main {
        /* 모바일에서 background fixed는 viewport 계산 오류 빈발 → scroll 전환 */
        background-attachment: scroll;
    }
    
    /* ★ 쿠키 동의 배너 임시 숨김 (추후 높이/레이아웃 재조정 예정) */
    .cookie-banner { display: none !important; }
    .header-inner, .cookie-inner { padding: 0 16px; }
    .cookie-inner {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }
    .hero-logo-text { font-size: 40px; letter-spacing: 6px; }
    .hero-logo-suffix { font-size: 22px; }
    .hero-subtitle { font-size: 15px; padding: 0 16px; }
    
    /* ★ 모바일: 메인 히어로 영역 아래로 50px 이동 (PC는 -50px 유지) */
    .hero { transform: translateY(-10px); }
    .search-box {
        padding: 0;          /* 기존 0 16px → 0 (가로 +32px 확보) */
        margin-left: -8px;   /* 추가 확장 (+16px) → 총 약 +48px */
        margin-right: -8px;
        width: calc(100% + 16px);
    }
    .suggest-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;
        max-width: calc(100% - 75px);   /* 150 → 75px 축소 (요청 반영) */
        margin-left: auto;
        margin-right: auto;
    }
    .suggest-card { font-size: 14px; }   /* 모바일은 기존 크기 유지 */
    
    /* 하단 4건 특징 뱃지 - 2×2 배열 */
    .hero-badges {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px 16px;
        font-size: 12px;
        padding: 0 16px;
        max-width: 340px;
        margin-left: auto;
        margin-right: auto;
        justify-items: start;
    }
    
    /* 헤더 우측 "자동 언어 감지" 뱃지 - 모바일에선 축소 (로고 영역과 겹침/밀림 방지) */
    .header-right .auto-lang-badge {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }
    
    /* 모바일: 초기화 버튼 터치 영역 추가 확장 (작은 아이콘 정확 터치)
       - 아이콘 자체는 약간 축소 (26px) → 배지 높이와 시각 균형
       - padding 을 더 넓혀 실제 터치 가능 영역은 40px 이상 확보 */
    .reset-btn {
        padding: 7px;   /* 26px(아이콘) + 14px(padding) = 40px 터치 영역 */
    }
    .reset-btn-icon {
        width: 26px;
        height: 26px;
        font-size: 19px;
    }
    
    /* 모바일에서만: 자동언어감지 ↔ 초기화 버튼 사이 간격 축소 (50%)
       - 공간 절약 + 터치 충돌 없이 밀착 (padding 으로 터치 영역 확보되어 안전) */
    .header-right {
        gap: 6px;
    }
    .chat-messages { padding: 16px; }
    .chat-bubble { max-width: 85%; font-size: 14px; }
    
    /* ★ 모바일 전용: AI/관리자 메시지 아바타를 버블 안쪽으로 이동
       - 왼쪽 38px(아바타) + 8px(gap) = 약 46px 공간 확보 → 대화 영역 확장
       - CSS ::before 가상요소로 소형 아바타 생성 (HTML 변경 불필요)
       - PC는 이 블록이 적용되지 않아 기존 바깥 아바타 유지 */
    
    /* 바깥쪽 아바타 숨김 (USER는 제외 - 노랑 원은 유지) */
    .chat-msg:not(.user) .chat-avatar.av-ai,
    .chat-msg:not(.user) .chat-avatar.av-admin {
        display: none;
    }
    
    /* ★ 모바일 AI/ADMIN 버블 공통: 최소 가로폭 설정
       - M 아이콘(26px) + 짧은 2~3단어 텍스트가 한 줄에 들어가도록 180px로 설정
       - 긴 답변은 기존대로 자동 줄바꿈 (max-width: 92%) */
    .chat-msg:not(.user) .chat-bubble.b-ai,
    .chat-msg:not(.user) .chat-bubble.b-admin {
        min-width: 180px !important;
        width: fit-content;
        width: -moz-fit-content;
    }
    
    /* AI 버블에 내장 아바타 (float: 첫줄만 옆으로, 둘째줄부터 왼쪽 끝 붙음) */
    .chat-msg:not(.user) .chat-bubble.b-ai {
        padding: 12px 16px;
    }
    .chat-msg:not(.user) .chat-bubble.b-ai::before {
        content: 'M';
        float: left;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: var(--pink-light);
        color: var(--pink);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 700;
        margin: 2px 8px 0 0;
    }
    
    /* ADMIN 버블에 내장 아바타 (핑크 풀컬러 동그라미) */
    .chat-msg:not(.user) .chat-bubble.b-admin {
        padding: 12px 16px;
    }
    .chat-msg:not(.user) .chat-bubble.b-admin::before {
        content: '👤';
        float: left;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: var(--pink);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        margin: 2px 8px 0 0;
    }
    
    /* max-width 확장 - 아바타 공간 없어진 만큼 */
    .chat-msg:not(.user) .chat-bubble { max-width: 92%; }
    
    /* 로딩 버블 - float 처리 (기존 flex와 충돌 회피) */
    .chat-msg:not(.user) .chat-bubble.loading-bubble {
        display: block;   /* flex 해제 */
    }
    .chat-msg:not(.user) .chat-bubble.loading-bubble::after {
        content: '';
        display: block;
        clear: both;
    }
    
    .chat-input-bar { padding: 10px 16px; }
    .footer-inner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .footer-left { justify-content: center; }
    .footer-row { font-size: 14px; }   /* 기존 10px → 비례 증가 */
}
