/* 通用工具页样式 */
.tool-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    min-height: calc(100vh - 80px);
}

.tool-hero {
    text-align: center;
    margin-bottom: 24px;
    padding: 26px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef6ff 0%, #f8fbff 100%);
    border: 1px solid #d8e9ff;
}

.tool-hero h1 {
    margin: 0 0 12px;
    color: #1f3a5f;
    font-size: 32px;
}

.tool-hero p {
    max-width: 780px;
    margin: 0 auto;
    color: #566573;
    line-height: 1.8;
}

.tool-card {
    background: #fff;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 6px 18px rgba(31, 58, 95, 0.07);
}

.tool-card h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.tool-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin: 12px 0;
}

.tool-form-group {
    flex: 1 1 220px;
    margin: 12px 0;
}

.tool-form-group label,
.tool-form-row label {
    display: block;
    margin-bottom: 8px;
    color: #34495e;
    font-weight: 600;
}

.tool-form-group input,
.tool-form-group select,
.tool-form-group textarea,
.tool-form-row input,
.tool-form-row select,
.tool-form-row textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ccd6e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-form-group textarea {
    min-height: 150px;
    resize: vertical;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

.tool-form-group input:focus,
.tool-form-group select:focus,
.tool-form-group textarea:focus,
.tool-form-row input:focus,
.tool-form-row select:focus,
.tool-form-row textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 8px 8px 0;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #3498db;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

/* 使用 gap 的容器内不叠加外边距，避免间距不一致 */
.copy-row .tool-button,
.tool-button-row .tool-button,
.tp-ops .tool-button,
.tp-mid .tool-button {
    margin: 0;
}

.tool-button:hover {
    background: #217dbb;
    transform: translateY(-1px);
}

.tool-button.secondary {
    background: #5d6d7e;
}

.tool-button.secondary:hover {
    background: #465462;
}

.tool-button.success {
    background: #27ae60;
}

.tool-button.success:hover {
    background: #1e874b;
}

.tool-button.warning {
    background: #f39c12;
}

.tool-result {
    min-height: 42px;
    padding: 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e5eaf0;
    color: #2c3e50;
    line-height: 1.7;
    word-break: break-all;
    white-space: pre-wrap;
}

.tool-result code,
.code-output {
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

.tool-tip {
    margin-top: 10px;
    color: #6b7c8f;
    font-size: 13px;
    line-height: 1.7;
}

.tool-error {
    color: #c0392b;
    background: #fff3f1;
    border: 1px solid #ffd4cd;
}

.tool-success {
    color: #1e8449;
    background: #f0fff7;
    border: 1px solid #c8f2d7;
}

.checkbox-list {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.checkbox-list label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #34495e;
}

.checkbox-list input {
    width: auto;
}

.copy-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.pill-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef6ff;
    color: #2874a6;
    cursor: pointer;
    border: 1px solid #d4e9ff;
    font-size: 13px;
}

mark.regex-match {
    background: #fff2a8;
    color: #2c3e50;
    padding: 1px 2px;
    border-radius: 3px;
}

.preview-image {
    max-width: 100%;
    max-height: 320px;
    border: 1px solid #e5eaf0;
    border-radius: 10px;
    background: #f8fafc;
}

@media (max-width: 768px) {
    .tool-page {
        padding: 16px;
    }

    .tool-hero h1 {
        font-size: 26px;
    }

    .tool-button {
        width: 100%;
    }
}


.tool-swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.tool-swatch {
    min-height: 70px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.tool-swatch small {
    margin-top: 4px;
    font-weight: normal;
}

.tool-card table {
    width: 100%;
    border-collapse: collapse;
}

.tool-card th,
.tool-card td {
    border: 1px solid #e5eaf0;
    padding: 8px;
}

.tool-card blockquote {
    margin: 10px 0;
    padding: 8px 12px;
    border-left: 4px solid #3498db;
    background: #f8fbff;
}

.tool-card pre {
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    background: #f4f6f8;
}

/* 所有工具卡片内的文本域统一基础样式与高度，避免裸 textarea 过小 */
.tool-card textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ccd6e0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-card textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

.tool-textarea,
.tool-form-group textarea,
.tool-card textarea {
    min-height: 220px;
}

/* 只读的“输出/结果”文本域可以矮一些 */
.tool-card textarea[readonly] {
    min-height: 120px;
    background: #f8fafc;
}


.diff-added,
.diff-removed,
.diff-changed {
    padding: 10px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid #e5eaf0;
}

.diff-added { background: #f0fff7; border-color: #c8f2d7; color: #1e8449; }
.diff-removed { background: #fff3f1; border-color: #ffd4cd; color: #c0392b; }
.diff-changed { background: #fffbea; border-color: #ffe6a6; color: #9a6b00; }

.css-preview-box {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    border: 1px solid #e5eaf0;
    border-radius: 16px;
}
