/* 科研工具集 - 样式表 */

/* 基础设置 */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* 顶部广告 */
.top-ad {
    background: #f1f5f9;
    text-align: center;
    padding: 10px;
    min-height: 90px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* 导航 */
.tool-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.tool-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 15px 0;
    list-style: none;
    justify-content: center;
}

.tool-nav a {
    text-decoration: none;
    color: var(--text-light);
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.tool-nav a:hover,
.tool-nav a.active {
    background: var(--primary);
    color: white;
}

/* 主内容区 */
main {
    padding: 30px 0;
    min-height: 500px;
}

/* 工具区块 */
.tool-section {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
}

.tool-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

/* 选项 */
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: var(--radius);
}

.options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.95rem;
}

.options select,
.options input[type="number"] {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* 输入输出区域 */
.io-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.io-area.full {
    grid-template-columns: 1fr;
}

.input-box,
.output-box {
    display: flex;
    flex-direction: column;
}

.input-box label,
.output-box label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.95rem;
    resize: vertical;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea[readonly] {
    background: #f8fafc;
}

/* 按钮组 */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: var(--primary);
}

/* 单位换算特殊样式 */
.unit-converter {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius);
}

.unit-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.unit-col {
    flex: 1;
    min-width: 200px;
}

.unit-col label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.unit-col select,
.unit-col input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.arrow {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: bold;
}

/* 随机数选项 */
.random-options {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.random-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.random-row label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.random-row input[type="number"],
.random-row select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* 字符计数结果 */
.count-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.count-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.count-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.count-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
}

.auto-count {
    font-weight: normal;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* JSON状态 */
.json-status {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.json-status.success {
    background: #d1fae5;
    color: #065f46;
}

.json-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* 行号处理 */
.line-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: var(--radius);
}

.line-options label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.line-options input,
.line-options select {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* 侧边广告 */
.sidebar-ad {
    position: fixed;
    right: 20px;
    top: 200px;
}

/* Footer */
footer {
    background: #1e293b;
    color: white;
    padding: 40px 0 20px;
    text-align: center;
    margin-top: 50px;
}

footer p {
    margin-bottom: 10px;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    margin: 0 10px;
}

.footer-links a:hover {
    color: white;
}

.bottom-ad {
    margin-top: 30px;
}

/* 响应式 */
@media (max-width: 768px) {
    .io-area {
        grid-template-columns: 1fr;
    }
    
    .tool-nav ul {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .tool-nav a {
        white-space: nowrap;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .count-results {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar-ad {
        display: none;
    }
}

/* 工具卡片网格（未来扩展用） */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tool-card h3 {
    margin-bottom: 10px;
    color: var(--primary);
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}
