/**
 * 花椒卡密充值系统 - CSS样式
 */

/* ─── 重置与基础 ─────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B6B;
    --primary-dark: #e05555;
    --primary-light: #FF8E53;
    --secondary: #6C63FF;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-main: #0F0F1E;
    --glass-bg: rgba(255,255,255,0.06);
    --glass-border: rgba(255,255,255,0.12);
    --glass-shadow: 0 8px 32px rgba(0,0,0,0.4);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --font: 'Inter', 'Microsoft YaHei', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 16px 40px;
    overflow-x: hidden;
    position: relative;
    color: #fff;
}

/* ─── 背景装饰球 ─────────────────────────────────────────────── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #FF6B6B, #FF8E53);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #6C63FF, #48CAE4);
    bottom: 0;
    right: -80px;
    animation-delay: -3s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #10B981, #06B6D4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
}

@keyframes orbFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    33% { transform: translateY(-20px) scale(1.05); }
    66% { transform: translateY(15px) scale(0.97); }
}

/* ─── 容器 ────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

/* ─── 页面切换 ────────────────────────────────────────────────── */
.page { width: 100%; }
.hidden { display: none !important; }

/* ─── 加载遮罩 ────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.4s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner-ring {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(255,107,107,0.2);
    border-top-color: #FF6B6B;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 15px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ─── 玻璃卡片 ────────────────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow);
    animation: slideUp 0.4s ease;
}

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

/* ─── 错误卡片 ────────────────────────────────────────────────── */
.error-card {
    text-align: center;
    padding: 48px 28px;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
}

.card-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.error-icon {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.4);
    color: #EF4444;
}

.error-icon svg {
    width: 36px;
    height: 36px;
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: #EF4444;
    margin-bottom: 12px;
}

.card-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ─── 品牌头部 ────────────────────────────────────────────────── */
.brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.brand-logo svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 12px rgba(255,107,107,0.4));
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    letter-spacing: 1px;
}

/* ─── 步骤条 ─────────────────────────────────────────────────── */
.steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
}

.step.active .step-dot {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    border-color: transparent;
    color: white;
    box-shadow: 0 0 20px rgba(255,107,107,0.5);
}

.step.done .step-dot {
    background: var(--success);
    border-color: transparent;
    color: white;
}

.step-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--transition);
}

.step.active .step-label {
    color: #FF8E53;
    font-weight: 500;
}

.step.done .step-label {
    color: var(--success);
}

.step-line {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.1);
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 1px;
    transition: background var(--transition);
    min-width: 20px;
}

.step-line.done {
    background: linear-gradient(90deg, #FF6B6B, #10B981);
}

/* ─── 步骤内容 ────────────────────────────────────────────────── */
.step-content {
    animation: stepIn 0.3s ease;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.step-header {
    margin-bottom: 24px;
}

.step-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.step-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.step-desc strong {
    color: #FF8E53;
}

/* ─── 表单组 ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 14px 14px 14px 46px;
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

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

.form-input:focus {
    border-color: #FF6B6B;
    background: rgba(255,107,107,0.07);
    box-shadow: 0 0 0 3px rgba(255,107,107,0.15);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: #FF8E53;
}

.input-hint {
    font-size: 12px;
    margin-top: 6px;
    padding: 0 4px;
    min-height: 16px;
    transition: color var(--transition);
}

.input-hint.error { color: #EF4444; }
.input-hint.success { color: var(--success); }

/* ─── 图形验证码 ──────────────────────────────────────────────── */
.captcha-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.captcha-image-wrap {
    flex: 1;
    height: 56px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: border-color var(--transition);
}

.captcha-image-wrap:hover { border-color: rgba(255,107,107,0.5); }

.captcha-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

.captcha-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,15,30,0.6);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.captcha-loading.visible { opacity: 1; }

.mini-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,107,107,0.3);
    border-top-color: #FF6B6B;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.refresh-btn {
    width: 48px;
    height: 56px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.refresh-btn:hover {
    border-color: rgba(255,107,107,0.5);
    color: #FF6B6B;
    background: rgba(255,107,107,0.08);
}

.refresh-btn svg {
    width: 20px;
    height: 20px;
}

/* ─── 按钮 ────────────────────────────────────────────────────── */
.primary-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(255,107,107,0.35);
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity var(--transition);
}

.primary-btn:hover::before { opacity: 1; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(255,107,107,0.45); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled {
    background: rgba(255,255,255,0.1);
    box-shadow: none;
    cursor: not-allowed;
    color: var(--text-muted);
}

.btn-arrow {
    font-size: 18px;
    line-height: 1;
    transition: transform var(--transition);
}

.primary-btn:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }

.secondary-btn {
    padding: 14px 20px;
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}

.btn-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-row .primary-btn { flex: 1; }

/* ─── 重发短信 ────────────────────────────────────────────────── */
.resend-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.resend-tip {
    font-size: 13px;
    color: var(--text-muted);
}

.resend-btn {
    background: none;
    border: none;
    color: #FF8E53;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all var(--transition);
}

.resend-btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.resend-btn:not(:disabled):hover { background: rgba(255,142,83,0.1); }

.countdown {
    font-size: 12px;
    background: rgba(255,107,107,0.15);
    color: #FF8E53;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── 成功动画 ────────────────────────────────────────────────── */
.success-animation {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.success-circle {
    width: 80px;
    height: 80px;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    stroke-width: 2;
    stroke: var(--success);
    stroke-miterlimit: 10;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 2.5;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

.success-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.success-desc {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.ck-info {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
}

.ck-label {
    font-size: 12px;
    color: var(--success);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.ck-value {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    font-family: monospace;
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── 安全底部 ────────────────────────────────────────────────── */
.security-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.shield-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ─── 持久错误提示横幅 ─────────────────────────────────────── */
.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    color: #fca5a5;
    font-size: 13px;
    line-height: 1.5;
    animation: bannerIn 0.25s ease;
}

@keyframes bannerIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.error-banner-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    color: #f87171;
}

/* ─── Toast 提示 ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 32px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success-toast { border-color: rgba(16,185,129,0.4); }
.toast.error-toast { border-color: rgba(239,68,68,0.4); }
.toast.warning-toast { border-color: rgba(245,158,11,0.4); }

/* ─── 响应式 ─────────────────────────────────────────────────── */
@media screen and (max-width: 480px) {
    body { padding: 16px 12px 32px; }

    .glass-card { padding: 24px 20px; border-radius: 20px; }

    .brand-name { font-size: 18px; }
    .brand-logo svg { width: 42px; height: 42px; }

    .step-label { font-size: 10px; }

    .form-input { font-size: 16px !important; /* prevent iOS zoom */ }

    .primary-btn { font-size: 15px; padding: 14px; }

    .btn-row { flex-direction: column; }
    .btn-row .secondary-btn { width: 100%; }
    .btn-row .primary-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .orb { animation: none; }
    .checkmark-circle, .checkmark-check { animation: none; stroke-dashoffset: 0; }
}
