/* ============================================================
   알고보카 결제 · 스타일
   브랜드: 보라색 계열 / 심플·세련·젊은 감성 / '.' 로고
   ============================================================ */

:root {
    --violet-700: #6D28D9;
    --violet-600: #7C3AED;
    --violet-500: #8B5CF6;
    --violet-100: #EDE9FE;
    --violet-50:  #F5F3FF;

    --ink:        #17141F;
    --ink-soft:   #4B4658;
    --ink-mute:   #948EA6;
    --line:       #ECE9F1;
    --surface:    #FFFFFF;
    --bg:         #F7F5FB;

    --radius:     18px;
    --radius-lg:  24px;
    --shadow-sm:  0 2px 8px rgba(23, 20, 31, 0.04);
    --shadow-md:  0 8px 24px rgba(109, 40, 217, 0.10);
    --shadow-btn: 0 10px 24px rgba(124, 58, 237, 0.34);

    --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
            "Segoe UI", Roboto, "Helvetica Neue", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

/* ---------- 레이아웃 ---------- */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 20px calc(148px + env(safe-area-inset-bottom, 0));
    background: var(--bg);
}

.app--result {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0));
}

/* ---------- 헤더 / 브랜드 ---------- */
.app__header {
    padding: 40px 4px 24px;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    margin-bottom: 28px;
}

/* '.' 로고 — 보라색 점을 로고 마크로 사용 */
.brand__mark {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--violet-600);
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.45);
    align-self: flex-end;
    margin-bottom: 2px;
    animation: dotpop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.brand__name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

@keyframes dotpop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.app__title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--ink);
}

.app__tagline {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--ink-soft);
    letter-spacing: -0.01em;
}

/* ---------- 플랜 카드 ---------- */
.plans {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 20px 18px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.plan:active { transform: scale(0.985); }

.plan--selected {
    border-color: var(--violet-600);
    box-shadow: var(--shadow-md);
    background: var(--surface);
}

/* 라디오 표시 */
.plan__radio {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #D9D3E6;
    transition: border-color 0.18s ease;
    position: relative;
}

.plan--selected .plan__radio {
    border-color: var(--violet-600);
}

.plan--selected .plan__radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--violet-600);
    animation: dotpop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.plan__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.plan__name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.plan__period {
    font-size: 13px;
    color: var(--ink-mute);
}

.plan__price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex: 0 0 auto;
}

.plan__price-main {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.plan__price-main small {
    font-size: 13px;
    font-weight: 600;
    margin-left: 1px;
}

.plan__price-sub {
    font-size: 12px;
    color: var(--ink-mute);
}

/* 강조 뱃지 */
.plan__badge {
    position: absolute;
    top: -9px;
    right: 16px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    background: linear-gradient(120deg, var(--violet-600), var(--violet-500));
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
}

.plan--featured .plan__radio { border-color: #C9BEE8; }

/* ---------- 혜택 ---------- */
.benefits {
    list-style: none;
    margin: 22px 2px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.benefits li {
    position: relative;
    padding-left: 28px;
    font-size: 14px;
    color: var(--ink-soft);
    letter-spacing: -0.01em;
}

.benefits li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--violet-100)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 6'/%3E%3C/svg%3E")
        center / 11px no-repeat;
}

/* ---------- 하단 결제 바 ---------- */
.checkout {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
}

.checkout__summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.checkout__label {
    font-size: 14px;
    color: var(--ink-soft);
    font-weight: 600;
}

.checkout__amount {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--violet-700);
}

.checkout__btn {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(120deg, var(--violet-600), var(--violet-500));
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transition: transform 0.12s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.checkout__btn:active { transform: translateY(1px) scale(0.99); }
.checkout__btn:disabled { cursor: default; opacity: 0.7; }

.checkout__btn.is-loading {
    color: transparent;
    position: relative;
}

.checkout__btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.checkout__note {
    margin: 10px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--ink-mute);
    letter-spacing: -0.01em;
}

