/* ============================================================
   KH상품권 - 인증(로그인/회원가입) 반응형 디자인 시스템
   - 데스크톱: 좌측 브랜드 패널 + 우측 폼 (스플릿)
   - 태블릿/모바일: 단일 카드
   - 소형 모바일: 풀스크린 앱 스타일
   ============================================================ */

:root {
    --kh-blue: #2563eb;
    --kh-sky: #0ea5e9;
    --kh-ink: #1e3a8a;
    --kh-grad: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --auth-text: #0f172a;
    --auth-sub: #64748b;
    --auth-border: #e5e7eb;
    --auth-field: #f8fafc;
    --auth-danger: #ef4444;
    --auth-success: #10b981;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    box-sizing: border-box;
    background: #f5f7fb;
    background-image:
        radial-gradient(1100px 460px at 50% -160px, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0) 70%),
        radial-gradient(900px 380px at 110% 0%, rgba(14, 165, 233, 0.10) 0%, rgba(14, 165, 233, 0) 60%);
    background-attachment: fixed;
    font-family: 'Apple SD Gothic Neo', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', sans-serif;
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
}

.auth-body * { box-sizing: border-box; }

/* ---------- 셸(카드 컨테이너) ---------- */
/* 제로핀형: 밝은 배경 위 단일 중앙 화이트 카드 */
.auth-shell {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    display: block;
    animation: authIn 0.5s ease-out;
}

@keyframes authIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 브랜드 패널 (데스크톱 좌측) ---------- */
.auth-brand {
    position: relative;
    background: var(--kh-grad);
    color: #fff;
    padding: clamp(40px, 4vw, 60px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 26px;
    overflow: hidden;
    isolation: isolate;
}
.auth-brand::before,
.auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    z-index: -1;
}
.auth-brand::before { width: 260px; height: 260px; top: -90px; right: -70px; }
.auth-brand::after  { width: 200px; height: 200px; bottom: -80px; left: -60px; background: rgba(255,255,255,0.08); }

.brand-badge {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    animation: authFloat 3.5s ease-in-out infinite;
}
.brand-badge b { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: 1px; }
.brand-badge span { font-size: 12px; font-weight: 700; margin-top: 3px; opacity: 0.95; }

@keyframes authFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

.auth-brand h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: -0.5px; }
.brand-tag { margin: 8px 0 0; font-size: clamp(14px, 1.6vw, 16px); line-height: 1.6; color: rgba(255, 255, 255, 0.9); }

.brand-points { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.brand-points li { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.95); }
.brand-points li i {
    flex: none;
    width: 34px; height: 34px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    font-size: 15px;
}

/* 단일 카드 레이아웃에서는 브랜드 패널 숨김 */
.auth-brand { display: none !important; }

