/* ===================================
   物联网技术分享博客 - 自定义样式
   =================================== */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --dark-color: #1e40af;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --bg-light: #f8fafc;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 0;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}

/* 分类按钮样式 */
.category-btn {
    background-color: #f3f4f6;
    color: #6b7280;
}

.category-btn:hover {
    background-color: #e5e7eb;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 文章卡片样式 */
.article-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.article-card img {
    transition: transform 0.3s ease;
}

.article-card:hover img {
    transform: scale(1.05);
}

/* 文章内容样式 */
#articleContent {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-dark);
}

#articleContent h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-dark);
}

#articleContent h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

#articleContent p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

#articleContent ul,
#articleContent ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

#articleContent li {
    margin-bottom: 0.5rem;
}

#articleContent strong {
    color: var(--primary-color);
    font-weight: 600;
}

#articleContent a {
    color: var(--primary-color);
    text-decoration: underline;
}

#articleContent a:hover {
    color: var(--dark-color);
}

/* 代码块样式 */
#articleContent pre {
    background-color: #282c34;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

#articleContent code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
}

#articleContent pre code {
    color: #abb2bf;
    background: none;
    padding: 0;
}

#articleContent p code,
#articleContent li code {
    background-color: #f3f4f6;
    color: #e83e8c;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

#articleContent table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow-x: auto;
    display: block;
}

#articleContent table th,
#articleContent table td {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    text-align: left;
}

#articleContent table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

#articleContent table tr:nth-child(even) {
    background-color: #f9fafb;
}

#articleContent blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-gray);
    background-color: #f9fafb;
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    color: var(--text-gray);
    border-radius: 9999px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag:hover {
    background-color: var(--primary-color);
    color: white;
}

/* 目录样式 */
#tableOfContents a {
    display: block;
    padding: 0.5rem 0;
    color: var(--text-gray);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 1rem;
    transition: all 0.2s ease;
}

#tableOfContents a:hover {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: 1.25rem;
}

#tableOfContents a.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* 分页样式 */
.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background-color: white;
    color: var(--text-gray);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #articleContent {
        font-size: 1rem;
    }

    #articleContent h2 {
        font-size: 1.5rem;
    }

    #articleContent h3 {
        font-size: 1.25rem;
    }

    #articleContent pre {
        padding: 1rem;
        font-size: 0.875rem;
    }
}

/* 搜索结果高亮 */
.highlight {
    background-color: #fef3c7;
    padding: 0.1em 0.2em;
    border-radius: 3px;
}

/* 平滑过渡 */
.transition-all {
    transition: all 0.3s ease;
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-color) 100%);
}

/* 卡片阴影效果 */
.card-shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card-shadow-hover:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 徽章样式 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background-color: var(--primary-color);
    color: white;
}

.badge-secondary {
    background-color: #10b981;
    color: white;
}

.badge-warning {
    background-color: #f59e0b;
    color: white;
}

/* 提示框样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 图片样式 */
img {
    max-width: 100%;
    height: auto;
}

.img-cover {
    object-fit: cover;
}

/* 骨架屏加载效果 */
.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
    0% {
        background-color: hsl(200, 20%, 80%);
    }
    100% {
        background-color: hsl(200, 20%, 95%);
    }
}

/* 打印样式 */
@media print {
    nav,
    footer,
    aside,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    #articleContent {
        max-width: 100%;
    }
}

/* 可访问性增强 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 焦点样式 */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 禁用状态 */
.disabled,
[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 成功、警告、错误消息 */
.message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.message-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.message-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-gray);
}

.empty-state i {
    font-size: 4rem;
    color: #e5e7eb;
    margin-bottom: 1rem;
}

/* 移动端优化 */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 动画效果 */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.8s ease-out;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slide-up 0.6s ease-out;
}

/* 卡片悬停增强 */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

/* 渐变文本 */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

