/**
 * WebTab - 智能起始页样式文件
 * 使用 CSS 变量管理主题配色
 */

/* ==================== CSS 变量定义 ==================== */
:root {
    --bg-primary: #1a1a2e;    /* 主背景色 - 深蓝黑 */
    --bg-secondary: #16213e;  /* 次要背景色 - 深蓝 */
    --bg-tertiary: #0f3460;   /* 三级背景色 - 蓝色 */
    --accent: #3498db;         /* 强调色 - 清新蓝色 */
    --text-primary: #ffffff;   /* 主文字色 - 白色 */
    --text-secondary: #a0a0a0; /* 次要文字色 - 灰色 */
    --border-color: rgba(255, 255, 255, 0.1); /* 边框颜色 */
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3); /* 阴影效果 */
    --radius: 12px;            /* 圆角半径 */
    --transition: 0.3s ease;   /* 过渡动画时间 */
}

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== 主体样式 ==================== */
body {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 主容器 ==================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ==================== 背景图层 ==================== */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    display: none;
}

.bg-layer.active {
    display: block;
}

/* ==================== 背景遮罩 ==================== */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.bg-overlay.active {
    opacity: 0.4;
}

.app-container > .main-content {
    position: relative;
    z-index: 2;
}

/* ==================== 顶部导航 ==================== */
.header {
    position: fixed;
    top: 0;
    right: 0;
    padding: 20px;
    z-index: 100;
}

.settings-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.settings-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
    transform: rotate(30deg);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.clock-section {
    text-align: center;
    margin-bottom: 30px;
}

.clock {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: "SF Pro Display", "Segoe UI", sans-serif;
    color: #ffffff !important;
}

.date-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 8px;
    font-size: 16px;
    color: #ffffff !important;
    letter-spacing: 2px;
}

.weather {
    font-size: 16px;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-icon {
    font-size: 18px;
    display: none;
}

.weather-temp {
    font-weight: 500;
    color: #ffffff !important;
}

.weather-desc {
    color: #ffffff !important;
}

.weather-city {
    display: none;
}

.search-section {
    width: 100%;
    max-width: 680px;
    margin-bottom: 16px;
    position: relative;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px;
    transition: var(--transition);
    position: relative;
    z-index: 10;
}

.search-container:focus-within {
    border-color: var(--border-color);
    box-shadow: none;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    z-index: 9;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 10px 18px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background: var(--bg-tertiary);
}

.search-engine-selector {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    margin-left: 12px;
}

.current-engine-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.dropdown-arrow {
    color: var(--text-secondary);
    margin-left: 4px;
}

.engine-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 10;
    display: none;
}

.engine-dropdown.show {
    display: block;
    opacity: 1;
    visibility: visible;
}

.engine-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.engine-option:hover {
    background: var(--bg-tertiary);
}

.engine-option img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text-primary);
    padding: 8px 0;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.search-btn:hover {
    color: var(--accent);
}

.categories-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.categories-select {
    display: none;
    width: 100%;
    max-width: 200px;
    margin: 0 auto 20px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.categories-select:focus {
    outline: none;
    border-color: var(--accent);
}

.categories-section {
    width: 100%;
    margin-bottom: 30px;
}

.categories-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0 10px;
    scrollbar-width: none; /* Firefox */
    min-height: 44px;
    width: 100%;
}

.categories-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* 确保在内容超出时也能滚动 */
.categories-tabs::before,
.categories-tabs::after {
    content: '';
    flex: 0 0 0;
    min-width: 0;
}

/* 当内容超出时，滚动行为 */
.categories-tabs > * {
    flex-shrink: 0;
}

.category-tab {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    position: relative;
}

.category-tab:hover {
    color: #ffffff;
}

.category-tab.active {
    background: transparent;
    border: none;
    color: #ffffff;
}

.category-tab.active::after {
    content: '●';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: #ffffff;
}

.category-tab .delete-cat {
    display: none;
    margin-left: 4px;
    opacity: 0.7;
}

.category-tab:hover .delete-cat {
    display: inline;
}

.category-tab .delete-cat:hover {
    opacity: 1;
}

.sites-section {
    width: 100%;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 16px;
    justify-items: center;
}

.site-card {
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.site-card:hover {
    transform: translateY(-5px) scale(1.05);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow);
}

.site-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    margin-bottom: 2px;
    background: white;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.site-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.site-icon.tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 22px;
    padding: 0;
}

