/* xt-tools — 在线工具插件样式表 */

.xt-tools-wrap {
    margin-top: 6px;
    margin-bottom: 30px;
    padding: 18px;
    border: 1px solid #e9edf3;
    border-radius: 12px;
}

.xt-page-header {
    margin: 2px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9edf3;
}

.xt-page-header h2 {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 24px;
    font-weight: 700;
}

.xt-page-header small {
    font-size: 13px;
    color: #8a94a6;
}

/* 导航 tabs */
.xt-nav {
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.xt-nav > li {
    float: none;
}

.xt-nav > li > a {
    border: 1px solid #d8e3f0;
    border-radius: 999px;
    background: #fff;
    color: #4e5f78;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    transition: all 0.18s ease;
}

.xt-nav > li > a:hover,
.xt-nav > li > a:focus {
    background: #eef4fb;
    color: #1f6fb2;
    border-color: #b8cfe7;
}

.xt-nav > li.active > a,
.xt-nav > li.active > a:hover,
.xt-nav > li.active > a:focus {
    color: #fff;
    border-color: #1f6fb2;
    background: linear-gradient(135deg, #2a84ce, #1f6fb2);
    box-shadow: 0 4px 10px rgba(31, 111, 178, 0.25);
}

.xt-nav .fa {
    margin-right: 5px;
}

/* 内容区 */
.xt-tab-content {
    min-height: 220px;
}

.xt-row {
    margin-top: 0;
}

.xt-col {
    margin-bottom: 18px;
}

.xt-card {
    height: 100%;
    border: 1px solid #e8edf4;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(40, 64, 96, 0.06);
    overflow: hidden;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.xt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 64, 96, 0.12);
}

.xt-card .panel-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-bottom: 1px solid #edf1f6;
    background: #f8fafd;
}

.xt-card .panel-body {
    padding: 14px;
}

.xt-card-icon {
    color: #2a84ce;
    font-size: 15px;
}

.xt-badge-local {
    margin-left: auto;
    padding: 2px 9px;
    border-radius: 999px;
    background: #e8f7ea;
    color: #2f7f41;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
}

.xt-textarea,
.xt-mono {
    font-family: Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

.xt-textarea {
    resize: vertical;
    min-height: 74px;
    line-height: 1.5;
}

.xt-output {
    border-color: #dce6f2 !important;
    color: #2f3a4a;
    background-color: #f8fafd !important;
}

.xt-actions {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.xt-actions .btn {
    border-radius: 8px;
}

/* 密码/日期间隔：选项行（checkbox + number input） */
.xt-inline-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

/* 密码/日期 number input 宽度不要撑满 */
.xt-inline-fields input[type="number"],
.xt-inline-fields input[type="date"] {
    width: 110px;
    display: inline-block;
}

/* 文本行处理：前后缀专用行，强制单行横排 */
.xt-prefix-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    flex-wrap: nowrap;
}

.xt-short-input {
    flex: 1 1 0;
    min-width: 60px;
    max-width: 180px;
    height: 30px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #d1dae6;
    border-radius: 6px;
    background: #fff;
    color: #2f3a4a;
    outline: none;
    transition: border-color 0.15s;
}

.xt-short-input:focus {
    border-color: #2a84ce;
    box-shadow: 0 0 0 2px rgba(42, 132, 206, 0.15);
}

.xt-mini-label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #65758d;
}

.xt-check-inline {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #4f5f76;
    font-weight: 500;
}

/* 文本行处理：左右两列（输入 | 结果） */
.xt-lines-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.xt-lines-input-col,
.xt-lines-output-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 文本 Diff：三列等宽（A | B | 结果） */
.xt-diff-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: start;
}

/* 保留旧类，避免其他地方引用出错 */
.xt-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.xt-copy-btn {
    margin-left: auto;
    font-size: 12px;
    color: #7a8597;
}

.xt-copy-btn:hover,
.xt-copy-btn:focus {
    color: #1f6fb2;
    text-decoration: none;
}

.xt-hint {
    margin: 2px 0 6px;
    font-size: 12px;
    color: #8d96a6;
}

.xt-label {
    margin-bottom: 4px;
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4d5b71;
}

.xt-status {
    min-height: 18px;
    margin: 6px 0 4px;
    font-size: 13px;
}

.xt-status.success {
    color: #2f7f41;
}

.xt-status.error {
    color: #bc3a3a;
}

.xt-result-label {
    margin-bottom: 4px;
    font-size: 12px;
    color: #7d899c;
}

