/* 所有CSS样式代码 */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Microsoft YaHei", sans-serif; }
body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 30px; }
.container { max-width: 900px; margin: 0 auto; background: white; padding: 30px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
h1 { text-align: center; color: #333; margin-bottom: 25px; font-size: 28px; font-weight: bold; }
.subtitle { text-align: center; color: #666; margin-bottom: 30px; font-size: 16px; }

.input-container { position: relative; margin: 20px 0; }
input[type="text"] { 
    width: 100%; 
    padding: 15px; 
    border-radius: 10px; 
    border: 2px solid #e2e8f0; 
    font-size: 16px; 
    transition: all 0.3s;
}
input[type="text"]:focus { 
    outline: none; 
    border-color: #4299e1; 
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}
.suggestions { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: white; 
    border: 2px solid #4299e1; 
    border-top: none; 
    border-radius: 0 0 10px 10px;
    max-height: 250px; 
    overflow-y: auto; 
    z-index: 1000; 
    display: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.suggestion-item { 
    padding: 12px 15px; 
    cursor: pointer; 
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}
.suggestion-item:hover { 
    background: linear-gradient(to right, #ebf8ff, #e6fffa);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-word { font-weight: bold; color: #2d3748; }
.suggestion-type { 
    float: right; 
    font-size: 12px; 
    background: #4299e1; 
    color: white; 
    padding: 2px 8px; 
    border-radius: 10px;
}

.answer-container { 
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%); 
    border: 2px solid #90cdf4; 
    border-radius: 12px; 
    padding: 25px; 
    margin: 20px 0; 
    display: none;
}
.word-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px;
}
.word-text { 
    font-size: 24px; 
    color: #2b6cb0; 
    font-weight: bold;
}
.word-info { 
    display: flex; 
    gap: 10px; 
    align-items: center;
}
.word-type { 
    background: #4299e1; 
    color: white; 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 14px;
}
.word-source { 
    background: #ed8936; 
    color: white; 
    padding: 6px 12px; 
    border-radius: 20px; 
    font-size: 12px;
}
.meaning-container { 
    margin: 20px 0; 
    padding: 20px; 
    background: white; 
    border-radius: 10px; 
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}
.meaning-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
    padding-bottom: 10px; 
    border-bottom: 2px solid #4299e1;
}
.meaning-title { 
    font-size: 18px; 
    color: #2d3748; 
    font-weight: bold;
}
.meaning-source { 
    font-size: 12px; 
    color: #718096; 
    background: #f7fafc; 
    padding: 4px 8px; 
    border-radius: 4px;
}
.meaning-text { 
    font-size: 18px; 
    color: #4a5568; 
    line-height: 1.6;
}

/* ========== 扩展信息容器样式 ========== */
.extended-info-container {
    margin-top: 25px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    display: none;
}

/* 选项卡头部 */
.tab-header {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    gap: 5px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.tab-btn:hover {
    color: #4299e1;
    background: #ebf8ff;
}

.tab-btn.active {
    color: #2b6cb0;
    border-bottom-color: #4299e1;
    font-weight: bold;
}

/* 选项卡内容 */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* 变形表格 */
.conjugation-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.conjugation-table th {
    background: #edf2f7;
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    color: #4a5568;
    border-bottom: 2px solid #cbd5e0;
}

.conjugation-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.conjugation-table tr:last-child td {
    border-bottom: none;
}

.conjugation-table tr:hover {
    background: #f7fafc;
}

/* 联想词和词组列表 */
.related-list, .phrases-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-item, .phrase-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
    transition: transform 0.2s;
}

.related-item:hover, .phrase-item:hover {
    transform: translateX(5px);
    background: #edf2f7;
}

.word-japanese {
    font-size: 16px;
    color: #2c5282;
    font-weight: 500;
}

.word-chinese {
    font-size: 14px;
    color: #718096;
}

.loading-message {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-style: italic;
}

.error-message {
    text-align: center;
    padding: 30px;
    color: #e53e3e;
    background: #fff5f5;
    border-radius: 8px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-section { 
    margin-top: 25px; 
    padding-top: 25px; 
    border-top: 2px dashed #cbd5e0;
}
.ai-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 20px;
}
.ai-icon { 
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%); 
    color: white; 
    padding: 8px 16px; 
    border-radius: 20px; 
    font-weight: bold;
}
.ai-title { 
    font-size: 18px; 
    color: #2d3748; 
    font-weight: bold;
}

/* ========== 分级例句表格样式 ========== */
.examples-table-container {
    margin-top: 25px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.table-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4299e1;
}

.table-title {
    font-size: 18px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 5px;
}

.table-subtitle {
    font-size: 14px;
    color: #718096;
}

.examples-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.table-row {
    display: table-row;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.table-row:hover {
    background: #f7fafc;
}

.table-row.header-row {
    background: #edf2f7;
    font-weight: bold;
    color: #4a5568;
    border-bottom: 2px solid #4299e1;
}

.table-cell {
    display: table-cell;
    padding: 12px 15px;
    vertical-align: top;
    border-right: 1px solid #f1f5f9;
}

.table-cell:last-child {
    border-right: none;
}

.level-cell {
    width: 80px;
    text-align: center;
}

.jp-cell {
    width: 25%;
    font-size: 16px;
    color: #2c5282;
    font-weight: 500;
}

.romaji-cell {
    width: 20%;
    font-size: 14px;
    color: #718096;
    font-style: italic;
}

.cn-cell {
    width: 25%;
    font-size: 15px;
    color: #2d3748;
}

.grammar-cell {
    width: 30%;
    font-size: 14px;
    color: #4a5568;
    line-height: 1.4;
}

/* 等级徽章样式 */
.level-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-align: center;
    min-width: 40px;
}

.level-N1 {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.level-N2 {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.level-N3 {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.level-N4 {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.level-N5 {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .examples-table {
        display: block;
    }
    
    .table-row {
        display: block;
        margin-bottom: 15px;
        padding: 15px;
        background: #f7fafc;
        border-radius: 8px;
    }
    
    .table-cell {
        display: block;
        padding: 8px 0;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .table-cell:last-child {
        border-bottom: none;
    }
    
    .header-row {
        display: none;
    }
    
    .jp-cell, .romaji-cell, .cn-cell, .grammar-cell {
        width: 100%;
    }
    
    .jp-cell::before {
        content: "日语例句：";
        font-weight: bold;
        color: #4a5568;
    }
    
    .romaji-cell::before {
        content: "罗马字：";
        font-weight: bold;
        color: #4a5568;
    }
    
    .cn-cell::before {
        content: "中文翻译：";
        font-weight: bold;
        color: #4a5568;
    }
    
    .grammar-cell::before {
        content: "语法解析：";
        font-weight: bold;
        color: #4a5568;
    }
    
    /* 移动端选项卡调整 */
    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 70px;
    }
    
    .conjugation-table {
        display: block;
        overflow-x: auto;
    }
    
    .conjugation-table th,
    .conjugation-table td {
        padding: 8px 10px;
        font-size: 14px;
    }
}

.btn-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); 
    gap: 15px; 
    margin-top: 25px;
}
.btn { 
    padding: 15px; 
    border: none; 
    border-radius: 10px; 
    font-size: 16px; 
    cursor: pointer; 
    transition: all 0.3s; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.btn-primary { 
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%); 
    color: white;
}
.btn-primary:hover { background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%); }
.btn-success { 
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); 
    color: white;
}
.btn-success:hover { background: linear-gradient(135deg, #38a169 0%, #2f855a 100%); }
.btn-warning { 
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); 
    color: white;
}
.btn-warning:hover { background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%); }
.btn-ai { 
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%); 
    color: white;
}
.btn-ai:hover { background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%); }
.btn-generate { 
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%); 
    color: white;
}
.btn-generate:hover { background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%); }
.btn:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    transform: none !important;
}

