/* 全局样式 */
:root {
    --primary-color: #3643BA;
    --primary-hover: #2a3599;
    --text-dark: #1a1a1a;
    --text-gray: #666;
    --border-color: #e0e0e0;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
}

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

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 - 简洁设计 */
.navbar {
    background-color: #3643BA;
    border-bottom: none;
    padding: 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 30px;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 600;
    color: white !important;
}

.navbar-brand .fas.fa-tools {
    border: 1px solid #ffffff;
    padding: 1px;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.navbar-nav a {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.navbar-nav a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* 首页 Hero 区域 */
.hero-section {
    color: var(--text-dark);
    padding: 80px 0;
    margin-bottom: 40px;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.hero-section p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-gray);
}

.hero-section .search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.hero-section .search-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-item {
    display: block;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    transition: background 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--bg-light);
}

.search-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.search-item-desc {
    font-size: 13px;
    color: var(--text-gray);
}

.search-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-gray);
}

/* 页面标题 - 简洁版 */
.page-header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 40px 0 30px;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: normal;
}

.page-header p {
    font-size: 14px;
    color: var(--text-gray);
}

/* 搜索框 */
.search-container {
    background-color: var(--bg-white);
    padding: 30px 0;
    margin-bottom: 30px;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-input::placeholder {
    color: #999;
}

/* 工具分类标签 */
.category-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.category-tab {
    padding: 8px 16px;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
    transition: all 0.3s;
}

.category-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-tab.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 分类区块 */
.category-section {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-weight: 600;
}

.category-desc {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 15px;
}

/* 工具列表 - 紧凑网格 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.tool-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(54, 67, 186, 0.1);
}

.tool-card h3 {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-weight: 600;
}

.tool-card p {
    font-size: 13px;
    color: var(--text-gray);
    line-height: 1.5;
}

.tool-card .category-tag {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    background-color: var(--bg-light);
    color: var(--text-gray);
    border-radius: 3px;
    margin-top: 8px;
}

/* 面包屑 */
/* 横屏工具菜单 */
.tools-menu {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 100;
}

.tools-menu .container {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 0;
    min-width: max-content;
    position: relative;
    overflow: visible !important;
    overflow-x: auto;
    overflow-y: visible !important;
}

.tools-menu-item {
    position: relative !important;
    display: inline-block;
    overflow: visible !important;
}

.tools-menu-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #999999;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
    min-width: 120px;
    text-align: left;
}

.tools-menu-trigger > span:first-child {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.tools-menu-trigger:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.tools-menu-item.active .tools-menu-trigger {
    background: transparent;
    color: var(--primary-color);
}

.tools-menu-item.active .tools-menu-trigger .dropdown-arrow {
    color: var(--primary-color);
}


.dropdown-arrow {
    font-size: 10px;
    color: var(--text-gray);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.tools-menu-item.open .dropdown-arrow,
.tools-menu-item:hover .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* 下拉框样式 - 类似 json.cn 的效果 */
.tools-dropdown {
    display: none;
    position: fixed;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 350px;
    max-width: 600px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 999999;
    padding: 12px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

/* hover时显示下拉框 */
.tools-menu-item:hover .tools-dropdown,
.tools-menu-item.open .tools-dropdown {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tools-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #999999;
    font-size: 13px;
    line-height: 16px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    outline: none;
    box-sizing: border-box;
}

.tools-dropdown-item > * {
    line-height: 16px;
}

.tools-dropdown-item:focus {
    border: none;
    outline: none;
}

.tools-dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
    border: none;
    transform: none;
    box-shadow: none;
}

.tools-dropdown-item.active {
    background: rgba(54, 67, 186, 0.05);
    color: var(--primary-color);
    font-weight: 500;
    border: none;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    line-height: 16px;
    display: flex;
    align-items: center;
}

.tools-dropdown-item.active > * {
    line-height: 16px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .tools-menu-trigger {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 120px;
    }
    
    .tools-dropdown {
        left: 0;
        right: 0;
        min-width: auto;
        max-width: 100%;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 12px;
    }
}

/* 工具页面 */
.tool-page {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 30px;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.6;
}

.tool-page h2 {
    font-size: 15px;
    font-weight: normal;
    color: var(--text-dark);
    margin-bottom: 15px;
    margin-top: 0;
}

.tool-page h3 {
    font-size: 14px;
    font-weight: normal;
    color: var(--text-dark);
    margin-bottom: 12px;
    margin-top: 0;
}

.tool-page p {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.6;
}

.tool-page ul {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-left: 20px;
}

.tool-page ul li {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.6;
}

.tool-page ul li strong {
    font-weight: normal;
    color: var(--text-dark);
}

/* 左右布局 */
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.tool-layout .input-section,
.tool-layout .output-section {
    display: flex;
    flex-direction: column;
}

.tool-layout .input-section h3,
.tool-layout .output-section h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-weight: 600;
}

.tool-layout textarea {
    flex: 1;
    min-height: 400px;
}

.tool-layout .button-group {
    margin-top: 0;
}

@media (max-width: 768px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }
    .tool-layout textarea {
        min-height: 200px;
    }
}

/* 工具操作按钮栏 */
.tool-actions-bar {
    background: transparent;
    border: none;
    margin-bottom: -15px;
}

.tool-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.tool-action-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-gray);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tool-action-btn:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.tool-action-btn.active {
    background: transparent;
    color: var(--primary-color);
}

.tool-action-btn i {
    font-size: 16px;
}

.tool-action-text {
    font-size: 12px;
}

@media (max-width: 768px) {
    .tool-action-text {
        display: none;
    }
    .tool-action-btn {
        padding: 8px 12px;
    }
}

.tool-description {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 25px;
    border-left: 3px solid var(--primary-color);
}

.tool-description h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
}

.tool-description p {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.6;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    min-height: 400px;
    resize: vertical;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

/* JSON 工具栏按钮禁用动画 */
.json-toolbar .btn {
    transition: none !important;
    transform: none !important;
    animation: none !important;
}

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

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

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 结果区域 */
.result-area {
    margin-top: 25px;
}

.result-area h3 {
    margin-bottom: 12px;
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 600;
}

.result-box {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    min-height: 100px;
    white-space: pre-wrap;
    font-family: 'Courier New', Consolas, monospace;
    word-break: break-all;
    font-size: 13px;
}

.result-image {
    max-width: 100%;
    border-radius: 4px;
    margin-top: 15px;
    border: 1px solid var(--border-color);
}

/* 提示信息 */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 14px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 悬浮提示 */
.alert-toast {
    position: fixed !important;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 100000;
    min-width: 300px;
    max-width: 500px;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.alert-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* 统计信息 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-item .label {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 5px;
}

/* 文件上传 */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background-color: var(--bg-light);
}

.file-upload:hover {
    border-color: var(--primary-color);
    background-color: #f0f2ff;
}

.file-upload input[type="file"] {
    display: none;
}

/* 页脚 */
.main-wrapper {
    flex: 1;
}

.footer {
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    color: var(--text-gray);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer h4 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: 600;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 8px;
}

.footer a {
    color: var(--text-gray);
    font-size: 14px;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
    }
    
    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin-top: 10px;
    }
    
    .page-header h1 {
        font-size: 16px;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
    }
    
    .tool-page {
        padding: 20px 15px;
    }
    
    .category-tabs {
        gap: 8px;
    }
    
    .category-tab {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 辅助类 */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 15px; }
.mt-3 { margin-top: 25px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 15px; }
.mb-3 { margin-bottom: 25px; }
.mb-4 { margin-bottom: 40px; }

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}
