/* KeZong V2.0 - Main Stylesheet
   客踪卫士 AI智能追踪管控中枢
   CSP-Compliant: No inline styles */

:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --primary-light: #A29BFE;
    --accent: #00CEC9;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #FF7675;
    --dark: #1A1A2E;
    --dark-2: #16213E;
    --gray: #636E72;
    --gray-light: #DFE6E9;
    --bg: #F5F6FA;
    --white: #FFFFFF;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Landing Page ─────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
    color: var(--white);
    padding: 80px 20px 60px;
    text-align: center;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.2rem;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero .cta-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

/* ─── Features Grid ────────────────────────────────────────── */
.features {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 48px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ─── Architecture Section ─────────────────────────────────── */
.architecture {
    background: var(--dark);
    color: var(--white);
    padding: 60px 20px;
}

.arch-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.arch-inner h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

.arch-layers {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.arch-layer {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 20px 24px;
    border-left: 4px solid var(--primary);
}

.arch-layer:nth-child(1) { border-color: var(--primary); }
.arch-layer:nth-child(2) { border-color: var(--accent); }
.arch-layer:nth-child(3) { border-color: var(--warning); }
.arch-layer:nth-child(4) { border-color: var(--success); }
.arch-layer:nth-child(5) { border-color: var(--danger); }

.arch-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-light);
    margin-right: 20px;
    min-width: 40px;
}

.arch-info h4 { font-size: 1.1rem; }
.arch-info p { font-size: 0.9rem; opacity: 0.7; }

/* ─── Dashboard Layout ─────────────────────────────────────── */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--dark);
    color: var(--white);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 24px 24px;
    font-size: 1.3rem;
    font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.sidebar-logo span { color: var(--accent); }

.nav-item {
    display: block;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
}

.nav-item .nav-icon {
    margin-right: 10px;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.6rem;
}

/* ─── Stat Cards ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-delta {
    font-size: 0.8rem;
    margin-top: 4px;
}

.stat-delta.positive { color: var(--success); }
.stat-delta.negative { color: var(--danger); }

/* ─── Tables ───────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body { padding: 24px; }

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}

table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
}

table tbody tr:hover {
    background: rgba(108, 92, 231, 0.03);
}

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cold { background: #DFE6E9; color: var(--gray); }
.badge-warm { background: #FDCB6E33; color: #B8860B; }
.badge-hot { background: #FF767533; color: #C0392B; }
.badge-qualified { background: #00B89433; color: #006400; }
.badge-new { background: #6C5CE733; color: var(--primary); }
.badge-contacted { background: #00CEC933; color: #008B8B; }
.badge-won { background: #00B894; color: #fff; }
.badge-lost { background: #FF7675; color: #fff; }

/* ─── Funnel Visualization ─────────────────────────────────── */
.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 12px;
}

.funnel-label {
    width: 120px;
    font-size: 0.9rem;
    font-weight: 600;
}

.funnel-bar-container {
    flex: 1;
    background: var(--gray-light);
    border-radius: 6px;
    height: 32px;
    overflow: hidden;
    position: relative;
}

.funnel-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    transition: width 0.5s ease;
}

/* ─── Realtime Feed ────────────────────────────────────────── */
.realtime-feed {
    max-height: 400px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-light);
    font-size: 0.9rem;
}

.feed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.feed-time {
    color: var(--gray);
    font-size: 0.8rem;
    margin-left: auto;
}

/* ─── Forms ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* ─── Toggle Switch ────────────────────────────────────────── */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-light);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo { font-size: 0.8rem; padding: 0 10px 16px; }
    .nav-item { padding: 12px; text-align: center; }
    .nav-item .nav-icon { margin: 0; }
    .main-content { margin-left: 60px; padding: 16px; }
    .hero h1 { font-size: 1.8rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Pricing Section ──────────────────────────────────────── */
.pricing {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.pricing h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 48px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 36px 28px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pricing-card.featured {
    border-color: var(--primary);
    position: relative;
}

.pricing-card.featured::before {
    content: "热门";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--white);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.pricing-card .plan-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray);
    margin-bottom: 8px;
}

.pricing-card .plan-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.pricing-card .plan-price .currency {
    font-size: 1.2rem;
    vertical-align: top;
}

.pricing-card .plan-period {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 24px;
}

.pricing-card .plan-features {
    list-style: none;
    text-align: left;
    margin-bottom: 28px;
}

.pricing-card .plan-features li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--gray);
    padding-left: 24px;
    position: relative;
}

.pricing-card .plan-features li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.pricing-card .btn {
    width: 100%;
}

/* ─── Get Started Section ──────────────────────────────────── */
.get-started {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg);
}

.get-started h2 {
    margin-bottom: 24px;
}

.get-started .desc {
    color: var(--gray);
    max-width: 500px;
    margin: 0 auto 32px;
}

.get-started .code-block {
    background: var(--dark);
    color: var(--accent);
    padding: 20px;
    border-radius: var(--radius);
    display: inline-block;
    text-align: left;
    max-width: 600px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.get-started .cta-margin {
    margin-top: 32px;
}

/* ─── Footer ───────────────────────────────────────────────── */
.footer {
    background: var(--dark);
    color: rgba(255,255,255,0.6);
    padding: 24px;
    text-align: center;
    font-size: 0.85rem;
}

.footer .footer-sub {
    margin-top: 4px;
}

/* ─── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.modal .modal-body {
    margin-bottom: 24px;
}

.modal .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal .pay-qr {
    text-align: center;
    padding: 20px 0;
}

.modal .pay-qr img {
    max-width: 200px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
}

.modal .pay-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0;
}

.btn-close-pay {
    color: var(--gray) !important;
    border-color: var(--gray) !important;
}
