/* ── 전역 하단 전화상담 신청바 (cbbar-)
 *  PC      = 풀폭 가로 바. 푸터(#322d29)보다 살짝 어두운 동계열 톤 → 푸터에 이어지는 밴드.
 *  모바일  = 슬림 CTA 1줄(평소) → 탭하면 위로 바텀시트 펼침.
 *  단위 = px 고정. 이 사이트는 html{font-size:10px}(모바일 7~8px)로 반응형 스케일하므로,
 *         플로팅 위젯은 px 로 크기를 고정한다(quickbar 와 동일 방침).
 *  클래스는 cbbar 접두로 front.css/style.css 와 충돌 차단(feedback_front_css_class_collision).
 * ──────────────────────────────────────────────────────────── */

/* 과도 스크롤(고무줄 바운스) 시 문서 밖(기준선 너머)으로 흰 캔버스가 비치던 문제 —
 * 바운스는 유지하고 캔버스(루트) 전체를 푸터색으로 칠한다. 본문(body)은 흰색으로 문서 영역을
 * 덮으므로 일반 화면엔 영향 0. → 상·하단 오버스크롤 모두 푸터색(#322d29)으로 채워짐. */
html { background-color: #322d29; }
body { background-color: var(--paper, #fff); }   /* 디자인 기본 배경(=흰색)으로 문서영역 덮음 */

/* 바가 있는 페이지는 푸터 "원래 하단 여백(7rem)"은 그대로 두고 그 아래에 바 높이를 추가한다.
 * = calc(원래 7rem + 바 높이). 추가분은 푸터색(#322d29)이라:
 *   ① 고정바 뒤·아래가 항상 푸터색 → 스크롤 시 흰 틈 안 드러남
 *   ② 푸터가 원래 보이던 영역(7rem 여백 포함) 그대로 + 바는 그 아래 추가 → 바가 푸터를 잠식 안 함.
 * front.css footer 원래 padding 7rem 0. PC 바 ≈71px, 모바일 CTA ≈50px. */
body.has-cbbar footer { padding-bottom: calc(7rem + 72px); }

.cbbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    font-family: inherit;
}

/* 공통 입력 톤 */
.cbbar input[type="text"],
.cbbar input[type="tel"],
.cbbar select {
    border: 1px solid #cfcac4;
    border-radius: 6px;
    padding: 0 14px;
    font-size: 15px;
    background: #fff;
    color: #222;
    box-sizing: border-box;
}
.cbbar input::placeholder { color: #999; }
.cbbar input:focus,
.cbbar select:focus { outline: 2px solid var(--color, #994699); outline-offset: 1px; border-color: var(--color, #994699); }

/* 시간대 셀렉트 — 네이티브 화살표 제거 후 커스텀 셰브론(브랜드색)으로 "드롭다운"임을 명확히.
   입력칸과 구분되도록 우측 셰브론 + 여유 padding. */
.cbbar select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23994699' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 34px;
    cursor: pointer;
}

.cbbar__cta { display: none; }
.cbbar__lbl { display: none; }
.cbbar__head { display: none; }
.cbbar__heading { display: flex; flex-direction: column; gap: 2px; }
.cbbar__subtitle { font-size: 13px; line-height: 1.3; }

/* ── 약관 동의 ──────────────────────────────────────────────── */
.cbbar__check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: #444; cursor: pointer; }
.cbbar__check input { width: 18px; height: 18px; accent-color: var(--color, #994699); }
.cbbar__terms { font-size: 13px; color: var(--color, #994699); text-decoration: underline; text-underline-offset: 2px; }

/* ── 신청 버튼 ──────────────────────────────────────────────── */
.cbbar__submit {
    background: var(--color, #994699);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.cbbar__submit:hover { background: var(--color-deep, #6f336f); }
.cbbar__submit:disabled { opacity: 0.6; cursor: default; }

/* ── 필드 검증 표시: 잘못된 입력칸 빨간 테두리 ──────────────── */
.cbbar .cbbar__field input.is-err,
.cbbar .cbbar__field select.is-err { border-color: #e0533f; box-shadow: 0 0 0 1px #e0533f; }

/* ── 토스트(완료/오류 알림) — 화면 하단 가운데에 떠서 자동 사라짐 ── */
.cbbar-toast {
    position: fixed;
    left: 50%;
    bottom: 104px;
    transform: translateX(-50%) translateY(12px);
    z-index: 2000;
    max-width: min(90vw, 460px);
    padding: 14px 24px;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    text-align: center;
    box-shadow: 0 10px 30px -8px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.cbbar-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cbbar-toast.is-ok  { background: #2e9e63; }
.cbbar-toast.is-err { background: #d0432f; }
@media (max-width: 768px) { .cbbar-toast { bottom: 84px; left: 16px; right: 16px; transform: translateY(12px); max-width: none; } .cbbar-toast.is-show { transform: translateY(0); } }

/* ── PC (≥769px) — 풀폭 가로 바, 큼직한 입력(높이 46px) ─────────── */
@media (min-width: 769px) {
    .cbbar { background: #2b2620; }
    .cbbar__form {
        display: flex;
        align-items: center;
        justify-content: center;   /* 타이틀+입력폼+약관+버튼을 한 덩어리로 가운데 정렬 */
        gap: 14px;
        width: 100%;
        margin: 0;
        padding: 12px 32px;
        background: #2b2620;
        border-top: 1px solid rgba(255,255,255,0.10);   /* 푸터와 구분되는 얇은 경계선 */
        box-shadow: 0 -6px 20px -10px rgba(0,0,0,0.45);
    }
    .cbbar__head { display: flex; align-items: center; }
    /* 제목 글씨 키우고 부제 추가. */
    .cbbar__title { font-size: 21px; color: #efe9e2; white-space: nowrap; letter-spacing: 0.01em; }
    .cbbar__subtitle { color: #b8b1a9; white-space: nowrap; }
    .cbbar__close { display: none; }
    /* 제목을 입력폼 쪽에 붙임 = fields 를 늘리지/가운데정렬하지 않고 제목 바로 뒤에 배치,
       약관+버튼은 margin-left:auto 로 오른쪽 끝으로. 입력 컴포넌트 간격은 넓힘(18px). */
    .cbbar__fields { display: flex; align-items: center; gap: 18px; flex: 0 1 auto; justify-content: flex-start; }
    .cbbar__field { display: flex; }
    .cbbar__fields input,
    .cbbar__fields select { height: 46px; font-size: 15px; }
    .cbbar__field--name  input { width: 150px; }
    .cbbar__field--phone input { width: 210px; }
    .cbbar__field--slot  select { width: 180px; }
    .cbbar__agree { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-left: 6px; }
    .cbbar__check { color: #d8d2cb; font-size: 14px; }
    .cbbar__terms { color: #e0a9e0; }                   /* 밝은 플럼 — 어두운 배경 대비 */
    .cbbar__submit { height: 46px; padding: 0 30px; font-size: 16px; white-space: nowrap; }
}

/* ── 모바일 (≤768px) — 슬림 CTA → 바텀시트 ─────────────────── */
@media (max-width: 768px) {
    body.has-cbbar footer { padding-bottom: calc(7rem + 52px); }

    /* 평소: 슬림 CTA 만 보임 */
    .cbbar__cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 15px 16px;
        background: var(--color, #994699);
        color: #fff;
        border: none;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 -4px 14px -6px rgba(0,0,0,0.3);
    }
    .cbbar__form { display: none; }

    /* 펼침: CTA 숨기고 바텀시트 노출 */
    .cbbar[data-state="open"] .cbbar__cta { display: none; }
    .cbbar[data-state="open"] .cbbar__form {
        display: block;
        background: #fff;
        padding: 16px 18px 20px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -8px 28px -8px rgba(0,0,0,0.35);
        animation: cbbar-rise 0.22s ease-out;
    }
    @keyframes cbbar-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }

    /* 펼침 시 뒤 배경 딤(바깥 탭하면 닫힘은 JS) */
    .cbbar[data-state="open"]::before {
        content: "";
        position: fixed; inset: 0 0 0 0;
        background: rgba(0,0,0,0.35);
        z-index: -1;
    }
    .cbbar[data-state="open"] { z-index: 1200; }

    .cbbar__head {
        display: flex; align-items: center; justify-content: space-between;
        margin-bottom: 14px;
    }
    .cbbar__title { font-size: 18px; color: var(--color-deep, #6f336f); white-space: normal; }
    .cbbar__subtitle { color: #888; white-space: normal; }
    .cbbar__close {
        background: none; border: none; font-size: 22px; line-height: 1;
        color: #888; cursor: pointer; padding: 2px 6px;
    }
    .cbbar__fields { display: flex; flex-direction: column; gap: 11px; }
    .cbbar__field { display: flex; flex-direction: column; gap: 5px; }
    .cbbar__lbl { display: block; font-size: 13px; font-weight: 600; color: #444; }
    .cbbar__field input,
    .cbbar__field select { width: 100%; height: 50px; font-size: 16px; }
    .cbbar__agree { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
    .cbbar__check { font-size: 15px; }
    .cbbar__submit { width: 100%; height: 52px; font-size: 17px; }
}
