/* ============================================================
   web/common.css — 사용자 웹 공통 스타일
   모든 웹 페이지에 적용되는 기본 스타일을 정의한다.
   개별 모듈 CSS에는 해당 모듈 전용 클래스만 작성한다.
============================================================ */

/* ---------- CSS 변수 ---------- */
:root {
    --main-blue:       #0062FF;
    --trust-navy:      #0A1931;
    --bg-white:        #FFFFFF;
    --sub-light-gray:  #F7F9FC;
    --text-black:      #1A1A1A;
    --text-muted:      #666666;
    --border-gray:     #E5E7EB;  /* 범용 테두리 색상 */
}

/* ---------- 가로 오버플로우 차단 ---------- */
/* 화면 밖 오른쪽에 대기하는 모바일 메뉴(fixed) 등이 뷰포트 가로 폭을 넘겨
   작은 화면 우측에 흰 띠(가로 스크롤)를 만드는 것을 막는다.
   fixed 요소는 body의 overflow-x:hidden으로 잘리지 않으므로 루트(html)에 건다.
   hidden 대신 clip 사용 — 스크롤 컨테이너를 만들지 않아 sticky가 깨지지 않는다. */
html {
    overflow-x: clip;
}

/* ---------- 모달/팝업 열림 시 배경(뷰포트) 스크롤 잠금 ----------
   위 html{overflow-x:clip} 때문에 body{overflow:hidden} 으로는 뷰포트 스크롤이
   잠기지 않는다(스크롤 주체가 html). 따라서 스크롤 주체인 html 에 직접 적용한다.
   JS 에서 모달 열기/닫기 시 document.documentElement 에 .modal-open 을 토글한다. */
html.modal-open {
    overflow: hidden;
}

/* ---------- 기본 body ---------- */
body {
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
                 system-ui, Roboto, "Helvetica Neue", "Segoe UI",
                 "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
                 "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-white);
    color: var(--text-black);
    line-height: 1.6;
    letter-spacing: -0.02em;
}
/* 모바일 메뉴/모달 열릴 때 배경 스크롤 잠금은 html.modal-open 로 통일 (위 참고) */

/* ---------- 줄바꿈 보조 ---------- */
.text-pretty {
    text-wrap: pretty;
    word-break: keep-all;
}
.keep-all {
    word-break: keep-all;
}

/* ---------- 로고 이미지 필터 ---------- */
/* 어두운 배경 위 로고: 흰색으로 반전 */
img.nav-logo-white { filter: brightness(0) invert(1) !important; }
/* 밝은 배경 위 로고: 원색 유지 (파란 색조) */
img.nav-logo-blue  { filter: hue-rotate(190deg) saturate(1.5) !important; }

/* ---------- 네비게이션 공통 ---------- */

/* 스크롤 후 헤더 배경 */
nav.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.08);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* 스크롤 후 공통적으로 다크 텍스트 전환 */
nav.scrolled .nav-link:not(.active) { color: var(--trust-navy) !important; }
nav.scrolled .nav-link.active       { color: #3b82f6 !important; }
nav.scrolled .logo-text             { color: var(--trust-navy) !important; }
nav.scrolled .btn-nav-secondary:not(.active) {
    background-color: var(--trust-navy);
    border-color: var(--trust-navy);
    color: white;
}
nav.scrolled .nav-divider    { background-color: rgba(10, 25, 49, 0.2) !important; }
nav.scrolled .btn-login-text { color: var(--trust-navy) !important; }
nav.scrolled #menu-toggle    { color: var(--trust-navy) !important; }

/* 네비게이션 링크 공통 */
.nav-link      { transition: color 0.2s; }
.logo-text     { transition: color 0.3s; }
.btn-login-text { background: none; border: none; cursor: pointer; }

/* 활성 메뉴 표시 */
.nav-link.active { color: #3b82f6 !important; position: relative; }
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #3b82f6;
    border-radius: 2px;
}

/* ---------- 네비게이션 버튼 ---------- */
.btn-nav-primary {
    background: linear-gradient(135deg, #0062FF 0%, #004ecc 100%);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0, 98, 255, 0.2);
    transition: all 0.3s ease;
}
@media (min-width: 1280px) {
    .btn-nav-primary { font-size: 0.75rem; padding: 0.6rem 1.1rem; }
}

/* 다크 히어로 페이지의 보조 버튼 (반투명 흰색) */
.btn-nav-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 0.9rem;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    transition: all 0.3s ease;
}
@media (min-width: 1280px) {
    .btn-nav-secondary { font-size: 0.75rem; padding: 0.6rem 1.1rem; }
}

/* 라이트 배경 페이지의 보조 버튼 오버라이드 */
.btn-nav-secondary-light {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(10, 25, 49, 0.2);
    color: var(--trust-navy);
}

/* 모바일 메뉴 링크 활성 */
.mobile-nav-link.active {
    color: #2563eb;
}
.mobile-nav-link.active::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1em;
    background-color: #2563eb;
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

/* 활성 버튼 — 파란 그라디언트 */
.btn-nav-secondary.active,
.btn-nav-secondary-light.active {
    background: linear-gradient(135deg, #0062FF 0%, #004ecc 100%) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 4px 6px -1px rgba(0, 98, 255, 0.4), 0 2px 4px -1px rgba(0, 98, 255, 0.2);
    backdrop-filter: none;
}

/* ---------- 모달 오버레이 ---------- */
.modal-overlay {
    background-color: rgba(10, 25, 49, 0.6);
    backdrop-filter: blur(4px);
}

/* ---------- 섹션 강조선 ---------- */
.section-title-line {
    width: 40px;
    height: 3px;
    background-color: var(--main-blue);
    margin-top: 1rem;
    border-radius: 2px;
}

/* ---------- 커스텀 스크롤바 ---------- */
.custom-scrollbar::-webkit-scrollbar       { width: 8px; }
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 99px;
    margin: 20px 0;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 99px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.25);
}

/* ---------- 애니메이션 ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.8s ease-out forwards; }

/* ---------- 웹 공통 폼 셀렉트 화살표 ----------
   네이티브 select 는 브라우저 기본 화살표가 테두리에 붙어 여백을 줄 수 없다.
   appearance:none 으로 기본 화살표를 없애고 커스텀 SVG 화살표를 배경으로 넣는다.
   오른쪽 패딩(화살표 자리 + 여백)은 각 select 의 Tailwind pr-12 로 확보한다. */
.web-form-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.1rem;
}

/* ---------- 패밀리사이트 드롭다운 (푸터) ---------- */
.family-select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    /* 오른쪽 패딩은 화살표 여백을 확보한다 */
    padding: 0.6rem 2rem 0.6rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}
.family-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- 토스트 메시지 ---------- */
.custom-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9999;
    white-space: nowrap;
}
.custom-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.custom-toast.toast-success { background-color: #1e293b; }
.custom-toast.toast-error   { background-color: #ef4444; }

/* ---------- 폼 공통 ---------- */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    margin-left: 0.25rem;
}
.form-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    outline: none;
    transition: all 0.2s;
    font-weight: 700;
}
.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ---------- 로딩 레이어 ---------- */
.loading-image-layer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}
.loading-image-layer.show { display: flex; }
.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #e2e8f0;
    border-top-color: #0062FF;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
