/* ================================================================
   Billing Page Styles
================================================================ */

#page-billing .snap-section.billing-snap {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-height: 100vh !important;
    height: auto !important;
    overflow: visible !important;
    scroll-snap-align: none !important;
    padding-top: 90px !important;
    padding-bottom: 230px !important;
    box-sizing: border-box;
}

/* 비로그인 상태: 헤더/푸터 제외 세로 가운데 정렬 */
#page-billing .billing-snap:has(.billing-login-required) {
    justify-content: center !important;
    padding-top: 80px !important;
    padding-bottom: 100px !important;
}

#page-billing .sub-header {
    text-align: center;
    margin-top: 18px;
    padding-bottom: 20px;
    margin-bottom: 20px;
}
#page-billing .sub-header h1 { margin-bottom: 0; }
#page-billing .sub-header .page-title-desc { margin-top: 12px; }

/* ----------------------------------------------------------------
   Container
---------------------------------------------------------------- */
.billing-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----------------------------------------------------------------
   비로그인 상태
---------------------------------------------------------------- */
.billing-login-required {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 80px 40px;
    background: transparent;
    border: none;
    border-radius: 12px;
    text-align: center;
}

.billing-lock-icon {
    width: 64px;
    height: 64px;
    color: #888;
}
.billing-lock-icon svg { width: 100%; height: 100%; }

.billing-login-msg {
    font-size: 17px;
    color: #aaa;
    margin: 0;
}

.billing-btn-login {
    padding: 14px 40px;
    background: #ff6e2e;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.billing-btn-login:hover { background: #ff6e2e; }
.billing-login-required .billing-btn-login {
    font-size: 17px;
    border-radius: 8px;
    transition: background-color .25s ease;
}
.billing-login-required .billing-btn-login:hover {
    background-color: rgba(255,110,46,.82);
}

/* ----------------------------------------------------------------
   Card Wrapper
---------------------------------------------------------------- */
.billing-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0;
    overflow: hidden;
}

/* ----------------------------------------------------------------
   Section
---------------------------------------------------------------- */
.billing-section {
    padding: 32px 40px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.billing-section:last-child { border-bottom: none; }

.billing-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 20px;
}

/* ----------------------------------------------------------------
   금액 선택
---------------------------------------------------------------- */
.billing-amount-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.billing-amount-option {
    position: relative;
    cursor: pointer;
}
.billing-amount-option input[type="radio"],
.billing-amount-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

.billing-amount-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    color: #ccc;
    transition: all 0.2s;
    text-align: center;
}
.billing-amount-option:hover .billing-amount-label {
    border-color: rgba(255, 110, 46,0.5);
    color: #fff;
}
.billing-amount-option input:checked + .billing-amount-label {
    background: rgba(255, 110, 46,0.12);
    border-color: #ff6e2e;
    color: #ff6e2e;
}

/* 직접 입력 필드 */
.billing-custom-input {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    position: relative;
}
.billing-custom-input.visible { display: flex; }
#page-billing .billing-amount-help {
    margin:8px 0 0;
}
#page-billing .billing-amount-help[hidden] {
    display:none;
}

/* 결제 서비스 내용 입력 */
.billing-section-help {
    margin: -10px 0 16px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    line-height: 1.5;
}

.billing-service-grid {
    grid-template-columns: repeat(6, 1fr);
}

.billing-service-grid .billing-service-option {
    grid-column: span 2;
}

/* Three choices on the first row, two equal choices on the second. */
.billing-service-grid .billing-service-option:nth-child(4),
.billing-service-grid .billing-service-option:nth-child(5) {
    grid-column: span 3;
}

.billing-service-grid .billing-amount-label {
    min-height: 52px;
    word-break: keep-all;
}

/* 결제 방식 선택 */
.billing-method-grid {
    grid-template-columns: repeat(2, 1fr);
}
.billing-method-help {
    margin: 14px 0 0;
}