.filter-container { 
    background: #f7fafc; 
    padding: 15px; 
    border-radius: 10px; 
    margin-bottom: 20px;
}
.filter-title { 
    font-weight: bold; 
    color: #4a5568; 
    margin-bottom: 10px;
}
.filter-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 10px;
}
.filter-label { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer; 
    padding: 8px 12px; 
    background: white; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
    transition: all 0.2s;
}
.filter-label:hover { 
    border-color: #4299e1; 
    background: #ebf8ff;
}
.filter-label input { transform: scale(1.2); }

.feedback {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    animation: slideDown 3s ease forwards;
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    pointer-events: none;
}
.feedback.success { 
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%); 
}
.feedback.error { 
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%); 
}
.feedback.info { 
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%); 
}
@keyframes slideDown {
    0% { opacity: 0; transform: translate(-50%, -50px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -50px); }
}

.loading { 
    display: inline-block; 
    width: 20px; 
    height: 20px; 
    border: 3px solid #f3f3f3; 
    border-top: 3px solid #4299e1; 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.info-text { 
    text-align: center; 
    color: #718096; 
    margin-top: 20px; 
    font-size: 14px; 
    line-height: 1.5;
}

.cached-badge {
    display: inline-block;
    background: #48bb78;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}
.ai-generated-badge {
    display: inline-block;
    background: #9f7aea;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}
.ai-generate-badge {
    display: inline-block;
    background: #f6ad55;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}

/* 词性颜色样式 */
.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    margin: 2px;
}
/* 粘贴按钮样式 */
.input-with-button {
    position: relative;
    display: flex;
    align-items: center;
}

.paste-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.2s;
    color: #718096;
    z-index: 10;
}

.paste-btn:hover {
    background: #ebf8ff;
    color: #4299e1;
}

.paste-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* 确保输入框不会与粘贴按钮重叠 */
#questionInput {
    padding-right: 45px;
}

.type-い形容詞 { background: #4299e1; color: white; }
.type-な形容詞 { background: #48bb78; color: white; }
.type-一類動詞 { background: #ed8936; color: white; }
.type-二類動詞 { background: #e53e3e; color: white; }
.type-三類動詞 { background: #9f7aea; color: white; }
.type-副词 { background: #38b2ac; color: white; }
.type-接续词 { background: #805ad5; color: white; }
.type-名詞 { background: #ed64a6; color: white; }
.type-代词 { background: #f56565; color: white; }
.type-数词 { background: #d69e2e; color: white; }
.type-量词 { background: #68d391; color: white; }
.type-复合词 { background: #718096; color: white; }

/* ========== 新增样式：信息消息样式 ========== */
.info-message {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-style: italic;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
}

.hidden-tab {
    display: none !important;
}

/* 移动端选项卡调整 */
@media (max-width: 768px) {
    .tab-header {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 70px;
        flex: none;
    }
}