/* ---------- 결과 화면 (성공/실패) ---------- */
.result {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px 26px 28px;
    text-align: center;
    box-shadow: var(--shadow-md);
    animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.result__icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result__icon svg { width: 46px; height: 46px; }

.result--ok .result__icon {
    background: var(--violet-100);
    color: var(--violet-600);
    animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.result--fail .result__icon {
    background: #FDECEC;
    color: #E5484D;
}

@keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.result__title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.result__desc {
    margin: 0;
    font-size: 15px;
    color: var(--ink-soft);
    letter-spacing: -0.01em;
}

.result__code {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--ink-mute);
}

/* 영수증 */
.receipt {
    margin: 26px 0 0;
    padding: 18px;
    background: var(--violet-50);
    border-radius: var(--radius);
    text-align: left;
}

.receipt__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
}

.receipt__row dt {
    font-size: 14px;
    color: var(--ink-soft);
}

.receipt__row dd {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.receipt__mono {
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--ink-mute) !important;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 결과 화면 버튼 */
.result__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 28px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.18s ease;
}

.btn:active { transform: scale(0.99); }

.btn--primary {
    background: linear-gradient(120deg, var(--violet-600), var(--violet-500));
    color: #fff;
    box-shadow: var(--shadow-btn);
}

.btn--ghost {
    background: var(--violet-50);
    color: var(--violet-700);
}

.btn--block { width: 100%; }
.btn--inline { display: inline-flex; padding: 0 22px; }

/* ============================================================
   상단바 (index / history)
   ============================================================ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 0;
}

.topbar__actions {
    display: flex;
    gap: 16px;
}

.topbar__link {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.topbar__link:active { color: var(--violet-600); }

.app__header--tight { padding-top: 20px; }

/* ============================================================
   로그인 화면
   ============================================================ */
.app--auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0));
}

.auth {
    width: 100%;
    max-width: 400px;
}

.brand--center {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 24px;
}

.auth__title {
    margin: 0;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.auth__desc {
    margin: 8px 0 24px;
    text-align: center;
    font-size: 14px;
    color: var(--ink-soft);
    letter-spacing: -0.01em;
}

.auth__error {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #FDECEC;
    color: #C0353A;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.auth__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    padding-left: 2px;
}

.field__input {
    height: 52px;
    padding: 0 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    transition: border-color 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.field__input::placeholder { color: #B7B1C4; }
.field__input:focus {
    outline: none;
    border-color: var(--violet-500);
}

.auth__form .btn { margin-top: 6px; height: 54px; }

/* 구분선 */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--ink-mute);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* SNS 버튼 (준비중) */
.sns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sns__btn {
    height: 50px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.18s ease;
}

.sns__btn:active { transform: scale(0.99); }
.sns__btn--kakao  { background: #FEE500; color: #191600; }
.sns__btn--naver  { background: #03C75A; color: #fff; }
.sns__btn--google { background: #fff; color: #1F1F1F; border: 1.5px solid #E4E1EA; }

.auth__hint {
    margin: 22px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--ink-mute);
    letter-spacing: -0.01em;
}

/* 토스트 (준비중 안내) */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(32px + env(safe-area-inset-bottom, 0));
    transform: translate(-50%, 16px);
    padding: 13px 20px;
    border-radius: 999px;
    background: rgba(23, 20, 31, 0.92);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease;
    z-index: 20;
}

.toast.is-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ============================================================
   결제내역
   ============================================================ */
.history {
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history__item {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.history__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history__name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.history__status {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.history__status.is-done   { background: var(--violet-100); color: var(--violet-700); }
.history__status.is-failed { background: #FDECEC; color: #C0353A; }

.history__mid {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 10px;
}

.history__amount {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.history__method {
    font-size: 13px;
    color: var(--ink-mute);
}

.history__bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.history__date {
    font-size: 12px;
    color: var(--ink-mute);
}

.history__receipt {
    font-size: 12px;
    font-weight: 700;
    color: var(--violet-600);
    text-decoration: none;
}

.history__order {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    font-size: 11px;
    color: #B7B1C4;
    word-break: break-all;
}

/* 빈 내역 */
.empty {
    margin-top: 60px;
    text-align: center;
}

.empty__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--violet-50);
    position: relative;
}

.empty__icon::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='13' rx='2'/%3E%3Cpath d='M4 10h16M8 3v4'/%3E%3C/svg%3E")
        center / 30px no-repeat;
}

.empty__text {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--ink-soft);
}
