/* 全局样式 */
:root {
    --primary-color: #e0e0e0;
    --secondary-color: #d5d5d5;
    --accent-color: #7ca5cc;
    --text-color: #555555;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --card-header-bg: #e8e8e8;
    --card-content-bg: #ffffff;
    --card-text-color: #555555;
    --button-primary: #7ca5cc;
    --button-secondary: #b0b0b0;
    --button-danger: #e09090;
    --button-info: #8cb5d9;
    --button-success: #90c7a8;
    --highlight-color: #e6c686;
    --header-height: 60px;
    --footer-height: 40px;
    --border-radius: 6px;
    --container-padding: 5px;
    --tool-group-gap: 8px;
    --shadow-color: rgba(0, 0, 0, 0.08);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 页眉 */
.app-header {
    background-color: var(--primary-color);
    color: var(--text-color);
    height: var(--header-height);
    padding: 0 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    padding: 15px 0;
    letter-spacing: 1px;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    user-select: none;
}

.nav-item:hover {
    background-color: var(--secondary-color);
    color: var(--accent-color);
}

.nav-item.active {
    border-bottom-color: var(--accent-color);
    font-weight: 500;
    color: var(--accent-color);
}

/* 主要内容区域 */
.app-content {
    flex: 1;
    padding: 10px;
    position: relative;
    height: calc(100vh - var(--header-height) - var(--footer-height));
    overflow: hidden;
    background-color: var(--bg-color);
}

/* 页面内容样式 */
.page-content {
    display: none; /* 默认隐藏所有页面 */
    height: 100%;
}

#bejson-page {
    display: block; /* 默认显示 bejson 页面 */
}

/* 页脚 - 浮动样式 */
.app-footer {
    position: relative;
    z-index: 50;
}

.app-footer .container-fluid > .row {
    background-color: var(--primary-color);
    color: var(--text-color);
    height: auto;
    min-height: var(--footer-height);
    text-align: center;
    padding: 25px 0;
    flex-shrink: 0;
    font-size: 0.85rem;
    opacity: 0.95;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.2);
    position: fixed;
    bottom: -100%;  /* 默认隐藏在底部外 */
    left: 0;
    right: 0;
    z-index: 990;
    transition: bottom 0.4s ease-in-out;
}

.app-footer.show .container-fluid > .row {
    bottom: 40px;  /* 显示时在footer-bottom上方 */
}

/* 页脚内容布局 */
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 15px;
}

/* 工具列表样式 */
.footer-tools {
    flex: 1;
    text-align: left;
    padding-right: 20px;
}

.footer-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    text-align: left;
}

.tools-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 20px;
}

.tools-list a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    transition: all 0.2s ease;
    border-radius: 4px;
    text-align: left;
}

.tools-list a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateX(3px);
    color: var(--accent-color);
}

.tools-list a i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* 二维码样式 */
.footer-qrcode {
    text-align: center;
    padding: 10px 15px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 20px;
}

.footer-qrcode p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
}

.footer-qrcode p i {
    color: #09BB07;
    margin-right: 5px;
}

.qrcode-image {
    width: 120px;
    height: 120px;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qrcode-image:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 页脚底部永久显示 */
.footer-bottom {
    background-color: var(--primary-color);
    color: var(--text-color);
    padding: 0 20px;
    font-size: 0.8rem;
    opacity: 0.95;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.2);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 980;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.copyright-text {
    flex: 1;
    text-align: center;
}

.copyright-text p {
    margin: 0;
}

/* 页脚切换按钮 */
.footer-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.footer-toggle:hover {
    transform: rotate(45deg);
}

.footer-toggle i {
    font-size: 1rem;
}

.footer-toggle.active i {
    transform: rotate(180deg);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .app-footer.show .container-fluid > .row {
        bottom: 40px;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: center;
    }
    
    .footer-tools {
        width: 100%;
        padding-right: 0;
        margin-bottom: 20px;
    }
    
    .footer-title {
        text-align: center;
    }
    
    .tools-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-qrcode {
        margin-left: 0;
    }
    
    .qrcode-image {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .tools-list {
        grid-template-columns: 1fr;
    }
}

/* 卡片样式 */
.card {
    box-shadow: 0 4px 12px var(--shadow-color);
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--card-bg);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    border: 1px solid #e5e5e5;
    position: relative;
    margin: 0;
}

.card:hover {
    box-shadow: 0 6px 16px var(--shadow-color);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--card-header-bg);
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header h2 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.card-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background-color: var(--card-content-bg);
    color: var(--card-text-color);
    position: relative;
}

/* 通用工具栏样式 */
.tools-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tool-group-gap);
    margin-left: 15px;
}

.tool-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding-right: 8px;
    margin-right: 0;
}

.tool-group:last-child {
    border-right: none;
    padding-right: 0;
}

/* 通用容器样式 */
.bejson-container, .bexml-container {
    padding: 0;
    height: calc(100% - 10px);
}

.bejson-container .row, .bexml-container .row {
    margin: 0;
    height: 100%;
}

.bejson-container .col-md-6, .bexml-container .col-md-6 {
    padding: var(--container-padding);
    height: 100%;
}

