/* 全局样式 */
a {
  text-decoration: none;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    line-height: 2;
}

/* 文章头部样式 */
.article-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
}

.article-header h1 {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem !important;
}

.article-header .badge {
    background: rgba(255,255,255,0.25);
    color: #ffffff;
    font-weight: 500;
    padding: 0.4em 0.8em;
    border: 1px solid rgba(255,255,255,0.4);
}

.article-header .text-muted {
    color: rgba(255,255,255,0.85) !important;
}

.article-header small {
    color: rgba(255,255,255,0.9);
}

.article-header i {
    color: rgba(255,255,255,0.9);
}

/* 主内容区域 */
.main-content {
    margin-top: 76px; /* 移除间隙，让内容紧贴导航栏 */
}

/* 英雄区域 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), #0a58ca);
    min-height: 500px;
    display: flex;
    align-items: center;
}

/* 卡片悬停效果 */
.hover-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

/* 功能图标 */
.feature-icon {
    font-size: 2.5rem;
    color: #0a58ca;
    margin-bottom: 20px;
}

.hover-card:hover .feature-icon {
    transform: scale(1.1);
}

/* 导航栏样式 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    color: white;
    padding: 15px 0; /* 减少padding */
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
    /*font-size: var(--bs-navbar-brand-font-size);*/
}

.navbar-nav .nav-link:hover {
    color: #6ea8fe !important;
}

/*
.navbar {
    /*font-size: var(--bs-navbar-brand-font-size);*/
    --bs-navbar-brand-font-size: 1.8rem;
}
*/

/* 按钮样式 */
.btn {
    display: inline-block;
    background: #0a58ca;
    color: white;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:hover {
    background-color: #089140;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: 10px;
    overflow: hidden;
}

.card-img-top {
    border-radius: 10px 10px 0 0;
}

/* 页脚样式 */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 50px 0 20px;
}

.social-links a {
    color: white;
    font-size: 1.2rem;
}

.social-links a:hover {
    color: #9ca3f0;
    transform: scale(1.1);
}

.social-links a:hover {
    color: #6ea8fe !important;
    transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
        text-align: center;
    }
    
    .hero-section .display-4 {
        font-size: 2.5rem;
    }
    
    .main-content {
        margin-top: 60px;
    }
}

/* 工具页面样式 */
.calculator-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-top: 2rem;
}

