/* ============================================
   AI 小卖部 — v8 · Nebula Pro
   Ultra-Premium Dark Theme · Big-Tech Grade
   Inspired by Linear, Stripe, Vercel
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: #7c5cfc;
    --primary-hover: #6a4de8;
    --primary-light: #a78bfa;
    --primary-soft: rgba(124, 92, 252, 0.08);
    --primary-glow: rgba(124, 92, 252, 0.25);
    --accent: #38bdf8;
    --accent2: #ec4899;

    --bg-body: #08080c;
    --bg-card: rgba(12, 12, 20, 0.25);
    --bg-card-solid: rgba(12, 12, 20, 0.5);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-hover: rgba(255, 255, 255, 0.06);
    --bg-input-focus: rgba(255, 255, 255, 0.07);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52525b;
    --text-accent: #c4b5fd;

    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.13);

    --success: #22c55e;
    --danger: #ef4444;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; }

/* ─── Body ─── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
        'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow: hidden;
}

/* ─── Animated Mesh Background ─── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 5% 15%, rgba(124, 92, 252, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(56, 189, 248, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
    animation: meshPulse 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes meshPulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Dot grid overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 70%);
}

/* Particles handled by particles.js canvas */

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

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 0.65rem;
    animation: fadeIn 0.6s var(--ease-out);
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(-12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Animated brand icon */
.brand-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.4rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.2) 0%, rgba(56, 189, 248, 0.15) 50%, rgba(236, 72, 153, 0.12) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: iconGlow 4s ease-in-out infinite;
    border: 1px solid rgba(124, 92, 252, 0.2);
}

.brand-icon::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--accent2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    animation: borderRotate 5s linear infinite;
}

@keyframes iconGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(124, 92, 252, 0.15); }
    50%      { box-shadow: 0 0 30px rgba(124, 92, 252, 0.25), 0 0 60px rgba(56, 189, 248, 0.1); }
}

@keyframes borderRotate {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.brand-icon-inner {
    font-size: 1.6rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(124, 92, 252, 0.3));
}

.header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff 0%, #c4b5fd 35%, #7c5cfc 55%, #38bdf8 75%, #fff 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 5s ease-in-out infinite;
}

@keyframes textShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ─── Status Bar ─── */
.quick-actions-title {
    margin-bottom: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-full);
    background: rgba(124, 92, 252, 0.06);
    border: 1px solid rgba(124, 92, 252, 0.1);
    color: var(--text-accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.7s var(--ease-out);
}

.quick-actions-title svg {
    width: 12px;
    height: 12px;
    color: var(--primary-light);
}

.quick-actions {
    margin-bottom: 0.5rem;
    animation: fadeIn 0.8s var(--ease-out);
}

/* ─── Card with animated border ─── */
.card {
    position: relative;
    padding: 1.15rem 1.3rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    animation: cardReveal 0.55s var(--ease-out);
    overflow: hidden;
    border: 1px solid transparent;
    background-clip: padding-box;
}

/* Animated gradient border */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(124, 92, 252, 0.3),
        rgba(56, 189, 248, 0.2),
        rgba(236, 72, 153, 0.15),
        rgba(124, 92, 252, 0.3)
    );
    background-size: 300% 300%;
    animation: gradientBorder 8s ease-in-out infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
}

/* Top glow line */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(124, 92, 252, 0.5),
        rgba(56, 189, 248, 0.4),
        transparent
    );
    z-index: 1;
}

