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

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 搜索建议样式 */
.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f8fafc;
}

/* 词典卡片样式 */
.dictionary-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    padding: 20px;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dictionary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
    border-color: #e2e8f0;
}

.dictionary-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #0f172a;
}

.dictionary-card .meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.8125rem;
    color: #64748b;
}

.dictionary-card .word-count {
    display: flex;
    align-items: center;
    gap: 3px;
}

.dictionary-card .version {
    display: flex;
    align-items: center;
    gap: 3px;
}

.dictionary-card .description {
    font-size: 0.8125rem;
    color: #94a3b8;
    margin-top: auto;
}

/* 定义内容样式 */
#word-definition {
    line-height: 1.7;
}

/* 藏语字体增强 */
.tibetan-text {
    font-family: 'Noto Serif Tibetan', 'Microsoft Himalaya', serif;
    line-height: 1.8;
}

/* 词典选择器样式增强 */
#dictionary-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* 搜索框增强 */
#search-input:focus {
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* 按钮样式优化 */
button {
    transition: all 0.2s ease;
}

/* 搜索结果区域 */
#results {
    margin-top: 20px;
    display: none;
}

#results.show {
    display: block;
}

.result-item {
    margin-bottom: 20px;
    padding: 16px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.result-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-dictionary {
    font-size: 13px;
    color: #718096;
    margin-bottom: 12px;
    font-style: italic;
}

.result-definition {
    font-size: 15px;
    line-height: 1.7;
    color: #4a5568;
    white-space: pre-wrap;
}

/* 藏语文本特殊处理 */
.result-title .tibetan-text {
    font-size: 24px;
    font-weight: 400;
}

/* 结果操作按钮 */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.result-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-action-btn:hover {
    background-color: #edf2f7;
    border-color: #cbd5e0;
}

.result-action-btn i {
    font-size: 12px;
}

/* 捐赠提示样式 */
.donation-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    border: 1px solid #bae6fd;
}

.donation-section p {
    margin-bottom: 1rem;
    color: #0369a1;
}

.donation-section a {
    display: inline-block;
    background: #0ea5e9;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.donation-section a:hover {
    background: #0284c7;
}

#word-definition p {
    margin-bottom: 12px;
}

#word-definition strong {
    font-weight: 600;
    color: #1e40af;
}

#word-definition h4 {
    font-size: 1.125rem;
    margin-top: 20px;
    margin-bottom: 12px;
    color: #0f172a;
}

#word-definition ul,
#word-definition ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

#word-definition li {
    margin-bottom: 6px;
}

/* 深色模式样式 */
body.dark-mode {
    background: linear-gradient(to-br, #0f172a, #1e293b);
    color: #f1f5f9;
}

body.dark-mode header {
    background: rgba(15, 23, 42, 0.8);
    border-color: #1e293b;
}

body.dark-mode header h1 {
    color: #f8fafc;
}

body.dark-mode .bg-white {
    background: #1e293b;
}

body.dark-mode .text-dark {
    color: #f8fafc;
}

body.dark-mode .text-gray-800 {
    color: #f1f5f9;
}

body.dark-mode .text-gray-700 {
    color: #cbd5e1;
}

body.dark-mode .text-gray-600 {
    color: #94a3b8;
}

body.dark-mode .text-gray-500 {
    color: #64748b;
}

body.dark-mode .border-gray-100 {
    border-color: #334155;
}

body.dark-mode .border-gray-200 {
    border-color: #475569;
}

body.dark-mode .bg-gray-50 {
    background: #334155;
}

body.dark-mode .bg-gray-100 {
    background: #334155;
}

body.dark-mode .hover:bg-gray-200:hover {
    background: #475569;
}

body.dark-mode .dictionary-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .dictionary-card:hover {
    border-color: #475569;
}

body.dark-mode .dictionary-card h3 {
    color: #f8fafc;
}

body.dark-mode .dictionary-card .meta-info {
    color: #94a3b8;
}

body.dark-mode .dictionary-card .description {
    color: #64748b;
}

body.dark-mode .suggestion-item {
    border-color: #334155;
    background: #1e293b;
}

body.dark-mode .suggestion-item:hover,
body.dark-mode .suggestion-item.active {
    background: #334155;
}

body.dark-mode #theme-toggle i {
    content: '\f185';
}

/* 动画和过渡效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .dictionary-card {
        padding: 20px;
    }
    
    .dictionary-card h3 {
        font-size: 1.125rem;
    }
    
    .meta-info {
        flex-direction: column;
        gap: 6px !important;
    }
    
    #results-section, #no-results-section, #loading-section {
        margin-top: 12px;
    }
    
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

@media (max-width: 480px) {
    header .flex {
        flex-direction: column;
        gap: 12px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    .dictionary-card {
        padding: 16px;
    }
    
    .dictionary-card h3 {
        font-size: 1rem;
    }
    
    .meta-info {
        font-size: 0.8125rem !important;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 焦点样式 */
button:focus,
input:focus,
select:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    header,
    footer,
    #search-input,
    #search-button,
    #dictionary-select,
    #theme-toggle,
    #dictionaries-container {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    #results-section {
        display: block !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
}