/* CLS 性能优化 - 统一引入优化样式 */
@import url('/css/cls-optimize-2018e2997a98113e81ae40910ca6e684.css');

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 根变量 - 使用蓝色主题方案 */
:root {
    --primary-color: #4285f4;
    --primary-hover: #3367d6;
    --secondary-color: #6b7280;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --background-color: #f9fafb;
    --surface-color: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;

    /* 工具卡片颜色配置 - 便于后续调整 */
    --tool-icon-default: #93c5fd;
    --tool-icon-hover: #4285f4;
    --tool-title-default: #1f2937;
    --tool-title-gradient-start: #4285f4;
    --tool-title-gradient-end: #8b5cf6;
    --tool-desc-default: #6b7280;
    --tool-desc-hover: #4b5563;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 - 减少高度 */
.navbar {
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.nav-brand a:hover {
    color: var(--primary-hover);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--background-color);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* 下拉菜单样式 */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

/* 扩展hover区域，避免鼠标移动时菜单消失 */
.nav-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.5rem;
    z-index: 999;
}

.nav-dropdown .arrow {
    font-size: 0.7rem;
    margin-left: 0.25rem;
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    margin-top: 0.25rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

/* 主要内容 - 减少顶部间距 */
.main-content {
    min-height: calc(100vh - 56px - 200px);
    padding: 1.5rem 0;
}

/* 主内容区域布局 */
.main-content {
    margin-left: 0;
}

.main-content .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页脚 */
.footer {
    background-color: var(--text-primary);
    color: white;
    padding: 2rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section p {
    color: #9ca3af;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1rem;
    text-align: center;
    color: #9ca3af;
}

/* 响应式设计 */

/* 大屏幕优化：1200px以下，隐藏优先级低的菜单 */
@media (max-width: 1200px) {
    .nav-dropdown:nth-child(7) {
        display: none; /* 隐藏传统文化 */
    }
}

/* 中屏幕优化：1024px以下，只显示前4个菜单 */
@media (max-width: 1024px) {
    .nav-dropdown:nth-child(n+5) {
        display: none; /* 隐藏文件处理、开发者、传统文化 */
    }
}

/* 小屏幕优化：900px以下，只显示前3个菜单 */
@media (max-width: 900px) {
    .nav-dropdown:nth-child(n+4) {
        display: none; /* 只保留编码转换、图片工具、查询工具 */
    }

    .nav-menu {
        gap: 0.8rem; /* 减小间距 */
    }

    .nav-link {
        font-size: 0.8rem; /* 缩小字体 */
        padding: 0.5rem 0.5rem;
    }

    .nav-link i {
        font-size: 0.75rem; /* 缩小图标 */
    }

    .nav-dropdown .arrow {
        font-size: 0.6rem;
    }

    .nav-brand a {
        font-size: 1.1rem; /* 缩小品牌字体 */
    }

    .nav-container {
        padding: 0 15px;
    }
}

/* 移动端：768px以下，使用汉堡菜单 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--surface-color);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-md);
        border-top: 1px solid var(--border-color);
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
    }

    /* 移动端显示所有菜单 */
    .nav-dropdown {
        display: flex !important;
        width: 100%;
    }

    .nav-toggle {
        display: flex;
    }

    /* 移动端下拉菜单样式 */
    .nav-dropdown .nav-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        padding: 0 0 0 1rem;
        margin: 0;
        background-color: var(--background-color);
        border-radius: 0;
        opacity: 1;
        transform: none;
    }

    .nav-dropdown.active .dropdown-menu {
        display: block;
    }

    .nav-dropdown.active .arrow {
        transform: rotate(180deg);
    }

    .dropdown-menu a {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .nav-container {
        padding: 0 15px;
    }

}

/* 工具页面通用样式 */
.tool-page {
    padding: 2rem 0;
}

/* 工具页面头部 - 标准居中样式（推荐使用） */
/*.tool-header {*/
/*    text-align: center;*/
/*    margin-bottom: 2rem;*/
/*    padding: 1rem 0;*/
/*}*/

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.tool-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* 响应式：移动端优化 */
@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 1.5rem;
    }

    .tool-header p {
        font-size: 0.9rem;
    }
}

.tool-content {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(66 133 244 / 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.result-section {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.result-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.result-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background-color: var(--primary-hover);
}

/* 工具侧边栏 */
.tools-sidebar {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    margin-bottom: 0.5rem;
}

.sidebar-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    display: block;
    transition: var(--transition);
}

.sidebar-links a:hover {
    color: var(--primary-color);
    background-color: var(--background-color);
}

/* 两列布局样式 */
.sidebar-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sidebar-links-column {
    min-width: 0;
}

.sidebar-links-column .sidebar-links {
    margin: 0;
}

.sidebar-links-column .sidebar-links li {
    margin-bottom: 0.25rem;
}

.sidebar-links-column .sidebar-links a {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 工具页面布局 */
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-links-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 成功/错误消息 */
.message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition: opacity 0.3s ease;
}

.message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message.info {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* 表单分组 */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.radio-item input[type="radio"] {
    width: auto;
}

/* 结果网格 */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.result-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.result-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table th,
.result-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.result-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
}

.result-table tr:hover {
    background-color: var(--background-color);
}

/* 分析图表 */
.analysis-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chart-label {
    min-width: 80px;
    font-weight: 500;
    color: var(--text-secondary);
}

.chart-bar {
    flex: 1;
    height: 20px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.chart-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.chart-fill.profit-fill {
    background-color: var(--success-color);
}

.chart-value {
    min-width: 60px;
    font-weight: 600;
    text-align: right;
    color: var(--text-primary);
}

/* 输入输出操作 */
.input-actions,
.output-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.char-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: auto;
}

/* 历史记录 */
.history-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background-color: var(--surface-color);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-type {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.history-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-content {
    font-size: 0.875rem;
}

.history-input,
.history-output {
    margin-bottom: 0.25rem;
}

/* 信息网格 */
.info-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 表单帮助文本 */
.form-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* 文本链接 */
.text-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.text-link:hover {
    text-decoration: underline;
}

/* 价格变化显示 */
.result-change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.result-change.price-up {
    color: var(--error-color);
}

.result-change.price-down {
    color: var(--success-color);
}

/* 图表容器 */
.chart-container {
    height: 300px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-size: 0.875rem;
}