@keyframes gradientBorder {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes cardReveal {
    0%   { opacity: 0; transform: translateY(16px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Card internal soft glow */
.card-glow {
    position: absolute;
    top: -40%;
    left: -20%;
    width: 140%;
    height: 80%;
    background: radial-gradient(ellipse at center, rgba(124, 92, 252, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Card Header ─── */
.card-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.18), rgba(56, 189, 248, 0.10));
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(124, 92, 252, 0.15);
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-align: left;
}

.card h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ─── Form ─── */
.form-group {
    margin-bottom: 0.55rem;
    position: relative;
    z-index: 1;
}

.form-group label {
    display: block;
    font-size: 0.76rem;
    font-weight: 600;
    margin-bottom: 0.28rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* ─── Input with glow ─── */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-dim);
    pointer-events: none;
    transition: color 0.2s, filter 0.2s;
    z-index: 2;
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary-light);
    filter: drop-shadow(0 0 4px rgba(124, 92, 252, 0.5));
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: all 0.2s var(--ease-out);
    outline: none;
}

.form-input.has-icon { padding-left: 2.4rem; }

.form-input::placeholder {
    color: var(--text-dim);
    font-weight: 400;
}

.form-input:hover {
    border-color: var(--border-hover);
    background: var(--bg-input-hover);
}

.form-input:focus {
    border-color: var(--primary);
    background: var(--bg-input-focus);
    box-shadow:
        0 0 0 3px rgba(124, 92, 252, 0.12),
        0 0 15px rgba(124, 92, 252, 0.08);
}

.form-help {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ─── Divider ─── */
.divider {
    position: relative;
    text-align: center;
    margin: 0.65rem 0 0.5rem;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(124, 92, 252, 0.15),
        rgba(56, 189, 248, 0.1),
        transparent
    );
}

.divider span {
    position: relative;
    background: var(--bg-card-solid);
    padding: 0 0.75rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ─── Warranty ─── */
.warranty-section {
    padding: 0;
    position: relative;
    z-index: 1;
}

.warranty-section .form-help {
    font-size: 0.68rem;
    line-height: 1.5;
}

/* ─── Buttons — Shimmer Effect ─── */
.btn {
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
    transition: all 0.25s var(--ease-out);
    z-index: 1;
    outline: none;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
}

.btn svg, .btn i { width: 15px; height: 15px; }

/* Primary — gradient with animated shimmer */
.btn-primary {
    background: linear-gradient(135deg, #7c5cfc 0%, #6a4de8 50%, #8b6cf7 100%);
    color: white;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(124, 92, 252, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Shimmer sweep on primary buttons */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.12),
        transparent
    );
    transition: none;
    animation: btnShimmer 4s ease-in-out infinite;
}

@keyframes btnShimmer {
    0%   { left: -100%; }
    40%  { left: 150%; }
    100% { left: 150%; }
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(124, 92, 252, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    filter: brightness(1.08);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(0.95);
}

/* Secondary */
.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border-default);
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    width: auto;
    min-height: auto;
    border-radius: 6px;
}

.btn-link { text-decoration: none; }

/* ─── Actions ─── */
.actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.45rem;
    position: relative;
    z-index: 1;
}

.actions .btn { flex: 1; }

/* ─── Toast ─── */
.toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 0.6rem 1.1rem;
    background: rgba(20, 20, 28, 0.95);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 1px var(--border-default), 0 8px 32px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
    font-size: 0.82rem;
    font-weight: 600;
    max-width: 88%;
    color: var(--text-primary);
    animation: toastSlide 0.3s var(--ease-out) forwards;
}

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast.show { display: flex; align-items: center; gap: 0.4rem; justify-content: center; }
.toast.success { background: rgba(5, 46, 22, 0.93); border: 1px solid rgba(34, 197, 94, 0.2); color: #4ade80; }
.toast.error   { background: rgba(68, 12, 12, 0.93); border: 1px solid rgba(239, 68, 68, 0.2); color: #fca5a5; }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ─── Steps ─── */
.step { display: none; }
.step.active { display: block; }

/* ─── Result ─── */
.result-success, .result-error { text-align: center; padding: 0.4rem 0; }
.result-icon { font-size: 2.5rem; margin-bottom: 0.6rem; line-height: 1; }
.result-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.3rem; letter-spacing: -0.02em; }
.result-message { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; line-height: 1.5; }

.result-details {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    text-align: left;
    margin-bottom: 1rem;
    border: 1px solid var(--border-subtle);
}

.result-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.result-detail-item:last-child { border-bottom: none; }
.result-detail-label { font-size: 0.8rem; color: var(--text-muted); }
.result-detail-value { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }

/* ─── Teams List ─── */
.teams-list { margin-bottom: 0.6rem; }

/* ─── Warranty info ─── */
.warranty-info {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 0.7rem;
    border: 1px solid var(--border-subtle);
}

.warranty-item { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.8rem; }
.warranty-item:not(:last-child) { border-bottom: 1px solid var(--border-subtle); }
.warranty-label { color: var(--text-muted); }
.warranty-value { font-weight: 600; color: var(--text-primary); }
.warranty-active { color: var(--success); }
.warranty-expired { color: var(--danger); }

/* ─── Modal ─── */
.usage-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 1rem;
}

.usage-modal-overlay.show { display: flex; }

.usage-modal {
    width: 100%;
    max-width: 480px;
    background: rgba(18, 18, 28, 0.97);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.05), 0 16px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalEnter 0.3s var(--ease-out);
}

@keyframes modalEnter {
    0%   { opacity: 0; transform: translateY(10px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.usage-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.usage-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-modal-close {
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 7px;
    transition: all 0.15s;
}

.usage-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.usage-modal-body {
    padding: 1rem 1.2rem 1.2rem;
}

.usage-modal-body ol {
    margin: 0;
    padding-left: 1.1rem;
}

.usage-modal-body li {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.35rem;
}

.usage-modal-body li::marker {
    color: var(--primary-light);
    font-weight: 700;
}

/* ─── Spinner ─── */
.btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    body { padding: 0.5rem; height: auto; min-height: 100vh; overflow: auto; }
    .container { max-width: 100%; }
    .card { padding: 1rem; }
    .btn { min-height: 42px; }
}

@media (max-width: 480px) {
    body { padding: 0.4rem 0.6rem; }
    .brand-icon { width: 44px; height: 44px; }
    .header h1 { font-size: 1.2rem; }
    .card { padding: 0.9rem; border-radius: var(--radius-md); }
    .toast { left: 0.6rem; right: 0.6rem; transform: none; max-width: none; }
    @keyframes toastSlide {
        from { opacity: 0; transform: translateY(-12px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .actions { flex-direction: column; }
}

@media (max-height: 650px) {
    .brand-icon { width: 40px; height: 40px; }
    .brand-icon-inner { font-size: 1.3rem; }
    .header { margin-bottom: 0.4rem; }
    .header h1 { font-size: 1.15rem; }
    .card { padding: 0.85rem 1rem; }
    .card-header { margin-bottom: 0.5rem; padding-bottom: 0.4rem; }
    .form-group { margin-bottom: 0.4rem; }
    .form-input { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
    .form-input.has-icon { padding-left: 2.1rem; }
    .btn { padding: 0.4rem; font-size: 0.8rem; }
    .divider { margin: 0.45rem 0 0.35rem; }
    .quick-actions-title { padding: 0.2rem 0.7rem; font-size: 0.68rem; }
}
