/* ============================================================
   Clevi Account Pages — Common Design Tokens & Primitives
   ------------------------------------------------------------
   Razor Pages 전용. Blazor(Clevi.App.Components)의
   --clc-* / --clv-* 토큰과 독립적인 자체 토큰 체계.
   모든 계정 페이지(Login, Register, Forgot*, Reset*, Lockout,
   2FA, Logout, ExternalLogin, Confirm*, AccessDenied 등)는
   이 파일을 먼저 로드한 뒤 자신의 페이지 전용 CSS 를 얹는다.
   ============================================================ */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

html,
body {
    height: 100%;
}

/* ── Design Tokens (Light) ── */
:root {
    --acc-bg: #f5f7fa;
    --acc-surface: #ffffff;
    --acc-surface-alt: #f8f5ff;

    --acc-text: #1a1a1a;
    --acc-text-muted: #6b7280;
    --acc-text-subtle: #9ca3af;
    --acc-text-placeholder: #a0a6b0;
    --acc-text-inverse: #ffffff;

    --acc-border: rgba(0, 0, 0, 0.08);
    --acc-border-strong: rgba(0, 0, 0, 0.18);

    --acc-primary: #7118ff;
    --acc-primary-hover: #5c0edb;
    --acc-primary-ring: rgba(113, 24, 255, 0.35);
    --acc-primary-soft: rgba(113, 24, 255, 0.12);
    --acc-primary-shadow: rgba(113, 24, 255, 0.30);

    --acc-danger: #dc2626;
    --acc-danger-bg: #fef2f2;
    --acc-danger-border: #fecaca;

    --acc-success: #16a34a;
    --acc-success-text: #15803d;
    --acc-success-bg: #f0fdf4;
    --acc-success-border: #bbf7d0;

    --acc-info: #2563eb;
    --acc-info-bg: #eff6ff;
    --acc-info-border: #bfdbfe;

    --acc-input-bg: #f0f1f4;
    --acc-input-focus-bg: #e8e9ed;

    --acc-btn-secondary-bg: #f0f1f4;
    --acc-btn-secondary-hover: #e4e5e9;
    --acc-btn-secondary-text: #333333;

    --acc-radius-sm: 10px;
    --acc-radius: 14px;
    --acc-radius-lg: 20px;

    --acc-shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    --acc-shadow-btn: 0 4px 14px var(--acc-primary-shadow);

    --acc-transition: 0.2s ease;
}

