:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --footer-bg: #0f172a;
    --footer-text: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-active: #eff6ff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body.dark-theme {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --footer-bg: #020617;
    --sidebar-bg: #1e293b;
    --sidebar-active: #334155;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo i {
    margin-right: 10px;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
}

.nav-links li {
    margin-left: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.btn-icon:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Hero Section */
.hero {
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.025em;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-btns {
    display: flex;
    justify-content: center;
    gap: 16px;
}

@media (max-width: 640px) {
    .hero {
        padding: 60px 0;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .hero-btns {
        flex-direction: column;
        align-items: stretch;
        padding: 0 20px;
    }
    .hero-btns .btn {
        margin: 0 !important;
    }
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 24px;
    display: block;
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
}

.card .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--bg-color);
    border-color: var(--text-muted);
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: all 0.2s;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 8% auto;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    border-radius: 16px;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-color);
}

.modal-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* Footer */
.footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 64px 0;
    text-align: center;
    margin-top: 80px;
}

.footer p {
    opacity: 0.7;
    font-size: 0.875rem;
}

.footer-links {
    margin-top: 24px;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    margin: 0 12px;
    opacity: 0.6;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
}

/* Code block styles */
pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 拼图验证码样式 */
.captcha-wrapper {
    position: relative;
    width: 100%;
}

.captcha-btn {
    width: 100%;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.captcha-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
}

.captcha-btn.success {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
    cursor: default;
}

.captcha-popover {
    display: none;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    z-index: 100;
    width: 340px;
    max-width: 90vw;
}

.captcha-popover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: var(--card-bg) transparent transparent transparent;
}

.captcha-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    user-select: none;
}

.captcha-bg-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
    background: #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.captcha-bg-img {
    width: 100%;
    height: 100%;
    display: block;
}

.captcha-piece-img {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    cursor: grab;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.captcha-piece-img:active {
    cursor: grabbing;
}

.captcha-slider-bar {
    position: relative;
    width: 100%;
    height: 44px;
    background: #f1f5f9;
    border-radius: 22px;
    margin-top: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.captcha-slider-track {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--primary-color);
    opacity: 0.15;
}

.captcha-slider-button {
    position: absolute;
    left: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    transition: background 0.2s, color 0.2s;
    border: 1px solid var(--border-color);
}

.captcha-slider-button:hover {
    background: var(--primary-color);
    color: #fff;
}

.captcha-slider-button:active {
    cursor: grabbing;
}

.captcha-slider-text {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    line-height: 44px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    z-index: 5;
    pointer-events: none;
}

.captcha-refresh {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 15;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.captcha-refresh:hover {
    opacity: 1;
    transform: rotate(180deg);
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    background: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 4px;
}

/* App Grid Menu */
.app-menu-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
}

.app-menu-content {
    background-color: var(--card-bg);
    margin: 10vh auto;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease-out;
}

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

.app-menu-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 32px;
    height: 32px;
    background: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.app-menu-close:hover {
    background: var(--error-color);
    color: white;
}

.app-menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 24px;
}

.app-menu-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background-color: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.app-menu-item:hover {
    background-color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.app-menu-item i {
    margin-right: 10px;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none !important;
    }

    .mobile-nav-toggle {
        display: block !important;
        color: var(--text-color);
    }

    .mobile-nav-menu {
        background-color: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 10px 20px;
        box-shadow: var(--shadow);
    }

    .mobile-nav-menu ul {
        list-style: none;
    }

    .mobile-nav-menu li {
        margin-bottom: 15px;
    }

    .mobile-nav-menu a {
        color: var(--text-color);
        text-decoration: none;
        font-weight: 500;
        display: block;
        padding: 10px 0;
    }

    .hero h1 { font-size: 2.25rem; }
    .modal-content { width: 92%; padding: 24px; }
}