.xt-qr-box {
    margin-top: 12px;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.xt-qr-box canvas,
.xt-qr-box img {
    max-width: 200px;
    height: auto;
    border: 1px solid #e6edf6;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

@media (max-width: 768px) {
    .xt-tools-wrap {
        padding: 12px;
        border-radius: 10px;
    }

    .xt-page-header h2 {
        font-size: 19px;
    }

    .xt-nav {
        gap: 6px;
    }

    .xt-nav > li > a {
        padding: 6px 12px;
        font-size: 12px;
    }

    .xt-lines-grid,
    .xt-diff-3col,
    .xt-diff-grid {
        grid-template-columns: 1fr;
    }

    .xt-copy-btn {
        margin-left: 0;
    }
}

.theme-dark .xt-tools-wrap {
    border-color: #2c3a4c;
}

.theme-dark .xt-page-header {
    border-bottom-color: #2b3a4c;
}

.theme-dark .xt-page-header h2 {
    color: #e6edf7;
}

.theme-dark .xt-page-header small,
.theme-dark .xt-hint,
.theme-dark .xt-result-label {
    color: #9babc0;
}

.theme-dark .xt-nav > li > a {
    background: #1f2b38;
    border-color: #304358;
    color: #c2d2e6;
}

.theme-dark .xt-nav > li > a:hover,
.theme-dark .xt-nav > li > a:focus {
    background: #26384b;
    border-color: #3c5672;
    color: #d8e7f8;
}

.theme-dark .xt-card {
    border-color: #2e3f53;
    background: #1b2632;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.theme-dark .xt-card .panel-heading {
    background: #202e3c;
    border-bottom-color: #2b3b4e;
    color: #dce7f5;
}

.theme-dark .xt-badge-local {
    background: #1f4f2f;
    color: #bef5cf;
}

.theme-dark .xt-label {
    color: #c4d3e6;
}

.theme-dark .xt-mini-label,
.theme-dark .xt-check-inline {
    color: #b8c9dc;
}

.theme-dark .xt-short-input {
    background: #1f2e3d;
    border-color: #2e4158;
    color: #d7e5f7;
}

.theme-dark .xt-short-input:focus {
    border-color: #3b7fc4;
}

.theme-dark .xt-output {
    border-color: #38506a !important;
    color: #d7e5f7;
    background-color: #223041 !important;
}

.theme-dark .xt-qr-box canvas,
.theme-dark .xt-qr-box img {
    border-color: #33465d;
    background: #fff;
}

/* ================================================================
 * 内容工具：Markdown 预览 / 字数统计 / Slug 生成
 * ================================================================ */

/* Markdown 预览布局（编辑器 | 预览，各占 50%） */
.xt-md-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.xt-md-editor-col,
.xt-md-preview-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Markdown 预览区容器 */
.xt-md-preview {
    min-height: 320px;
    max-height: 500px;
    overflow-y: auto;
    padding: 14px 18px;
    border: 1px solid #dce6f2;
    border-radius: 8px;
    background: #fafcff;
    font-size: 14px;
    line-height: 1.8;
    color: #2f3a4a;
    word-break: break-word;
}

.xt-md-empty {
    color: #9babc0;
    font-style: italic;
    font-size: 13px;
}

/* Markdown 渲染内容排版（全部限定在 .xt-md-preview 内，不影响外部） */
.xt-md-preview h1,
.xt-md-preview h2,
.xt-md-preview h3,
.xt-md-preview h4,
.xt-md-preview h5,
.xt-md-preview h6 {
    margin: 0.9em 0 0.4em;
    font-weight: 700;
    line-height: 1.3;
    color: #1a2637;
}

.xt-md-preview h1 { font-size: 1.65em; border-bottom: 2px solid #e4edf8; padding-bottom: 0.2em; }
.xt-md-preview h2 { font-size: 1.35em; border-bottom: 1px solid #e4edf8; padding-bottom: 0.15em; }
.xt-md-preview h3 { font-size: 1.15em; }
.xt-md-preview h4 { font-size: 1.05em; }

.xt-md-preview p {
    margin: 0.5em 0 0.75em;
}

.xt-md-preview ul,
.xt-md-preview ol {
    margin: 0.5em 0 0.75em;
    padding-left: 1.6em;
}

.xt-md-preview li {
    margin: 0.25em 0;
}

.xt-md-preview code {
    font-family: Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    background: #eef3fb;
    color: #c0392b;
}

.xt-md-preview pre {
    margin: 0.75em 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: #1e2b38;
    overflow-x: auto;
}

.xt-md-preview pre code {
    background: none;
    color: #c9dff5;
    padding: 0;
    font-size: 0.85em;
}

.xt-md-preview blockquote {
    margin: 0.75em 0;
    padding: 0.4em 1em;
    border-left: 4px solid #2a84ce;
    background: #f2f7fd;
    color: #4d6380;
    border-radius: 0 6px 6px 0;
}

.xt-md-preview blockquote p { margin: 0; }

.xt-md-preview a {
    color: #1f6fb2;
    text-decoration: underline;
}

.xt-md-preview img {
    max-width: 100%;
    border-radius: 6px;
}

.xt-md-preview hr {
    border: none;
    border-top: 1px solid #e4edf8;
    margin: 1em 0;
}

.xt-md-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 13px;
}

.xt-md-preview th,
.xt-md-preview td {
    padding: 6px 12px;
    border: 1px solid #d3e3f5;
    text-align: left;
}

.xt-md-preview th {
    background: #eef4fd;
    font-weight: 600;
}

/* 字数统计卡片网格 */
.xt-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.xt-stat-item {
    text-align: center;
    padding: 10px 8px;
    border-radius: 8px;
    background: #f4f8fd;
    border: 1px solid #dce6f2;
    transition: transform 0.15s;
}

.xt-stat-item:hover {
    transform: translateY(-2px);
}

.xt-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #1f6fb2;
    font-family: Consolas, "Liberation Mono", Menlo, monospace;
    line-height: 1.2;
    white-space: nowrap;
}

.xt-stat-label {
    font-size: 11px;
    color: #7a8fa8;
    margin-top: 4px;
}

/* 工具提示（slug 下方小灰字） */
.xt-hint {
    font-size: 12px;
    color: #8fa3be;
    margin: 4px 0 0;
    line-height: 1.5;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .xt-md-grid {
        grid-template-columns: 1fr;
    }

    .xt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 深色模式 */
.theme-dark .xt-md-preview {
    background: #1a2535;
    border-color: #2a3d54;
    color: #cfe2f8;
}

.theme-dark .xt-md-preview h1,
.theme-dark .xt-md-preview h2,
.theme-dark .xt-md-preview h3,
.theme-dark .xt-md-preview h4 {
    color: #e0efff;
    border-bottom-color: #2a3d54;
}

.theme-dark .xt-md-preview code {
    background: #223141;
    color: #f5a0a0;
}

.theme-dark .xt-md-preview pre {
    background: #111c28;
}

.theme-dark .xt-md-preview blockquote {
    background: #1d3048;
    color: #9ab8d8;
    border-left-color: #3a7fc4;
}

.theme-dark .xt-md-preview th {
    background: #1d3248;
}

.theme-dark .xt-md-preview th,
.theme-dark .xt-md-preview td {
    border-color: #2b4262;
}

.theme-dark .xt-md-preview a {
    color: #6aaee0;
}

.theme-dark .xt-stat-item {
    background: #1b2a3a;
    border-color: #2a3d54;
}

.theme-dark .xt-stat-value {
    color: #6aaee0;
}

.theme-dark .xt-stat-label {
    color: #7a96b4;
}

.theme-dark .xt-hint {
    color: #6a84a0;
}

/* ================================================================
 * 全屏模式
 * ================================================================ */

/* 全屏切换按钮（绝对定位到 panel-heading 右侧） */
.xt-card .panel-heading {
    position: relative;
    padding-right: 36px; /* 为按钮留出空间 */
}

.xt-fullscreen-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #7a96b8;
    font-size: 14px;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    z-index: 2;
}

.xt-fullscreen-btn:hover {
    color: #1f6fb2;
    background: rgba(31, 111, 178, 0.1);
}

/* 阻止页面滚动（全屏期间） */
body.xt-has-fullscreen {
    overflow: hidden !important;
}

/* 全屏卡片本体 */
.xt-card.xt-is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.xt-card.xt-is-fullscreen > .panel-heading {
    flex-shrink: 0;
    border-radius: 0 !important;
    position: sticky;
    top: 0;
    z-index: 1;
}

.xt-card.xt-is-fullscreen > .panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 全屏时，普通 textarea 扩展高度 */
.xt-card.xt-is-fullscreen .xt-textarea {
    min-height: calc(45vh - 80px) !important;
}

/* Markdown：编辑器 + 预览各自充满剩余高度 */
.xt-card.xt-is-fullscreen .xt-md-grid {
    flex: 1;
    min-height: calc(100vh - 160px);
    align-items: stretch;
}

.xt-card.xt-is-fullscreen .xt-md-editor-col,
.xt-card.xt-is-fullscreen .xt-md-preview-col {
    display: flex;
    flex-direction: column;
}

.xt-card.xt-is-fullscreen #xt-md-input {
    flex: 1;
    min-height: calc(100vh - 220px) !important;
    resize: none;
}

.xt-card.xt-is-fullscreen .xt-md-preview {
    flex: 1;
    min-height: calc(100vh - 220px);
    max-height: none !important;
}

/* 文本行处理 / Diff：三列或两列时 textarea 高度扩展 */
.xt-card.xt-is-fullscreen .xt-diff-3col .xt-textarea,
.xt-card.xt-is-fullscreen .xt-lines-grid .xt-textarea {
    min-height: calc(60vh - 120px) !important;
}

/* 深色模式下全屏按钮 */
.theme-dark .xt-fullscreen-btn {
    color: #6a8aaa;
}

.theme-dark .xt-fullscreen-btn:hover {
    color: #6aaee0;
    background: rgba(106, 174, 224, 0.12);
}

/* 深色模式下全屏卡片 heading 吸顶背景 */
.theme-dark .xt-card.xt-is-fullscreen > .panel-heading {
    background: #202e3c;
}
