/* 藏文字体定义 */
@font-face {
    font-family: 'Uchen-Sarchen';
    src: url('Uchen-Sarchen.ttf') format('truetype');
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Uchen-Sarchen', 'KaiTi', '楷体', 'STKaiti', 'STKaitiSC-Regular', 'STKaitiTC-Regular', arial, sans-serif;
    background: #fff;
    color: #202124;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

/* 初始状态：内容居中 */
.main-container:not(:has(.results-page[style*="display: block"])) {
    justify-content: space-between;
    max-height: 100vh;
}

/* 有搜索结果时：紧凑布局 */
.main-container:has(.results-page[style*="display: block"]) {
    justify-content: flex-start;
    max-height: none;
}

/* 顶部导航栏 - Google风格 */
.top-nav {
    display: flex;
    justify-content: flex-end;
    padding: 6px;
    padding-right: 20px;
    align-items: center;
    height: 60px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    color: rgba(0, 0, 0, 0.87);
    text-decoration: none;
    font-size: 13px;
    padding: 0 8px;
    line-height: 24px;
}

.nav-link:hover {
    text-decoration: underline;
}

/* 主搜索区域 */
.search-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 30px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 0;
    max-height: calc(100vh - 80px);
}

.logo-container {
    margin-bottom: clamp(40px, 8vh, 70px);
}

.logo-text {
    font-size: clamp(28px, 4.5vw, 48px);
    font-weight: 400;
    color: #008cfe;
    letter-spacing: -2px;
    text-align: center;
    margin-bottom: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

/* 搜索框容器 */
.search-container {
    width: 100%;
    max-width: 584px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: scale(clamp(0.85, 1.1, 1.2));
    transform-origin: center;
    box-sizing: border-box;
    padding: 0 10px;
}

.search-box-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 0 16px;
    height: 44px;
    background: #fff;
    box-shadow: none;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}

.search-box-wrapper:hover {
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    border-color: rgba(223, 225, 229, 0);
}

.search-box-wrapper:focus-within {
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    border-color: rgba(223, 225, 229, 0);
}

.search-icon-left {
    display: flex;
    align-items: center;
    padding-right: 13px;
    margin-top: 3px;
}

.search-icon-left svg {
    width: 20px;
    height: 20px;
    fill: #9aa0a6;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.87);
    background: transparent;
    padding: 0;
    margin: 0;
    height: 100%;
}

.search-input::placeholder {
    color: #9aa0a6;
    font-size: 14px;
}

.search-icons-right {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
}

.voice-icon,
.clear-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.voice-icon:hover,
.clear-icon:hover {
    background: rgba(60, 64, 67, 0.08);
}

.voice-icon svg,
.clear-icon svg {
    width: 20px;
    height: 20px;
    fill: #008cfe;
}

.clear-icon svg {
    fill: #70757a;
}

/* 搜索按钮 */
.search-buttons {
    display: flex;
    justify-content: center;
    gap: 11px;
    margin-top: 0;
    flex-shrink: 0;
}

