/**
 * 工具页面统一样式
 * 所有工具 HTML 都应引入此文件
 */

/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: transparent;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    color: #333;
    line-height: 1.6;
}

/* 工具容器 */
.tool-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* 区块样式 */
.section-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-card h3 {
    font-size: 15px;
    color: #333;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 表单元素 */
.form-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #5B5FC7;
    box-shadow: 0 0 0 3px rgba(91, 95, 199, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e8ecff;
    color: #4338ca;
}

.btn-secondary:hover {
    background: #c7d2fe;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 结果区域 */
.result-area {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.result-area h4 {
    font-size: 14px;
    color: #333;
    margin: 0 0 15px 0;
}

/* 说明区域 */
.tool-desc {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.tool-desc h4 {
    color: #4338ca;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.tool-desc p {
    color: #6366f1;
    font-size: 14px;
    line-height: 1.7;
    margin: 0 0 10px 0;
}

.tool-desc p:last-child {
    margin-bottom: 0;
}

/* 代码块 */
.code-block {
    background: rgba(0,0,0,0.05);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

/* 渐变头部卡片 */
.header-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 25px;
    color: #fff;
    text-align: center;
    margin-bottom: 25px;
}

.header-card h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.header-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

/* 箭头分隔 */
.arrow {
    color: #999;
    font-size: 20px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 500;
}

/* Toast 提示 - 右上角 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    min-width: 260px;
    max-width: 380px;
    animation: toastIn 0.3s ease;
    border-left: 4px solid #5B5FC7;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast span {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* Toast 类型 */
.toast.success {
    border-left-color: #10b981;
}
.toast.success i {
    color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}
.toast.error i {
    color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}
.toast.warning i {
    color: #f59e0b;
}

.toast.info {
    border-left-color: #3b82f6;
}
.toast.info i {
    color: #3b82f6;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========== 暗色主题 ========== */
html.dark-theme body {
    color: #e0e0e0;
    background: transparent;
}

html.dark-theme .section-card {
    background: #252525;
}

html.dark-theme .section-card h3 {
    color: #e0e0e0;
}

html.dark-theme .form-group label {
    color: #aaa;
}

html.dark-theme .form-control {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

html.dark-theme .btn-secondary {
    background: #312e81;
    color: #a5b4fc;
}

html.dark-theme .result-area {
    background: #252525;
    border-color: #444;
}

html.dark-theme .result-area h4 {
    color: #e0e0e0;
}

html.dark-theme .tool-desc {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

html.dark-theme .tool-desc h4 {
    color: #a5b4fc;
}

html.dark-theme .tool-desc p {
    color: #c7d2fe;
}

html.dark-theme .code-block {
    background: rgba(255,255,255,0.1);
}

html.dark-theme .data-table th,
html.dark-theme .data-table td {
    border-color: #444;
}

html.dark-theme .data-table th {
    background: #1e1e1e;
    color: #e0e0e0;
}

html.dark-theme .data-table td {
    color: #aaa;
}

html.dark-theme .toast {
    background: #252525;
}

html.dark-theme .toast span {
    color: #e0e0e0;
}