/* ---------- 폼 패널 ---------- */
.auth-panel {
    padding: clamp(30px, 5vw, 44px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.auth-card { width: 100%; }

/* 상단 브랜드 로고 (항상 표시) */
.auth-logo-sm {
    display: flex;
    width: 66px; height: 66px;
    border-radius: 19px;
    background: var(--kh-grad);
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.4);
}
.auth-logo-sm b { font-size: 22px; font-weight: 900; line-height: 1; }
.auth-logo-sm span { font-size: 10px; font-weight: 700; margin-top: 2px; }

.auth-head { margin-bottom: 24px; text-align: center; }
.auth-head h1 { margin: 0 0 6px; font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; letter-spacing: -0.4px; }
.auth-head p { margin: 0; color: var(--auth-sub); font-size: 14px; }
.auth-head.center { text-align: center; }

/* ---------- 입력 ---------- */
.input-wrapper { position: relative; margin-bottom: 14px; }
.input-wrapper > i {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    width: 20px; text-align: center;
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}
.auth-body .auth-input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 46px;
    border: 1.5px solid var(--auth-border);
    border-radius: 14px;
    font-size: 15px;
    background: var(--auth-field);
    color: var(--auth-text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.auth-body select.auth-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 40px;
}
.auth-body .auth-input::placeholder { color: #9aa4b2; }
.auth-body .auth-input:focus {
    border-color: var(--kh-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
    outline: none;
}
.input-wrapper:focus-within > i { color: var(--kh-blue); }

.auth-body input[readonly],
.auth-body select[disabled],
.auth-body input[disabled] {
    background-color: #eef2f6 !important;
    color: #64748b;
    cursor: not-allowed;
}

/* 비밀번호 토글 여백 */
.input-wrapper:has(.password-toggle) .auth-input,
.auth-body input.auth-input[type="password"],
#passwordInput { padding-right: 50px; }

.password-toggle {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: #94a3b8; cursor: pointer;
    font-size: 17px; padding: 0;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    z-index: 2;
}
.password-toggle:hover { color: var(--kh-blue); background: rgba(37,99,235,0.08); }

/* ---------- 버튼 ---------- */
.auth-body .auth-btn {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    background: var(--kh-grad);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}
.auth-body .auth-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(37, 99, 235, 0.42); }
.auth-body .auth-btn:active:not(:disabled) { transform: translateY(0); }
.auth-body .auth-btn:disabled { background: #cbd5e1; color: #f1f5f9; cursor: not-allowed; box-shadow: none; opacity: 1; }
.auth-body .auth-btn.success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); box-shadow: 0 12px 26px rgba(16, 185, 129, 0.4); }

.auth-body .auth-btn.loading { pointer-events: none; color: transparent; }
.auth-body .auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    top: 50%; left: 50%;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* 인라인(계좌 인증 등) 그룹의 버튼은 폭 자동 */
.kyc-input-group { display: flex; gap: 10px; margin-bottom: 14px; align-items: stretch; }
.kyc-input-group .input-wrapper { flex: 1; margin-bottom: 0; }
.auth-body .kyc-input-group .auth-btn { width: auto; min-width: 104px; height: 52px; padding: 0 18px; font-size: 14px; }

/* ---------- 섹션 타이틀 (회원가입) ---------- */
.section-title {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px;
    font-size: 14px; font-weight: 800;
    color: var(--auth-text);
    margin: 26px 0 14px;
    padding: 0 0 10px;
    border-bottom: 1.5px solid var(--auth-border);
}
.section-title:first-of-type { margin-top: 0; }
.section-title i { color: var(--kh-blue); }

/* ---------- 상태 배지 ---------- */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 20px;
    font-size: 12px; font-weight: 700; margin-left: 8px;
}
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.success { background: #d1fae5; color: #065f46; }

/* ---------- 약관 동의 라벨 ---------- */
.agree-row {
    font-size: 14px;
    display: flex; align-items: flex-start; gap: 10px;
    color: #374151;
    margin-bottom: 12px;
    padding: 13px 14px;
    background: var(--auth-field);
    border: 1.5px solid var(--auth-border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.agree-row:hover { border-color: #cbd5e1; }
.agree-row input[type="checkbox"] { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--kh-blue); cursor: pointer; flex: none; }
.agree-row a { color: var(--kh-blue); font-weight: 700; text-decoration: none; }
.agree-row .req { color: var(--kh-blue); font-weight: 800; }

/* ---------- 하단 안내/보조 링크 ---------- */
.field-note {
    font-size: 12.5px; color: var(--auth-sub);
    margin: -4px 2px 10px; line-height: 1.55;
    display: flex; gap: 6px; align-items: flex-start;
}
.field-note i { color: var(--kh-blue); margin-top: 2px; }

.turnstile-wrapper { margin: 18px 0; display: flex; justify-content: center; }

.auth-alt { text-align: center; margin-top: 22px; font-size: 14px; color: var(--auth-sub); }
.auth-alt-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.auth-alt-row .dot { color: #cbd5e1; }
.auth-alt a, .auth-link a { color: var(--kh-blue); font-weight: 700; text-decoration: none; transition: color 0.2s; }
.auth-alt a:hover, .auth-link a:hover { color: var(--kh-sky); text-decoration: underline; }
.auth-alt .divider { height: 1px; background: var(--auth-border); margin: 0 0 16px; }
.auth-link { text-align: center; margin-top: 22px; font-size: 14px; color: var(--auth-sub); }

/* ---------- 모달 (회원가입 약관/개인정보) ---------- */
.app-modal {
    display: none;
    position: fixed; inset: 0;
    z-index: 1000;
    width: 100%; height: 100%;
    overflow: auto;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-content {
    background: #fff;
    padding: 26px;
    border-radius: 18px;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}
.modal-content pre {
    white-space: pre-wrap; word-wrap: break-word;
    font-size: 13px; line-height: 1.8; color: #374151;
    background: var(--auth-field); padding: 15px; border-radius: 10px;
}
.modal-close { float: right; font-size: 28px; font-weight: bold; color: #9ca3af; cursor: pointer; line-height: 1; transition: color 0.2s; }
.modal-close:hover { color: #374151; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
    .auth-brand { display: none; }
    .auth-logo-sm { display: flex; }
    .auth-head { text-align: center; }
}

@media (max-width: 520px) {
    .auth-body { padding: 0; align-items: stretch; background-image: none; }
    .auth-shell {
        max-width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        min-height: 100dvh;
    }
    .auth-panel { justify-content: flex-start; padding: 34px 22px calc(34px + env(safe-area-inset-bottom)); }
    .modal-content { padding: 20px 18px; border-radius: 14px; max-height: 90vh; }
}