.billing-service-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 0;
    padding: 13px 16px;
    font-size: 15px;
    color: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.billing-service-input:focus { border-color: #ff6e2e; }
.billing-service-input::placeholder { color: #555; }
body.light-mode .billing-service-input { background: #f5f5f5; border-color: #ddd; color: #111; }
body.light-mode .billing-service-input::placeholder { color: #aaa; }
body.light-mode .billing-section-help { color: #999; }

.billing-custom-input input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 0;
    padding: 13px 50px 13px 16px;
    font-size: 15px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.billing-custom-input input:focus { border-color: #ff6e2e; }
.billing-custom-input input::placeholder { color: #555; }
/* 숫자 스피너 제거 */
.billing-custom-input input::-webkit-outer-spin-button,
.billing-custom-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.billing-custom-input input[type=number] { -moz-appearance: textfield; }

.billing-currency {
    position: absolute;
    right: 16px;
    font-size: 14px;
    color: #fff;
    pointer-events: none;
}

.billing-vat-summary {
    margin-top: 18px;
    padding: 18px 20px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.09);
}

.billing-vat-summary[hidden] {
    display: none;
}

.billing-vat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    font-size: 13px;
    color: #888;
}

.billing-vat-row strong {
    color: #ddd;
    font-size: 14px;
    font-weight: 700;
}

.billing-vat-row--total {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #fff;
}

.billing-vat-row--total strong {
    color: #ff6e2e;
    font-size: 18px;
}

.billing-vat-summary p {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: #666;
}

/* ----------------------------------------------------------------
   결제 안내
---------------------------------------------------------------- */
.billing-info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.billing-info-row {
    display: flex;
    gap: 20px;
}
.billing-info-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    min-width: 130px;
    flex-shrink: 0;
}
.billing-info-value {
    font-size: 13px;
    color: #aaa;
    line-height: 1.6;
}

/* ----------------------------------------------------------------
   약관 박스
---------------------------------------------------------------- */
.billing-terms-box {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
    padding: 20px;
    font-size: 12px;
    color: #666;
    line-height: 1.8;
    max-height: 160px;
    overflow-y: auto;
}
.billing-terms-box strong { color: #888; }
/* 스크롤바 */
.billing-terms-box::-webkit-scrollbar { width: 4px; }
.billing-terms-box::-webkit-scrollbar-track { background: transparent; }
.billing-terms-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 0; }

/* ----------------------------------------------------------------
   필수 동의
---------------------------------------------------------------- */
.billing-agree-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.billing-agree-all-wrap {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.billing-checkbox--all {
    font-weight: 700;
    color: #fff !important;
}
.billing-checkbox--all .billing-checkmark {
    border-color: rgba(255,255,255,0.4);
}

body.light-mode .billing-agree-all-wrap {
    border-top-color: rgba(0,0,0,0.1);
}
body.light-mode .billing-checkbox--all { color: #111 !important; }

.billing-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: #aaa;
    line-height: 1.5;
    user-select: none;
}
.billing-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.billing-checkmark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    position: relative;
    transition: all 0.2s;
}
.billing-checkbox input:checked ~ .billing-checkmark {
    background: #ff6e2e;
    border-color: #ff6e2e;
}
.billing-checkbox input:checked ~ .billing-checkmark::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6 5 9 10 3' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

/* ----------------------------------------------------------------
   액션 버튼
---------------------------------------------------------------- */
.billing-action {
    padding: 32px 40px 36px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.billing-btn-submit {
    width: 100%;
    padding: 16px;
    background: #ff6e2e;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.billing-btn-submit:disabled {
    background: rgba(255,255,255,0.08);
    color: #555;
    cursor: not-allowed;
}
.billing-btn-submit:not(:disabled):hover { background: #ff6e2e; }

.billing-action-desc {
    text-align: center;
    font-size: 12px;
    color: #555;
    margin: 0;
    min-height: 16px;
}

/* ----------------------------------------------------------------
   결제 결과
---------------------------------------------------------------- */
.billing-result-card {
    padding: 0;
}

.billing-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 64px 40px;
    text-align: center;
}

.billing-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 1.5px solid rgba(255,255,255,0.16);
    color: #aaa;
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
}

.billing-result.is-success .billing-result-icon {
    border-color: rgba(93,224,138,0.45);
    color: #5de08a;
}

.billing-result.is-fail .billing-result-icon {
    border-color: rgba(255, 110, 46,0.45);
    color: #ff6e2e;
}

.billing-result-title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
}

.billing-result-message {
    margin: 0;
    max-width: 520px;
    font-size: 15px;
    line-height: 1.7;
    color: #aaa;
}

.billing-result-details {
    width: 100%;
    margin: 12px 0 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: left;
}

.billing-result-details div {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.billing-result-details dt {
    min-width: 110px;
    color: #666;
    font-size: 13px;
    font-weight: 700;
}

.billing-result-details dd {
    margin: 0;
    color: #ddd;
    font-size: 13px;
    word-break: break-all;
}

.billing-result-actions {
    margin-top: 10px;
}

/* ----------------------------------------------------------------
   Light Mode
---------------------------------------------------------------- */
body.light-mode .billing-card,
body.light-mode .billing-login-required {
    background: #fff;
    border-color: rgba(0,0,0,0.08);
}
body.light-mode .billing-section { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .billing-section-title { color: #999; }
body.light-mode .billing-amount-label { background: #f5f5f5; border-color: #ddd; color: #333; }
body.light-mode .billing-amount-option:hover .billing-amount-label { border-color: rgba(255, 110, 46,0.4); }
body.light-mode .billing-custom-input input { background: #f5f5f5; border-color: #ddd; color: #111; }
body.light-mode .billing-currency { color: rgba(0,0,0,0.55); }
body.light-mode .billing-vat-summary { background: #f5f5f5; border-color: #e0e0e0; }
body.light-mode .billing-vat-row { color: #777; }
body.light-mode .billing-vat-row strong { color: #333; }
body.light-mode .billing-vat-row--total { color: #111; border-top-color: rgba(0,0,0,0.08); }
body.light-mode .billing-vat-row--total strong { color: #ff6e2e; }
body.light-mode .billing-vat-summary p { color: #999; }
body.light-mode .billing-info-label { color: #999; }
body.light-mode .billing-info-value { color: #555; }
body.light-mode .billing-terms-box { background: #f5f5f5; border-color: #e0e0e0; color: #888; }
body.light-mode .billing-terms-box strong { color: #555; }
body.light-mode .billing-checkbox { color: #555; }
body.light-mode .billing-checkmark { border-color: #ccc; background: #fff; }
body.light-mode .billing-login-msg { color: #555; }
body.light-mode .billing-lock-icon { color: #ccc; }
body.light-mode #page-billing .sub-header p { color: #999; }
body.light-mode .billing-btn-submit:disabled { background: #e0e0e0; color: #aaa; }
body.light-mode .billing-action-desc { color: #aaa; }
body.light-mode .billing-result-title { color: #111; }
body.light-mode .billing-result-message { color: #555; }
body.light-mode .billing-result-icon { border-color: rgba(0,0,0,0.12); color: #999; }
body.light-mode .billing-result-details { border-top-color: rgba(0,0,0,0.08); }
body.light-mode .billing-result-details div { border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .billing-result-details dt { color: #999; }
body.light-mode .billing-result-details dd { color: #333; }

/* ----------------------------------------------------------------
   Mobile
---------------------------------------------------------------- */
@media (max-width: 768px) {
    #page-billing .snap-section.billing-snap {
        padding-top: 100px !important;
        padding-bottom: 260px !important;
    }
    .billing-section { padding: 24px 20px; }
    .billing-action { padding: 24px 20px 28px; }
    .billing-result { padding: 48px 24px; }
    .billing-result-details div { flex-direction: column; gap: 4px; }
    .billing-result-details dt { min-width: unset; }
    .billing-amount-grid { grid-template-columns: repeat(2, 1fr); }
    .billing-service-grid { grid-template-columns: 1fr; }
    .billing-service-grid .billing-service-option,
    .billing-service-grid .billing-service-option:nth-child(4),
    .billing-service-grid .billing-service-option:nth-child(5) {
        grid-column: auto;
    }
    .billing-info-row { flex-direction: column; gap: 4px; }
    .billing-info-label { min-width: unset; }
}

/* Monthly billing's light canvas continues behind the header and footer. */
html:has(body.light-mode[data-page="billing"]),
html body.light-mode[data-page="billing"],
html body.light-mode[data-page="billing"] :is(#app-container,#page-billing,#page-billing .billing-snap),
html body.light-mode[data-page="billing"] .page-footer.footer-three-column {
    background: #f8f8f8 !important;
}

/* One entrance timeline: title, description, then the complete billing box. */
html body[data-page="billing"] #page-billing :is(.page-title-desc,.billing-container) {
    opacity: 0;
    transform: translateY(28px);
    transition: none;
}
html body.preview-heading-play #page-billing .page-title-desc {
    animation: billingContentIn .95s cubic-bezier(.25,.65,.3,1) .7s both !important;
}
html body.preview-heading-play #page-billing .billing-container {
    animation: billingContentIn 1.15s cubic-bezier(.25,.65,.3,1) 1.35s both;
}
@keyframes billingContentIn {
    from {opacity:0;transform:translateY(28px)}
    to {opacity:1;transform:translateY(0)}
}
@media(prefers-reduced-motion:reduce) {
    html body[data-page="billing"] #page-billing :is(.page-title-desc,.billing-container) {
        opacity:1;transform:none;animation:none!important;
    }
}

/* Signed-in heading follows the service guide's responsive top inset. */
html body #page-billing.billing-is-authenticated .snap-section.billing-snap {
    padding-top:max(156px,calc(var(--site-header-h,90px) + var(--preview-section-space,32px))) !important;
}
html body #page-billing.billing-is-authenticated .sub-header {
    margin-top:0;
    padding-top:0;
}
#page-billing .billing-card {
    border:0;
    border-radius:12px;
}
/* Readable payment form with consistent, borderless selection controls. */
#page-billing.billing-is-authenticated .billing-container {
    max-width:800px;
}
#page-billing .billing-card,
#page-billing .billing-card * {
    letter-spacing:0;
}
#page-billing .billing-card :is(.billing-section-title,.billing-section-help,
    .billing-currency,.billing-vat-row,.billing-vat-row strong,.billing-vat-summary p,
    .billing-info-label,.billing-info-value,.billing-terms-box,.billing-checkbox,
    .billing-action-desc,.billing-result-details dt,.billing-result-details dd) {
    font-size:15px;
}
#page-billing .billing-card .billing-vat-row--total strong {
    font-size:18px;
    color:#ff6e2e !important;
}
#page-billing .billing-vat-summary,
#page-billing .billing-terms-box,
#page-billing .billing-custom-input input {
    border:0;
    border-radius:8px;
    outline:none;
    box-shadow:none;
}
#page-billing .billing-terms-box {
    scrollbar-width:thin;
    scrollbar-color:rgba(255,110,46,.65) rgba(255,110,46,.08);
}
#page-billing .billing-terms-box::-webkit-scrollbar-track {
    background:rgba(255,110,46,.08) !important;
    border-radius:8px;
}
#page-billing .billing-terms-box::-webkit-scrollbar-thumb {
    background:rgba(255,110,46,.65) !important;
    border-radius:8px;
}
#page-billing .billing-terms-box::-webkit-scrollbar-thumb:hover {
    background:#ff6e2e !important;
}
#page-billing .billing-custom-input input {
    --billing-field-bg:#1e1e1e;
    --billing-field-ink:#fff;
    min-width:0;
    background:var(--billing-field-bg);
    transition:background-color .28s ease;
}
#page-billing .billing-custom-input input:focus {
    --billing-field-bg:#272727;
    background:var(--billing-field-bg);
}
body.light-mode #page-billing .billing-custom-input input {
    --billing-field-bg:#f5f5f5;
    --billing-field-ink:#111;
}
body.light-mode #page-billing .billing-custom-input input:focus {
    --billing-field-bg:#ebebeb;
    background:var(--billing-field-bg);
}
/* Cover native autofill paint, including the focused/hovered autofill state. */
#page-billing .billing-custom-input input:is(:autofill,:-webkit-autofill) {
    -webkit-box-shadow:0 0 0 1000px var(--billing-field-bg) inset !important;
    box-shadow:0 0 0 1000px var(--billing-field-bg) inset !important;
    -webkit-text-fill-color:var(--billing-field-ink) !important;
    color:var(--billing-field-ink) !important;
    caret-color:var(--billing-field-ink);
    background-color:var(--billing-field-bg) !important;
}
#page-billing .billing-amount-label {
    border:0;
    border-radius:8px;
    background:#1f1f1f;
    color:#ccc;
    transition:background-color .28s ease,color .28s ease;
}
#page-billing .billing-amount-option:hover input:not(:checked) + .billing-amount-label {
    background:#191919;
    color:#ccc;
}
body.light-mode #page-billing .billing-amount-label {
    background:#f5f5f5;
    color:#333 !important;
}
body.light-mode #page-billing .billing-amount-option:hover input:not(:checked) + .billing-amount-label {
    background:#ebebeb;
}
body #page-billing .billing-amount-option input:checked + .billing-amount-label {
    background:#ff6e2e;
    color:#fff !important;
}
#page-billing .billing-card :is(.billing-btn-submit,.billing-btn-login) {
    border:0;
    border-radius:8px;
    transition:background-color .28s ease,color .28s ease;
}
#page-billing .billing-card .billing-btn-submit:not(:disabled):hover,
#page-billing .billing-card .billing-btn-login:hover {
    background:#ed6025;
}
#page-billing .billing-amount-option input:focus-visible + .billing-amount-label,
#page-billing .billing-card :is(.billing-btn-submit,.billing-btn-login):focus-visible {
    outline:2px solid #ff6e2e;
    outline-offset:3px;
}
@media(max-width:768px) {
    html body #page-billing.billing-is-authenticated .snap-section.billing-snap {
        padding-top:max(120px,calc(var(--site-header-h,70px) + 32px)) !important;
    }
}
