/* 主题变量定义 */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --card-border: #dee2e6;
    --hover-shadow: rgba(0, 0, 0, 0.1);
    --nav-pill-active: #0d6efd;
    --search-bg: #ffffff;
    --search-text: #212529;
    --hover-bg: rgba(0, 0, 0, 0.05);
}

/* 深色主题变量 */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --card-bg: #2d2d2d;
    --card-border: #404040;
    --hover-shadow: rgba(255, 255, 255, 0.1);
    --nav-pill-active: #375a7f;
    --search-bg: #2d2d2d;
    --search-text: #ffffff;
    --hover-bg: rgba(255, 255, 255, 0.1);
    --card-title-color: #e1e1e1;
    --card-text-color: #a0a0a0;
}

/* 基础样式应用 */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.site-title {
    margin-bottom: 2rem;
    font-weight: 300;
}

.search-container {
    margin-bottom: 2rem;
    max-width: 600px; /* Limit search bar width */
    margin-left: auto;
    margin-right: auto;
}

.category-nav {
    margin-bottom: 2rem;
    padding: 0.5rem 0;
}

/* Make the entire card clickable */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block; /* Ensure link takes up card space */
    height: 100%; /* Ensure link takes up card space */
}

.navigation-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    height: 100%; /* Needed for h-100 on parent col */
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.navigation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.navigation-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem; /* Adjust padding */
}

.navigation-card .icon-container {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--nav-pill-active);
    transition: color 0.3s ease;
}

/* 当卡片数据中指定了颜色时的样式 */
[data-theme="dark"] .navigation-card .icon-container[style*="color"] {
    opacity: 0.9;
    filter: brightness(1.2);
}

.navigation-card .card-title {
    margin-bottom: 0.5rem;
    font-size: 1rem; /* Slightly smaller title */
    font-weight: 500;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.navigation-card .card-text {
    font-size: 0.8rem; /* Slightly smaller description */
    color: var(--card-text-color);
    flex-grow: 1;
    margin-bottom: 0; /* Remove default bottom margin */
    transition: color 0.3s ease;
}

/* Ensure cards in the same row have the same height & handle filtering */
.row {
    display: flex;
    flex-wrap: wrap;
}

/* Add filterable-item class to the column */
.filterable-item {
    display: flex; /* Use flex to make h-100 work on card */
    flex-direction: column;
    margin-bottom: 1.5rem;
    /* transition for smooth showing/hiding - optional */
    /* transition: opacity 0.3s ease-out, transform 0.3s ease-out; */
}

/* Style for hidden items */
.filterable-item.d-none {
     /* Optionally add fade out effect */
    /* opacity: 0;
    transform: scale(0.95); */
    /* display: none !important; */ /* Bootstrap d-none handles this */
}

/* No results message */
#noResultsMessage {
    display: none; /* Hidden by default */
    text-align: center;
    color: #6c757d;
    margin-top: 2rem;
}

footer {
    margin-top: 4rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

/* 主题切换按钮样式 */
.theme-toggle-wrapper {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999; /* 提高层级 */
}

.theme-toggle-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px var(--hover-shadow);
    position: relative;
    z-index: 1000;
}

.theme-toggle-btn:hover {
    background-color: var(--hover-bg);
}

.theme-toggle-btn i {
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover i {
    transform: scale(1.1);
}

/* 添加工具提示样式 */
.theme-toggle-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    right: 0;
    background: var(--card-bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 2px 4px var(--hover-shadow);
}

.theme-toggle-btn:hover::after {
    opacity: 1;
}

.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 150px;
}

.theme-dropdown.show {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    width: 100%;
    border: none;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
}

.theme-option:hover {
    background-color: var(--hover-bg);
}

.theme-option.active {
    color: var(--nav-pill-active);
}

/* 搜索框样式 */
.form-control {
    background-color: var(--search-bg);
    color: var(--search-text);
    border-color: var(--card-border);
    transition: all 0.3s ease;
}

/* 深色模式下搜索框样式 */
[data-theme="dark"] .form-control {
    border-color: var(--card-border);
}

[data-theme="dark"] .form-control:focus {
    background-color: #363636;
    border-color: #505050;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.1);
}

/* 导航卡片标题和描述文字样式 */
.navigation-card .card-title {
    color: var(--text-color);
}

[data-theme="dark"] .navigation-card .card-title {
    color: var(--card-title-color);
}

[data-theme="dark"] .navigation-card .card-text {
    color: var(--card-text-color);
}

/* 搜索框placeholder颜色调整 */
[data-theme="dark"] .form-control::placeholder {
    color: #888;
}

/* 容器背景 */
.container {
    background-color: var(--bg-color);
    transition: all 0.3s ease;
}

/* 导航标签样式 */
.nav-pills .nav-link {
    color: var(--text-color);
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
}

.nav-pills .nav-link:hover {
    color: var(--nav-pill-active);
    background: none;
}

.nav-pills .nav-link.active {
    background: none;
    color: var(--nav-pill-active);
    font-weight: 500;
    position: relative;
}

.nav-pills .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: var(--nav-pill-active);
    border-radius: 1px;
}

/* 确保所有过渡效果平滑 */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