/* 输入和输出区域通用样式 */
#json-input, #json-output, #xml-input, #xml-output {
    width: 100%;
    height: 100% !important;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* 按钮样式 */
.btn {
    transition: all 0.2s ease;
    opacity: 0.9;
    border-radius: var(--border-radius);
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 1;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

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

.btn-primary:hover {
    background-color: #3b8bc9;
    border-color: #3b8bc9;
}

.btn-secondary {
    background-color: var(--button-secondary);
    border-color: var(--button-secondary);
}

.btn-secondary:hover {
    background-color: #7b8ca0;
    border-color: #7b8ca0;
}

.btn-danger {
    background-color: var(--button-danger);
    border-color: var(--button-danger);
}

.btn-info {
    background-color: var(--button-info);
    border-color: var(--button-info);
}

.btn-success {
    background-color: var(--button-success);
    border-color: var(--button-success);
}

/* 轮廓按钮样式 */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
    background-color: transparent;
}

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

.btn-outline-secondary {
    border-color: var(--button-secondary);
    color: var(--button-secondary);
}

.btn-outline-danger {
    border-color: var(--button-danger);
    color: var(--button-danger);
}

.btn-outline-success {
    border-color: var(--button-success);
    color: var(--button-success);
}

.btn-outline-warning {
    border-color: var(--highlight-color);
    color: var(--highlight-color);
}

.btn-outline-info {
    border-color: var(--button-info);
    color: var(--button-info);
}

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

.btn-outline-secondary:hover {
    background-color: var(--button-secondary);
    color: white;
}

.btn-outline-danger:hover {
    background-color: var(--button-danger);
    color: white;
}

.btn-outline-success:hover {
    background-color: var(--button-success);
    color: white;
}

.btn-outline-warning:hover {
    background-color: var(--highlight-color);
    color: white;
}

.btn-outline-info:hover {
    background-color: var(--button-info);
    color: white;
}

/* 验证结果提示条 */
.validation-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.validation-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.validation-toast.success {
    background-color: var(--button-success);
    color: white;
}

.validation-toast.error {
    background-color: var(--button-danger);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(75, 85, 99, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 85, 99, 0.6);
}

/* 响应式调整 */
@media (max-width: 992px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-header h2 {
        margin-bottom: 10px;
    }
    
    .tools-container {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }
}

@media (max-width: 768px) {
    .row {
        flex-direction: column;
    }
    
    .col-md-6 {
        width: 100%;
        height: 50% !important;
        margin-bottom: 10px;
    }
    
    .app-header {
        padding: 0 10px;
    }
    
    .nav-item {
        padding: 15px 10px;
    }
    
    .tool-group {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 5px;
        margin-bottom: 5px;
        width: 100%;
    }
    
    .tool-group:last-child {
        border-bottom: none;
    }
}

/* 文本对比工具样式更新 */
.textcompare-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: var(--container-padding);
}

.textcompare-container .row {
    flex: 1;
    min-height: 90%;
}

/* 顶部控制区域 */
.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin: 5px 0 10px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.main-actions {
    display: flex;
    gap: 10px;
}

.main-actions .btn {
    padding: 8px 16px;
    font-weight: bold;
}

.compare-options {
    display: flex;
    gap: 15px;
}

.compare-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 5px;
    color: var(--text-color);
}

.compare-option input {
    margin-right: 5px;
    cursor: pointer;
}

.diff-stats {
    color: var(--text-color);
    font-weight: 500;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Ace Editor 高亮样式 */
.ace_diff-added-line {
    background-color: rgba(0, 255, 0, 0.1);
    position: absolute;
    width: 100% !important;
    left: 0 !important;
    z-index: 1;
}

.ace_diff-removed-line {
    background-color: rgba(255, 0, 0, 0.1);
    position: absolute;
    width: 100% !important;
    left: 0 !important;
    z-index: 1;
}

.ace_diff-modified {
    position: absolute;
    border-radius: 0 !important;
    z-index: 2;
}

.ace_diff-added {
    background-color: rgba(0, 255, 0, 0.4);
}

.ace_diff-removed {
    background-color: rgba(255, 0, 0, 0.4);
}

/* 适配移动设备 */
@media (max-width: 768px) {
    .textcompare-container .row {
        max-height: 70%;
    }

    .top-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .main-actions {
        width: 100%;
        justify-content: center;
    }

    .compare-options {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .diff-stats {
        width: 100%;
        justify-content: center;
    }
}

/* 联系作者二维码 */
.contact-qrcode {
    margin-top: 5px;
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 10px);
    max-width: 250px;
    margin-left: auto;
    margin-right: auto;
}

.contact-qrcode p {
    margin-bottom: 15px;
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

.contact-qrcode p i {
    color: #09BB07;
    margin-right: 5px;
    font-size: 1.2rem;
}

.qrcode-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qrcode-image:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .app-footer {
        padding: 20px 15px;
        text-align: center;
    }
    
    .footer-links {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .footer-title {
        margin-top: 15px;
    }
    
    .contact-qrcode {
        margin: 15px auto;
        max-width: 200px;
    }
    
    .qrcode-image {
        max-width: 150px;
        max-height: 150px;
    }
} 