.tab-container {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 2rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tab-button.active,
.tab-button:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.calculation-result {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
    border-left: 4px solid var(--primary-color);
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* 表单样式 */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 徽章样式 */
.badge {
    font-size: 0.75rem;
    padding: 0.5em 0.75em;
}

/* 分页样式 */
.pagination .page-link {
    color: #0a58ca;
    border-color: #dee2e6;
}

.pagination .page-link:hover {
    color: #0a58ca;
    background: #e9ecef;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 警告框样式 */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 表格样式 */
.table {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

/* 搜索框样式 */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

/* 文章列表样式 */
.article-meta {
    font-size: 0.875rem;
    color: #6c757d;
}

.article-category {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* 下载统计样式 */
.download-stats {
    font-size: 0.875rem;
    color: #6c757d;
}

/* 联系表单样式 */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

/* 成功消息样式 */
.success-message {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 1px solid #b8daff;
    color: #155724;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* 错误消息样式 */
.error-message {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* 工具特定样式 */
.rtd-calculator,
.thermocouple-calculator,
.temperature-converter {
    display: none;
}

.rtd-calculator.active,
.thermocouple-calculator.active,
.temperature-converter.active {
    display: block;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .table-responsive-stack {
        display: block;
    }
    
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody,
    .table-responsive-stack tr,
    .table-responsive-stack td {
        display: block;
        width: 100%;
    }
    
    .table-responsive-stack tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }
    
    .table-responsive-stack td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    
    .table-responsive-stack td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.5rem;
        width: calc(50% - 1rem);
        font-weight: bold;
        text-align: left;
    }
}

/* Markdown 样式 */
.article-body {
    line-height: 1.8;
    font-size: 1.05rem;
    color: #2c3e50;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    margin-top: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #1a252f;
    padding: 0.5rem 0;
}

/* 标题带左侧装饰线 */
.article-body h1 { 
    font-size: 1.85rem; 
    border-left: 5px solid #3498db;
    padding-left: 1rem;
    background: linear-gradient(90deg, #e8f4fc 0%, transparent 100%);
    padding: 0.6rem 1rem;
    border-radius: 0 8px 8px 0;
}

.article-body h2 { 
    font-size: 1.55rem; 
    border-left: 4px solid #2ecc71;
    padding-left: 0.85rem;
    background: linear-gradient(90deg, #e8f8f0 0%, transparent 100%);
    padding: 0.5rem 0.85rem;
    border-radius: 0 6px 6px 0;
}

.article-body h3 { 
    font-size: 1.3rem; 
    border-left: 3px solid #9b59b6;
    padding-left: 0.75rem;
    background: linear-gradient(90deg, #f5eef8 0%, transparent 100%);
    padding: 0.45rem 0.75rem;
    border-radius: 0 5px 5px 0;
}

.article-body h4 { 
    font-size: 1.15rem; 
    border-left: 3px solid #e67e22;
    padding-left: 0.7rem;
    background: linear-gradient(90deg, #fef5e7 0%, transparent 100%);
    padding: 0.4rem 0.7rem;
    border-radius: 0 4px 4px 0;
}

.article-body h5,
.article-body h6 { 
    font-size: 1.05rem; 
    border-left: 3px solid #95a5a6;
    padding-left: 0.65rem;
}

.article-body p {
    margin-bottom: 1.1rem;
}

.article-body a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.article-body a:hover {
    border-bottom-color: #3498db;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1rem;
    padding-left: 1.75rem;
}

.article-body li {
    margin-bottom: 0.4rem;
}

.article-body li::marker {
    color: #3498db;
}

/* 代码块 */
.article-body pre {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2c3e50;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.article-body code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* 行内代码 */
.article-body p code,
.article-body li code {
    background: #f1f3f5;
    color: #d6336c;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-size: 0.88em;
}

.article-body pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* 引用块 */
.article-body blockquote {
    border-left: 4px solid #3498db;
    margin: 1rem 0;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f4fc 100%);
    border-radius: 0 8px 8px 0;
    color: #495057;
    font-style: normal;
    position: relative;
}

.article-body blockquote::before {
    content: '"';
    font-size: 3rem;
    color: #3498db;
    opacity: 0.2;
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    font-family: Georgia, serif;
}

/* 表格 */
.article-body table {
    width: 100%;
    margin-bottom: 1.25rem;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.article-body table th,
.article-body table td {
    border: none;
    border-bottom: 1px solid #e9ecef;
    padding: 0.85rem 1rem;
}

.article-body table th {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-weight: 600;
    text-align: left;
}

.article-body table th:first-child {
    border-radius: 8px 0 0 0;
}
.article-body table th:last-child {
    border-radius: 0 8px 0 0;
}

.article-body table tr:last-child td:first-child {
    border-radius: 0 0 0 8px;
}
.article-body table tr:last-child td:last-child {
    border-radius: 0 0 8px 0;
}

.article-body table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.article-body table tr:hover {
    background-color: #e8f4fc;
}

/* 图片 */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.25rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 分割线 */
.article-body hr {
    margin: 2rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
}

/* 任务列表 */
.article-body .task-list-item {
    list-style: none;
    margin-left: -1.5rem;
}

.article-body .task-list-item input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #3498db;
    width: 1rem;
    height: 1rem;
}

/* 标记文本 */
.article-body .mark {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

/* 删除线 */
.article-body .del {
    text-decoration: line-through;
    color: #6c757d;
}

/* 上下标 */
.article-body sup {
    color: #e83e8c;
    font-weight: 600;
    font-size: 0.8em;
}

.article-body sub {
    color: #0d6efd;
    font-weight: 600;
    font-size: 0.8em;
}

/* 折叠内容 */
.article-body details {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.article-body details summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c3e50;
    list-style: none;
}

.article-body details summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.article-body details[open] summary::before {
    transform: rotate(90deg);
}

.article-body details[open] summary {
    margin-bottom: 0.5rem;
}