/* main.css - 扁平化设计样式 */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 本地字体定义 - 使用系统字体栈 */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #e2e8f0;
    --gray-dark: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* 优化字体栈：优先使用系统字体 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", 
                 "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif,
                 "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 等宽字体栈 - 针对代码块 */
code, pre, .code-block, .font-mono {
    font-family: "SF Mono", Monaco, "Cascadia Mono", "Segoe UI Mono", 
                 "Roboto Mono", "Ubuntu Mono", "Liberation Mono", 
                 "DejaVu Sans Mono", "Courier New", Courier, monospace;
}

/* 中文字体优化 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

/* 字体粗细类 */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 容器 */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 实用类 */
.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;
}

/* 卡片样式 - 扁平化 */
.card {
    background: white;
    border: 1px solid var(--gray);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* 按钮样式 - 扁平化 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

/* 代码块 */
.code-block {
    background: var(--dark);
    color: #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    overflow-x: auto;
}

.code-block .comment { color: var(--gray-dark); }
.code-block .keyword { color: #60a5fa; }
.code-block .string { color: #34d399; }
.code-block .function { color: #fbbf24; }
.code-block .variable { color: #c084fc; }

/* 分隔线 */
.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gray), transparent);
    margin: 2rem 0;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.tag-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip-text {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.tooltip:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

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

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: var(--gray);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* 页面特定样式 - 扁平化设计 */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.card-flat {
    border: 1px solid var(--gray);
    border-radius: 0.75rem;
    transition: border-color 0.2s, transform 0.2s;
    background: white;
}

.card-flat:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.step-flat {
    border-left: 4px solid var(--primary);
    background: white;
}

.faq-flat {
    border: 1px solid var(--gray);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-flat.active {
    border-color: var(--primary);
}

.faq-question-flat {
    background: var(--light);
    transition: background-color 0.2s;
}

.faq-question-flat:hover {
    background: #f1f5f9;
}

.anchor-link-flat {
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

h2:hover .anchor-link-flat,
h3:hover .anchor-link-flat {
    opacity: 1;
}

.code-block-flat {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin: 1rem 0;
}

.code-comment { color: #64748b; }
.code-keyword { color: #60a5fa; }
.code-string { color: #34d399; }
.code-function { color: #fbbf24; }

/* 工具页面特定样式 */
.tool-card {
    background: white;
    border: 1px solid var(--gray);
    border-radius: 1rem;
    transition: all 0.2s ease;
}

.tool-card:hover {
    border-color: var(--primary);
}

.amount-input {
    transition: all 0.2s ease;
}

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

.output-result {
    transition: all 0.3s ease;
}

.output-result.highlight {
    color: var(--success);
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #cbd5e1;
}

.status-dot.active {
    background-color: var(--success);
    animation: pulse 1.5s infinite;
}

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

.quick-btn {
    transition: all 0.2s ease;
}

.quick-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.example-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.example-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.sidebar-link {
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.sidebar-link.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* 隐私条款页面特定样式 */
.section-flat {
    border: 1px solid var(--gray);
    border-radius: 0.75rem;
    background: white;
    transition: border-color 0.2s ease;
}

.section-flat:hover {
    border-color: var(--primary);
}

.highlight-flat {
    background-color: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 0 0.5rem 0.5rem 0;
}

.warning-flat {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
    border-radius: 0 0.5rem 0.5rem 0;
}

.nav-link-flat {
    border: 1px solid var(--gray);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link-flat:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.back-to-top-flat {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--primary);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    border: 2px solid transparent;
}

.back-to-top-flat.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top-flat:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    border-color: white;
}

.acceptance-flat {
    border: 2px solid #bae6fd;
    border-radius: 0.75rem;
    background-color: #f0f9ff;
}

.acceptance-checkbox-flat {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.acceptance-checkbox-flat input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary);
}

/* 面包屑导航 */
.breadcrumb {
    background: white;
    border-bottom: 1px solid var(--gray);
    padding: 1rem 0;
}

/* ==================== 导航栏样式 ==================== */

/* 电脑端导航 */
.desktop-nav {
    display: none;
}

.desktop-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.desktop-nav ul li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--dark);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.desktop-nav ul li a:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

/* 移动端导航按钮 */
.mobile-nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 1001;
}

.mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--dark);
    margin: 2px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
}

.mobile-nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* 移动端菜单遮罩层 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.show {
    display: block;
    opacity: 1;
}

/* 移动端侧边栏菜单 */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    overflow-y: auto;
    padding-top: 1rem;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav ul {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.mobile-nav ul li {
    width: 100%;
}

.mobile-nav ul li a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    color: var(--dark);
    text-decoration: none;
    border-bottom: 1px solid var(--gray);
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
}

.mobile-nav ul li:last-child a {
    border-bottom: none;
}

.mobile-nav ul li a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.mobile-nav ul li a i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 1rem;
    color: var(--secondary);
}

.mobile-nav ul li a:hover i {
    color: var(--primary);
}

.mobile-nav-category {
    padding: 1.25rem 1.5rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-nav-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--gray);
    margin-top: 1rem;
    background-color: var(--light);
}

.mobile-nav-footer p {
    font-size: 0.75rem;
    color: var(--secondary);
    margin: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .card {
        border-radius: 0.5rem;
    }
    
    .stack-mobile {
        flex-direction: column !important;
    }
    
    body {
        font-size: 15px;
    }
    
    /* 在移动端显示菜单按钮 */
    .mobile-nav-toggle {
        display: flex;
    }
}

@media (min-width: 769px) {
    /* 在电脑端显示导航菜单，隐藏移动端按钮 */
    .mobile-nav-toggle {
        display: none !important;
    }
    
    .desktop-nav {
        display: block !important;
    }
    
    /* 隐藏移动端菜单 */
    .mobile-nav {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }
    
    body {
        font-size: 14px;
    }
    
    /* 手机端导航栏样式优化 */
    .mobile-nav {
        width: 260px;
    }
    
    .mobile-nav ul li a {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .mobile-nav-category {
        padding: 1.125rem 1.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .mobile-nav {
        width: 240px;
    }
    
    .mobile-nav ul li a {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .mobile-nav-category {
        padding: 1rem 1rem 0.5rem;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: black;
        background: white;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    nav {
        display: none !important;
    }
}

/* 字体加载优化 */
.font-loading {
    visibility: hidden;
}

.font-loaded {
    visibility: visible;
    animation: fadeIn 0.3s ease-in;
}

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

/* 优化渲染性能 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 滚动条优化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 阻止页面滚动当菜单打开时 */
body.menu-open {
    overflow: hidden;
}

/* ... 前面的样式保持不变 ... */

/* ==================== 消息通知样式 ==================== */
.message-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    max-width: 400px;
    margin: 0 auto;
    z-index: 10000;
    animation: messageSlideIn 0.3s ease-out;
}

.message-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    font-size: 0.875rem;
}

.message-content i {
    margin-right: 10px;
    font-size: 1.125rem;
}

.message-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message-success i {
    color: #10b981;
}

.message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message-error i {
    color: #ef4444;
}

.message-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.message-warning i {
    color: #f59e0b;
}

.message-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.message-info i {
    color: #3b82f6;
}

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


/* ==================== 弹框组件样式 ==================== */
.modal-notification {
    position: fixed;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.modal-content.show {
    opacity: 1;
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.modal-success .modal-icon {
    background-color: #d1fae5;
    color: #10b981;
}

.modal-error .modal-icon {
    background-color: #fee2e2;
    color: #ef4444;
}

.modal-warning .modal-icon {
    background-color: #fef3c7;
    color: #f59e0b;
}

.modal-info .modal-icon {
    background-color: #dbeafe;
    color: #3b82f6;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.modal-close:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.modal-body {
    padding: 20px;
    color: #4b5563;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    min-width: 80px;
}

.modal-btn-confirm {
    background-color: #3b82f6;
    color: white;
}

.modal-btn-confirm:hover {
    background-color: #2563eb;
}

.modal-btn-cancel {
    background-color: #f3f4f6;
    color: #4b5563;
}

.modal-btn-cancel:hover {
    background-color: #e5e7eb;
}

/* 动画效果 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

.modal-content.slideInRight {
    animation: slideInRight 0.3s ease forwards;
}

.modal-content.slideInLeft {
    animation: slideInLeft 0.3s ease forwards;
}

.modal-content.fadeInDown {
    animation: fadeInDown 0.3s ease forwards;
}

.modal-content.fadeInUp {
    animation: fadeInUp 0.3s ease forwards;
}

/* 响应式调整 */
@media (max-width: 640px) {
    .modal-notification {
        left: 20px !important;
        right: 20px !important;
        top: 20px !important;
        bottom: auto !important;
        transform: none !important;
    }
    
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
    }
}