/* ── Design Tokens (Dark) ── */
@media (prefers-color-scheme: dark) {
    :root {
        --acc-bg: #0f1115;
        --acc-surface: #1a1d24;
        --acc-surface-alt: #201a2e;

        --acc-text: rgba(255, 255, 255, 0.92);
        --acc-text-muted: rgba(255, 255, 255, 0.6);
        --acc-text-subtle: rgba(255, 255, 255, 0.4);
        --acc-text-placeholder: rgba(255, 255, 255, 0.3);

        --acc-border: rgba(255, 255, 255, 0.08);
        --acc-border-strong: rgba(255, 255, 255, 0.18);

        --acc-primary: #9a5bff;
        --acc-primary-hover: #b082ff;
        --acc-primary-ring: rgba(154, 91, 255, 0.45);
        --acc-primary-soft: rgba(154, 91, 255, 0.18);
        --acc-primary-shadow: rgba(154, 91, 255, 0.40);

        --acc-danger: #f87171;
        --acc-danger-bg: rgba(220, 38, 38, 0.12);
        --acc-danger-border: rgba(220, 38, 38, 0.35);

        --acc-success: #4ade80;
        --acc-success-text: #86efac;
        --acc-success-bg: rgba(22, 163, 74, 0.12);
        --acc-success-border: rgba(22, 163, 74, 0.35);

        --acc-info: #60a5fa;
        --acc-info-bg: rgba(37, 99, 235, 0.12);
        --acc-info-border: rgba(37, 99, 235, 0.35);

        --acc-input-bg: #252932;
        --acc-input-focus-bg: #2d3139;

        --acc-btn-secondary-bg: #252932;
        --acc-btn-secondary-hover: #2d3139;
        --acc-btn-secondary-text: rgba(255, 255, 255, 0.85);

        --acc-shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
}

/* ── Body / Container ── */
body {
    min-height: 100vh;
    display: flex;
    -webkit-display: flex;
    justify-content: center;
    -webkit-justify-content: center;
    align-items: center;
    -webkit-align-items: center;
    background: var(--acc-bg);
    color: var(--acc-text);
    overflow-y: auto;
}

body > .container,
body > .acc-page {
    width: 100%;
    min-height: 100%;
    padding: 1rem;
    display: flex;
    -webkit-display: flex;
    justify-content: center;
    -webkit-justify-content: center;
    align-items: center;
    -webkit-align-items: center;
}

/* ── Card ── */
.acc-card {
    background: var(--acc-surface);
    border: 1px solid var(--acc-border);
    border-radius: var(--acc-radius-lg);
    box-shadow: var(--acc-shadow-card);
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem auto;
    animation: accSlideUp 0.45s ease both;
    animation-delay: 0.1s;
    opacity: 0;
}

.acc-card--wide { max-width: 440px; }

.acc-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.acc-header img {
    width: auto;
    height: 3.5rem;
}

.acc-title {
    font-size: 1.35rem;
    color: var(--acc-text);
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.acc-instruction {
    font-size: 0.95rem;
    color: var(--acc-text-muted);
    line-height: 1.55;
    text-align: center;
    margin-bottom: 1.25rem;
}

.acc-description {
    font-size: 0.9rem;
    color: var(--acc-text-muted);
    line-height: 1.6;
    text-align: left;
    margin-bottom: 1rem;
}

/* ── Form Primitives ── */
.acc-form-group {
    margin-bottom: 0.75rem;
    text-align: left;
}

.acc-label {
    display: block;
    font-size: 0.85rem;
    color: var(--acc-text-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.acc-label--required::after {
    content: ' *';
    color: var(--acc-danger);
}

.acc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.acc-input,
.acc-select {
    width: 100%;
    background: var(--acc-input-bg);
    border: 2px solid transparent;
    border-radius: var(--acc-radius);
    padding: 0.85rem 1rem;
    color: var(--acc-text);
    font-size: 0.95rem;
    transition: background var(--acc-transition), border-color var(--acc-transition);
    -webkit-appearance: none;
    appearance: none;
}

.acc-input:focus,
.acc-select:focus {
    outline: none;
    background: var(--acc-input-focus-bg);
    border-color: var(--acc-primary);
}

.acc-input:focus-visible,
.acc-select:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

.acc-input::placeholder { color: var(--acc-text-placeholder); }

.acc-input[readonly] {
    background: transparent;
    border-color: var(--acc-border);
    color: var(--acc-text-muted);
    cursor: not-allowed;
}

.acc-input[disabled],
.acc-select[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 전화번호 그룹 */
.acc-phone-group {
    display: flex;
    -webkit-display: flex;
    gap: 0.5rem;
    align-items: stretch;
    -webkit-align-items: stretch;
}

.acc-phone-group .acc-select {
    width: 122px;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    padding: 0.85rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.acc-phone-group .acc-input {
    flex: 1;
    -webkit-flex: 1;
    min-width: 0;
}

/* 인라인 버튼이 붙는 입력 그룹 */
.acc-input-row {
    display: flex;
    -webkit-display: flex;
    gap: 0.5rem;
    align-items: stretch;
    -webkit-align-items: stretch;
}

.acc-input-row > .acc-input,
.acc-input-row > .acc-phone-group {
    flex: 1;
    -webkit-flex: 1;
    min-width: 0;
}

/* 비밀번호 보이기 토글 */
.acc-password-wrap {
    position: relative;
}

.acc-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--acc-text-muted);
    padding: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.acc-password-toggle:hover { color: var(--acc-text); }
.acc-password-toggle:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

.acc-password-wrap .acc-input { padding-right: 2.75rem; }

/* ── Buttons ── */
.acc-btn {
    display: inline-flex;
    -webkit-display: inline-flex;
    align-items: center;
    -webkit-align-items: center;
    justify-content: center;
    -webkit-justify-content: center;
    gap: 0.5rem;
    width: 100%;
    border: none;
    border-radius: var(--acc-radius);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--acc-transition), box-shadow var(--acc-transition), color var(--acc-transition);
    text-align: center;
    text-decoration: none;
    line-height: 1.3;
    font-family: inherit;
}

.acc-btn:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

.acc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.acc-btn > img {
    height: 20px;
    width: 20px;
    object-fit: contain;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
}

.acc-btn--primary {
    background: var(--acc-primary);
    color: var(--acc-text-inverse);
}

.acc-btn--primary:hover:not(:disabled) {
    background: var(--acc-primary-hover);
    box-shadow: var(--acc-shadow-btn);
}

.acc-btn--secondary {
    background: var(--acc-btn-secondary-bg);
    color: var(--acc-btn-secondary-text);
}

.acc-btn--secondary:hover:not(:disabled) {
    background: var(--acc-btn-secondary-hover);
}

.acc-btn--external {
    background: var(--acc-surface);
    color: var(--acc-text);
    border: 1px solid var(--acc-border);
    font-weight: 500;
}

.acc-btn--external:hover:not(:disabled) {
    background: var(--acc-btn-secondary-bg);
    border-color: var(--acc-border-strong);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.acc-btn--kakao {
    background: #FEE500;
    color: #191919;
    border-color: #FEE500;
}

.acc-btn--kakao:hover:not(:disabled) {
    background: #fdd835;
    border-color: #fdd835;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.acc-btn--inline {
    width: auto;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    padding: 0.85rem 0.9rem;
    font-size: 0.85rem;
    white-space: nowrap;
    background: var(--acc-btn-secondary-bg);
    color: var(--acc-btn-secondary-text);
    font-weight: 600;
    border: none;
    border-radius: var(--acc-radius);
    cursor: pointer;
    transition: background var(--acc-transition);
}

.acc-btn--inline:hover:not(:disabled) {
    background: var(--acc-btn-secondary-hover);
}

.acc-btn--inline:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

.acc-btn-loading-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.acc-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: accSpin 0.7s linear infinite;
}

/* 버튼 행 */
.acc-button-group {
    margin-top: 1.25rem;
}

.acc-button-group--split {
    display: flex;
    -webkit-display: flex;
    gap: 0.75rem;
}

.acc-button-group--split .acc-btn--secondary {
    width: auto;
    min-width: 88px;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
}

.acc-button-group--split .acc-btn--primary {
    flex: 1;
    -webkit-flex: 1;
}

/* ── Back / Link Row ── */
.acc-back-btn {
    display: inline-flex;
    -webkit-display: inline-flex;
    align-items: center;
    -webkit-align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--acc-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
    transition: color var(--acc-transition);
    font-family: inherit;
}

.acc-back-btn:hover { color: var(--acc-text); }
.acc-back-btn:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

.acc-link-row {
    display: flex;
    -webkit-display: flex;
    justify-content: center;
    -webkit-justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
    -webkit-flex-wrap: wrap;
}

.acc-link-row a,
.acc-link {
    font-size: 0.85rem;
    color: var(--acc-text-muted);
    text-decoration: none;
    transition: color var(--acc-transition);
}

.acc-link-row a:hover,
.acc-link:hover { color: var(--acc-primary); }

.acc-link-row a:focus-visible,
.acc-link:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Divider ── */
.acc-divider {
    display: flex;
    -webkit-display: flex;
    align-items: center;
    -webkit-align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 1rem;
    color: var(--acc-text-muted);
    font-size: 0.8rem;
}

.acc-divider::before,
.acc-divider::after {
    content: '';
    flex: 1;
    -webkit-flex: 1;
    height: 1px;
    background: var(--acc-border);
}

/* ── Alerts / Messages ── */
.acc-alert {
    border-radius: var(--acc-radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.9rem;
}

.acc-alert--error {
    background: var(--acc-danger-bg);
    border: 1px solid var(--acc-danger-border);
    color: var(--acc-danger);
}

.acc-alert--success {
    background: var(--acc-success-bg);
    border: 1px solid var(--acc-success-border);
    color: var(--acc-success-text);
    text-align: center;
}

.acc-alert--info {
    background: var(--acc-info-bg);
    border: 1px solid var(--acc-info-border);
    color: var(--acc-info);
}

.acc-field-error {
    display: block;
    color: var(--acc-danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    min-height: 1rem;
}

.acc-field-hint {
    display: block;
    color: var(--acc-text-muted);
    font-size: 0.78rem;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    line-height: 1.4;
}

.acc-field-hint--success { color: var(--acc-success); }

/* ── Checkbox ── */
.acc-checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--acc-text-muted);
    cursor: pointer;
    line-height: 1.45;
}

.acc-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 0.1rem;
    accent-color: var(--acc-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.acc-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

.acc-checkbox a {
    color: var(--acc-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Tabs ── */
.acc-tabs {
    display: flex;
    -webkit-display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.acc-tab {
    flex: 1;
    -webkit-flex: 1;
    border: none;
    border-radius: var(--acc-radius);
    padding: 0.75rem 0.9rem;
    background: var(--acc-btn-secondary-bg);
    color: var(--acc-btn-secondary-text);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--acc-transition), color var(--acc-transition);
    font-family: inherit;
}

.acc-tab[aria-selected="true"],
.acc-tab.active {
    background: var(--acc-primary);
    color: var(--acc-text-inverse);
    box-shadow: 0 4px 14px var(--acc-primary-ring);
}

.acc-tab:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
}

/* ── OTP Indicator ── */
.acc-otp-sent {
    background: var(--acc-success-bg);
    border: 1px solid var(--acc-success-border);
    color: var(--acc-success-text);
    padding: 0.65rem 0.85rem;
    border-radius: var(--acc-radius-sm);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-align: center;
    display: flex;
    -webkit-display: flex;
    justify-content: space-between;
    -webkit-justify-content: space-between;
    align-items: center;
    -webkit-align-items: center;
    gap: 0.5rem;
}

.acc-otp-sent__timer {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.acc-otp-resend {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--acc-primary);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

.acc-otp-resend:disabled {
    color: var(--acc-text-muted);
    text-decoration: none;
    cursor: not-allowed;
}

.acc-otp-resend:focus-visible {
    outline: 2px solid var(--acc-primary-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Step Indicator ── */
.acc-step-indicator {
    text-align: center;
    margin-bottom: 1.25rem;
}

.acc-step-dots {
    display: flex;
    -webkit-display: flex;
    justify-content: center;
    -webkit-justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.acc-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--acc-border-strong);
    transition: all 0.3s ease;
}

.acc-step-dot.active {
    background: var(--acc-primary);
    width: 24px;
    border-radius: 4px;
}

.acc-step-text {
    font-size: 0.8rem;
    color: var(--acc-text-muted);
}

/* ── Result List (아이디 찾기 결과) ── */
.acc-result-list {
    margin-top: 0.95rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: var(--acc-surface-alt);
    border: 1px solid var(--acc-primary-soft);
}

.acc-result-list__title {
    color: var(--acc-text);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.acc-result-list ul {
    list-style: none;
    display: flex;
    -webkit-display: flex;
    flex-direction: column;
    -webkit-flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.acc-result-list li {
    border-radius: 10px;
    background: var(--acc-surface);
    border: 1px solid var(--acc-primary-soft);
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    color: var(--acc-text);
    display: flex;
    -webkit-display: flex;
    justify-content: space-between;
    -webkit-justify-content: space-between;
    align-items: center;
    -webkit-align-items: center;
    gap: 0.5rem;
}

.acc-result-list li button {
    background: transparent;
    border: 1px solid var(--acc-border);
    color: var(--acc-text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
}

.acc-result-list li button:hover {
    color: var(--acc-primary);
    border-color: var(--acc-primary);
}

/* ── Section Toggle (Login 방식 선택 화면) ── */
.acc-section { display: none; }
.acc-section.active {
    display: block;
    animation: accFadeIn 0.25s ease;
}

/* ── Animations ── */
@keyframes accSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes accFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (prefers-reduced-motion: reduce) {
    .acc-card,
    .acc-section.active {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .acc-spinner {
        animation-duration: 1.5s;
    }
    * {
        transition-duration: 0.001ms !important;
    }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .acc-card {
        padding: 1.6rem 1.15rem;
        border-radius: 16px;
        margin: 0.5rem;
    }

    .acc-phone-group .acc-select {
        width: 108px;
        font-size: 0.85rem;
        padding-right: 1.75rem;
    }
}
