/* 防止闪烁的基础样式 */
html {
    background-color: #fff;
    transition: background-color 0.2s ease;
}

html[data-bs-theme="dark"] {
    background-color: #1e1e1e;
}

/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: white;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 容器样式 */
.container {
    width: 95%;
    max-width: 665px;
    margin: 100px auto 20px;
    padding: 0 10px;
    flex: 1;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* 搜索标题 */
.search-title {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 100;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 34px;
    color: #333;
    transition: color 0.3s ease;
}

.search-subtitle {
    text-align: center;
    margin-bottom: 19px;
    color: #666;
    font-size: 13px;
    transition: color 0.3s ease;
}

/* 搜索框区域 */
.search-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
}

.engine-selector {
    flex: 0 0 auto;
    margin-right: 10px;
    height: 44px;
}

.engine-selector select {
    height: 100%;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    min-width: 114px;
    width: auto;
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 42px;
    text-align: center;
    text-align-last: center;
    -moz-text-align-last: center;
    transition: all 0.3s ease;
}

.search-box {
    display: flex;
    flex: 1;
    height: 44px;
}

#searchInput {
    flex: 1;
    padding: 11px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    outline: none;
    height: 100%;
    box-sizing: border-box;
    line-height: 19px;
    transition: all 0.3s ease;
}

#searchButton {
    padding: 0 19px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 15px;
    height: 100%;
    line-height: 44px;
    transition: background-color 0.3s ease;
}

#searchButton:hover {
    background: #3367d6;
}

/* 搜索建议 */
#suggestions {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none;
    position: absolute;
    width: calc(95% - 38px);
    max-width: 665px;
    z-index: 100;
    background: white;
    box-sizing: border-box;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

#suggestions li {
    padding: 10px;
    cursor: pointer;
    background: white;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
    transition: all 0.3s ease;
}

#suggestions li:hover {
    background-color: #f8f9fa;
}

#suggestions li:last-child {
    border-bottom: none;
}

/* 快捷链接 */
.quick-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 29px;
}

.quick-link-item {
    background: white;
    padding: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #dddddd;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.quick-link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    border-color: #ddd;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 10px;
    margin-top: auto;
    color: #666;
    position: relative;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    transition: color 0.3s ease;
}

.hitokoto {
    margin-bottom: 10px;
    quotes: "“" "”";
    padding: 0 20px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    transition: color 0.3s ease;
}

.hitokoto::before {
    content: open-quote;
}

.hitokoto::after {
    content: close-quote;
}

.links a {
    color: #4285f4;
    text-decoration: none;
    margin: 0 5px;
    transition: color 0.3s ease;
}

.links a:hover {
    text-decoration: underline;
}
.links-OnlySettings {
  display: none;
}
.links-OnlySettings a {
    color: #4285f4;
    text-decoration: none;
    margin: 0 5px;
    transition: color 0.3s ease;
}

.links-OnlySettings a:hover {
    text-decoration: underline;
}

/* 深色模式样式 */
[data-bs-theme="dark"] {
    --bg-color: #1e1e1e;
    --text-color: #e8eaed;
    --secondary-text: #9aa0a6;
    --input-bg: #2d2e30;
    --border-color: #3c4043;
    --hover-bg: #3c4043;
    --hover-border: #5f6368;
    --card-bg: #2b3035;
}

[data-bs-theme="dark"] body {
    background: var(--bg-color);
    color: var(--text-color);
}

[data-bs-theme="dark"] .search-title,
[data-bs-theme="dark"] .search-subtitle,
[data-bs-theme="dark"] .footer,
[data-bs-theme="dark"] .hitokoto {
    color: var(--text-color);
}

[data-bs-theme="dark"] .search-subtitle {
    color: var(--secondary-text);
}

[data-bs-theme="dark"] .engine-selector select,
[data-bs-theme="dark"] #searchInput,
[data-bs-theme="dark"] #suggestions,
[data-bs-theme="dark"] #suggestions li,
[data-bs-theme="dark"] .quick-link-item {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-bs-theme="dark"] #suggestions {
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] #suggestions li:hover {
    background-color: var(--hover-bg);
}

[data-bs-theme="dark"] .quick-link-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border-color: var(--hover-border);
}

[data-bs-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        margin: 30px auto 20px;
        padding: 0 10px;
        max-width: 95%;
    }
    
/*    .quick-links {
        display: none !important;
    }
*/    
    .search-title {
        font-size: 28px;
    }
    
    .search-row {
        flex-direction: column;
    }
    
    .engine-selector {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        height: 40px;
    }
    
    .engine-selector select {
        width: 100%;
        max-width: 100%;
        line-height: 38px;
        height: 40px;
    }
    
    .search-box {
        width: 100%;
        height: 40px;
        display: flex;
    }
    
    #searchInput {
        flex: 1;
        height: 40px;
        padding: 10px;
        font-size: 15px;
        line-height: 20px;
        border-radius: 4px 0 0 4px;
    }
    
    #searchButton {
        height: 40px;
        line-height: 40px;
        padding: 0 15px;
        border-radius: 0 4px 4px 0;
        flex-shrink: 0;
    }
/*    
    #suggestions {
        display: none !important;
    }
*/    
    .footer {
        position: static;
        padding: 10px;
    }
}
/* UI 显示设置 */
[data-hide-links="true"] .links { display: none; }
[data-hide-links="true"] .links { display: none; }

/* 天气显示 */
.weather-display {
    position: fixed;
    top: 15px;
    left: 15px;
    padding: 8px 14px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    font-size: 14px;
    color: var(--bs-body-color);
    z-index: 1000;
    cursor: default;
    user-select: none;
}

@media (max-width: 768px) {
    .weather-display {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 6px 10px;
    }
}
[data-hide-hitokoto="true"] .hitokoto { display: none; }
[data-hide-search-subtitle="true"] .search-subtitle { display: none; }
/* 确保选择器正确 */
[data-hide-search-title="true"] .search-title {
    display: none !important;
  }
[data-hide-links="true"] .links-OnlySettings {
  display: block; /* 这里使用了 none 的反义词 */
}