.site-icon.folder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5c842;
    color: #ffffff;
    font-size: 22px;
    padding: 0;
}

.site-name {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100vw;
    height: 100vh;
    z-index: 2000;
    transition: right 0.3s ease;
}

.settings-panel.open {
    right: 0;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1999;
}

.settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

.settings-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h2 {
    font-size: 20px;
    font-weight: 500;
}

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.settings-tabs {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.settings-tab {
    padding: 16px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: var(--transition);
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--accent);
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--accent);
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-panel-section {
    display: none;
}

.settings-panel-section.active {
    display: block;
}

.settings-panel-section h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.theme-options {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 12px;
    transition: var(--transition);
}

.theme-option:hover {
    background: var(--bg-secondary);
}

/* 主题圆形选择器 */
.theme-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* 深色主题圆形 - 黑色 */
.theme-circle.dark {
    background: #000000;
}

/* 浅色主题圆形 - 白色 */
.theme-circle.light {
    background: #ffffff;
}

/* 鼠标悬停或选中时的样式 */
.theme-option:hover .theme-circle,
.theme-option.active .theme-circle {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
    transform: scale(1.1);
}

.theme-option span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.background-options {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

/* 背景选项样式 */
.bg-option {
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

/* 鼠标悬停或选中时的样式 */
.bg-option:hover {
    color: var(--accent);
}

.bg-option.selected {
    color: var(--accent);
}

.bg-option.selected::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}



.bg-effect-settings {
    display: none;
    flex-direction: column;
    gap: 20px;
    margin-top: 32px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.bg-effect-settings.show {
    display: flex;
}

.bg-effect-settings label {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bg-effect-settings label span {
    width: 85px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.bg-effect-settings input[type="range"] {
    flex: 1;
    cursor: pointer;
}

.custom-bg-settings {
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.custom-bg-settings.show {
    display: flex;
}

.video-bg-settings {
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.video-bg-settings.show {
    display: flex;
}

.video-bg-settings label {
    display: flex;
    align-items: center;
    gap: 14px;
}

.video-bg-settings label span {
    width: 85px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.video-bg-settings input[type="url"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.video-bg-settings input[type="url"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    display: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.bg-video.active {
    display: block;
}

.bg-video.visible {
    opacity: 1;
}

.video-wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.video-wallpaper-item {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.video-wallpaper-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-wallpaper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-wallpaper-overlay i {
    font-size: 28px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.video-wallpaper-item:hover .video-wallpaper-overlay {
    opacity: 1;
}

.video-wallpaper-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 6px 4px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: white;
    font-size: 11px;
    text-align: center;
    letter-spacing: 0.5px;
}

.video-wallpaper-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-wallpaper-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.video-wallpaper-item.selected span::after {
    content: ' ✓';
}

.bing-wallpaper-grid {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.bing-wallpaper-grid.show {
    display: flex;
}

.bing-wallpaper-grid .bing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.bing-wallpaper-item {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.bing-wallpaper-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bing-wallpaper-item:hover {
    border-color: var(--accent);
}

.bing-wallpaper-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.bing-wallpaper-item .bing-item-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.bing-wallpaper-item.selected .bing-item-check {
    display: flex;
}

.bing-wallpaper-item .bing-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bing-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px 0;
}

.custom-bg-settings label {
    display: flex;
    align-items: center;
    gap: 14px;
}

.custom-bg-settings label span {
    width: 85px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.custom-bg-settings input[type="url"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.custom-bg-settings input[type="url"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.1);
}

.upload-label input[type="file"] {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 14px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    cursor: pointer;
}

.engine-list,
.category-list,
.site-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.list-item img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.list-item-info {
    flex: 1;
}

.list-item-name {
    font-size: 14px;
    color: var(--text-primary);
}

.list-item-url {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

.list-item-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.list-item-actions button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.list-item-actions button.delete:hover {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #3498db;
    color: white;
}

/* 编辑按钮样式 */
.edit-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.edit-btn:hover {
    background: #4facfe;
    color: white;
}

.add-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.data-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-btn {
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.data-btn:hover {
    background: var(--bg-tertiary);
}

.data-btn.danger {
    background: transparent;
    border-color: #3498db;
    color: #3498db;
}

.data-btn.danger:hover {
    background: #3498db;
    color: white;
}

.data-btn.warning {
    background: transparent;
    border-color: #f5a623;
    color: #f5a623;
}

.data-btn.warning:hover {
    background: #f5a623;
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

#siteForm,
#engineForm,
#categoryForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group select {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cancel-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.cancel-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.submit-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .date {
        font-size: 16px;
    }

    .search-container {
        border-radius: 10px;
        padding: 6px 12px;
    }

    .categories-tabs {
        gap: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 0 10px;
        scrollbar-width: none; /* Firefox */
    }

    .categories-tabs::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }

    .category-tab {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .category-tab i {
        display: none; /* 小屏模式隐藏图标 */
    }

    .categories-select {
        display: none;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

    .site-card {
        width: 72px;
        height: 72px;
        padding: 8px;
    }

    .site-icon {
        width: 36px;
        height: 36px;
        padding: 3px;
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }

    .notes-modal .notes-content,
    .calculator-modal .calculator-content,
    .barcode-modal .barcode-content {
        width: 95%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .categories-tabs {
        gap: 4px;
        padding: 0 8px;
    }

    .category-tab {
        padding: 5px 10px;
        font-size: 11px;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }

    .site-card {
        width: 64px;
        height: 64px;
        padding: 6px;
    }

    .site-icon {
        width: 32px;
        height: 32px;
        padding: 2px;
    }

    .site-name {
        font-size: 11px;
        line-height: 1.2;
    }
}

.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --accent: #3498db;
    --text-primary: #1a1a2e;
    --text-secondary: #666666;
    --border-color: rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sites-grid .site-card {
    animation: fadeIn 0.4s ease forwards;
}

.sites-grid .site-card:nth-child(1) { animation-delay: 0.05s; }
.sites-grid .site-card:nth-child(2) { animation-delay: 0.1s; }
.sites-grid .site-card:nth-child(3) { animation-delay: 0.15s; }
.sites-grid .site-card:nth-child(4) { animation-delay: 0.2s; }
.sites-grid .site-card:nth-child(5) { animation-delay: 0.25s; }
.sites-grid .site-card:nth-child(6) { animation-delay: 0.3s; }

.site-card {
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.site-card:active {
    cursor: grabbing;
}

.site-card.dragging {
    opacity: 0.9;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
}

.site-card.drag-over {
    transform: scale(1.02);
}

.hitokoto-section {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 30px 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.hitokoto-content {
    font-size: 16px;
    line-height: 1.6;
    color: #ffffff !important;
    margin-bottom: 10px;
}

.hitokoto-from {
    font-size: 14px;
    color: #ffffff !important;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .hitokoto-section {
        padding: 20px 16px;
    }
    
    .hitokoto-content {
        font-size: 14px;
    }
    
    .hitokoto-from {
        font-size: 12px;
    }
}

.calculator-modal .calculator-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 320px;
    max-width: 90vw;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 500;
}

.calculator-display {
    padding: 20px 18px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.calc-expression {
    font-size: 14px;
    color: var(--text-secondary);
    min-height: 20px;
    word-break: break-all;
}

.calc-result {
    font-size: 36px;
    font-weight: 300;
    color: var(--text-primary);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    padding: 1px;
    background: var(--border-color);
}

.calc-btn {
    padding: 18px 0;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.calc-btn:hover {
    background: var(--bg-tertiary);
}

.calc-btn:active {
    filter: brightness(0.85);
}

.calc-btn.func {
    color: var(--accent);
    font-size: 18px;
}

.calc-btn.operator {
    color: var(--accent);
    font-size: 22px;
}

.calc-btn.equals {
    background: var(--accent);
    color: white;
}

.calc-btn.equals:hover {
    filter: brightness(1.1);
}

.calc-btn.zero {
    grid-column: span 2;
}

.barcode-modal .barcode-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 380px;
    max-width: 90vw;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.barcode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 500;
}

.barcode-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.barcode-type-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.barcode-type-label {
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.barcode-type-options {
    display: flex;
    gap: 6px;
}

.barcode-type-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.barcode-type-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.barcode-type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.barcode-input-row {
    display: flex;
    gap: 8px;
}

.barcode-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.barcode-input-row input:focus {
    border-color: var(--accent);
}

.barcode-gen-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.barcode-gen-btn:hover {
    filter: brightness(1.1);
}

.barcode-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 160px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 12px;
}

.barcode-preview canvas {
    max-width: 100%;
    height: auto;
}

.barcode-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.barcode-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.barcode-action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.notes-modal .notes-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 600px;
    max-width: 95vw;
    height: 80vh;
    max-height: 90vh;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 500;
}

.notes-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.notes-sidebar {
    width: 200px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.notes-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.notes-new-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.notes-new-btn:hover {
    filter: brightness(1.1);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.notes-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
}

.notes-item:hover {
    background: var(--bg-tertiary);
}

.notes-item.active {
    background: var(--accent);
    color: white;
}

.notes-item-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-item-preview {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-item.active .notes-item-preview {
    color: rgba(255,255,255,0.8);
}

.notes-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-editor-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
}

.notes-title {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    font-family: inherit;
}

.notes-title:focus {
    border-color: var(--accent);
}

.notes-editor textarea {
    flex: 1;
    width: 100%;
    min-height: 0;
    resize: none;
    padding: 18px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
}

.notes-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.notes-actions {
    display: flex;
    gap: 8px;
}

.notes-delete-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: #3498db;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.notes-delete-btn:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: #3498db;
}

.notes-save-btn {
    padding: 6px 16px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.notes-save-btn:hover {
    filter: brightness(1.1);
}

.wooden-fish-modal .wooden-fish-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 300px;
    max-width: 90vw;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.wooden-fish-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 500;
}

.wooden-fish-body {
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wooden-fish-container {
    text-align: center;
}

.wooden-fish {
    cursor: pointer;
    transition: transform 0.2s ease;
    margin-bottom: 20px;
}

.wooden-fish:hover {
    transform: scale(1.05);
}

.wooden-fish:active {
    transform: scale(0.95);
}

.wooden-fish-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
}

.wooden-fish-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.weather-modal .weather-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 90vw;
    max-width: 900px;
    max-height: 80vh;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 500;
}

.weather-body {
    padding: 12px;
    overflow-y: auto;
}

.weather-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 10px;
}

.weather-current-info {
    flex: 1;
    text-align: left;
}

.weather-current-city {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.weather-current-temp {
    font-size: 40px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 4px;
}

.weather-current-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-current-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.weather-forecast {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.weather-forecast-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    transition: var(--transition);
}

.weather-forecast-item:hover {
    background: var(--bg-tertiary);
}

.weather-forecast-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.weather-forecast-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.weather-forecast-temp {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.weather-forecast-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.weather-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 14px 0 10px;
    padding-left: 6px;
    border-left: 2px solid var(--accent);
}

.weather-hourly {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
}

.weather-hourly::-webkit-scrollbar {
    height: 3px;
}

.weather-hourly::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.weather-hourly-item {
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
    min-width: 60px;
    transition: var(--transition);
}

.weather-hourly-item:hover {
    background: var(--bg-tertiary);
}

.weather-hourly-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.weather-hourly-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.weather-hourly-temp {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.weather-air {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 12px;
}

.weather-air-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.weather-air-aqi {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.weather-air-level {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.weather-air-detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}

.weather-air-item {
    text-align: center;
    padding: 6px;
    background: var(--bg-primary);
    border-radius: 6px;
}

.weather-air-item-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.weather-air-item-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.weather-indices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.weather-indices-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px;
    transition: var(--transition);
}

.weather-indices-item:hover {
    background: var(--bg-tertiary);
}

.weather-indices-item-name {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.weather-indices-item-level {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.weather-indices-item-text {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .weather-modal .weather-content {
        width: 95%;
        max-width: none;
    }
    
    .weather-forecast {
        grid-template-columns: repeat(2, 1fr);
    }
}

.context-menu {
    position: fixed;
    z-index: 5000;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 140px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

.context-menu-item.danger {
    color: #3498db;
}

.context-menu-item.danger:hover {
    background: rgba(52, 152, 219, 0.1);
}

.widget-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.widget-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.widget-item-info i {
    font-size: 20px;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.widget-item-name {
    font-size: 14px;
    color: var(--text-primary);
}

.widget-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.widget-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.widget-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border-radius: 24px;
    transition: var(--transition);
}

.widget-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.widget-toggle input:checked + .widget-toggle-slider {
    background: var(--accent);
}

.widget-toggle input:checked + .widget-toggle-slider::before {
    transform: translateX(20px);
}

/* 文件夹弹窗样式 */
.folder-sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
}

.folder-sites-grid .site-card {
    /* 复用原有的 site-card 样式，不需要重新定义 */
}

.folder-sites-grid .site-icon {
    /* 复用原有的 site-icon 样式 */
}