.search-button {
    background-color: #f8f9fa;
    border: 1px solid #f8f9fa;
    border-radius: 4px;
    color: #3c4043;
    font-family: 'Uchen-Sarchen', 'KaiTi', '楷体', 'STKaiti', 'STKaitiSC-Regular', 'STKaitiTC-Regular', arial, sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0 20px;
    line-height: 36px;
    height: 36px;
    min-width: 54px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-button:hover {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
    border: 1px solid #dadce0;
    color: #202124;
}

.search-button:active {
    border: 1px solid #008cfe;
}

/* 搜索结果页面 */
.results-page {
    max-width: 652px;
    margin: 0 auto;
    padding: 0 20px;
    flex: 0 0 auto;
}

/* 当显示搜索结果时，调整搜索区域样式 */
.main-container:has(.results-page[style*="display: block"]) .search-wrapper {
    flex: 0 0 auto;
    padding: 50px 20px 20px;
    max-height: none;
    justify-content: flex-start;
    min-height: auto;
}

.main-container:has(.results-page[style*="display: block"]) .logo-container {
    margin-bottom: 25px;
}

.main-container:has(.results-page[style*="display: block"]) .logo-text {
    font-size: clamp(24px, 3vw, 36px);
}

.results-header {
    display: none;
}

.results-stats {
    color: #70757a;
    font-size: 14px;
    line-height: 43px;
}

/* 搜索结果列表 */
.results-list {
    padding-bottom: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.result-item {
    padding: 24px 28px;
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.result-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: #dadce0;
}

.result-chinese {
    font-size: 28px;
    line-height: 1.4;
    font-weight: 500;
    color: #008cfe;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}


.result-chinese:visited {
    color: #008cfe;
    opacity: 0.8;
}

.result-tibetan {
    font-size: 24px;
    line-height: 1.6;
    color: #4d5156;
    word-wrap: break-word;
    flex: 1;
}

.highlight {
    font-weight: bold;
    background: rgba(0, 140, 254, 0.1);
    color: #008cfe;
}

/* 无结果页面 */
.no-results {
    text-align: center;
    padding: 100px 20px;
    max-width: 652px;
    margin: 0 auto;
}

.no-results-content {
    padding: 20px;
}

.no-results-title {
    font-size: 20px;
    color: #202124;
    margin-bottom: 8px;
    font-weight: 400;
}

.no-results-hint {
    font-size: 14px;
    color: #70757a;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 100px 20px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4285f4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        max-height: 100vh;
    }
    
    .search-wrapper {
        padding: 50px 15px 20px;
        max-height: calc(100vh - 70px);
    }
    
    .main-container:has(.results-page[style*="display: block"]) .search-wrapper {
        padding: 40px 15px 18px;
    }
    
    .main-container:has(.results-page[style*="display: block"]) .logo-container {
        margin-bottom: 20px;
    }
    
    .logo-container {
        margin-bottom: clamp(25px, 5vh, 40px);
        width: 100%;
    }
    
    .logo-text {
        font-size: clamp(24px, 4vw, 36px);
    }
    
    .search-container {
        padding: 0 10px;
        flex-direction: column;
        gap: 12px;
        transform: scale(clamp(0.85, 0.95, 1.0));
        max-width: 100%;
    }
    
    .search-box-wrapper {
        height: 44px;
        width: 100%;
    }
    
    .search-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .search-button {
        width: 100%;
        max-width: 200px;
    }
    
    .footer {
        max-height: 50px;
        padding: clamp(5px, 0.8vh, 8px) 15px;
        font-size: clamp(8px, 1vw, 10px);
    }
}

@media (max-width: 480px) {
    .search-wrapper {
        padding: 40px 10px 18px;
        max-height: calc(100vh - 60px);
    }
    
    .main-container:has(.results-page[style*="display: block"]) .search-wrapper {
        padding: 35px 10px 15px;
    }
    
    .main-container:has(.results-page[style*="display: block"]) .logo-container {
        margin-bottom: 18px;
    }
    
    .logo-container {
        margin-bottom: clamp(20px, 4vh, 30px);
    }
    
    .logo-text {
        font-size: clamp(20px, 3.5vw, 28px);
    }
    
    .search-container {
        transform: scale(clamp(0.8, 0.9, 0.95));
        gap: 10px;
    }
    
    .footer {
        max-height: 45px;
        padding: clamp(4px, 0.6vh, 6px) 10px;
        font-size: clamp(7px, 0.9vw, 9px);
    }
}
    
    .results-page {
        padding: 10px 15px 0;
    }
    
    .results-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .result-item {
        padding: 20px 24px;
        flex-direction: row;
        gap: 12px;
    }
    
    .result-chinese {
        font-size: 24px;
    }
    
    .result-tibetan {
        font-size: 20px;
    }
}

/* 滚动条样式 */
.results-list {
    max-height: none;
}

/* 隐藏滚动条但保持滚动功能 */
body::-webkit-scrollbar {
    width: 16px;
}

body::-webkit-scrollbar-track {
    background: #fff;
}

body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 4px solid #fff;
}

body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Footer - 低调的Google风格 */
.footer {
    background: #ffffff;
    border-top: 1px solid #dadce0;
    max-width: 652px;
    margin: 0 auto;
    padding: clamp(6px, 1vh, 10px) 20px;
    font-size: clamp(9px, 1.1vw, 11px);
    color: #70757a;
    line-height: 1.4;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    max-height: 60px;
}

.footer-line {
    margin-bottom: 4px;
}

.footer-line:last-child {
    margin-bottom: 0;
}

/* 响应式Footer */
@media (max-width: 768px) {
    .footer {
        margin: 8px auto 0;
        padding: 6px 15px;
        font-size: 10px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .footer {
        margin: 5px auto 0;
        padding: 5px 10px;
        font-size: 9px;
        line-height: 1.3;
    }
}
