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

body {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background-color: #f5f5f5;
}

.container {
    display: flex;
    height: 100vh;
}

/* 左侧边栏 */
.sidebar {
    width: 250px;
    background-color: #fff;
    border-right: 1px solid #ddd;
    padding: 20px;
}

.logo {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #333;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-item {
    padding: 10px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-item:hover {
    background-color: #f0f0f0;
    border-radius: 4px;
}

.menu-item.active {
    background-color: #333;
    color: #fff;
    border-radius: 4px;
}

.user-info {
    margin-top: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.user-info p {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.btn-logout {
    width: 100%;
    padding: 8px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c82333;
}

.btn-primary {
    padding: 12px 20px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: #333;
    color: #fff;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.header {
    margin-bottom: 30px;
}

.header h2 {
    font-size: 18px;
    color: #666;
    font-weight: normal;
}

/* 翻译区域 */
.translation-area {
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
}

.textarea-wrapper {
    position: relative;
}

#sourceText {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    padding-right: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    resize: vertical;
    margin-bottom: 20px;
}

#sourceText:focus {
    outline: none;
    border-color: #333;
}

.btn-paste {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 8px 16px;
    background-color: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-paste:hover {
    background-color: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.btn-paste:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.btn-translate {
    padding: 10px 30px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-translate:hover {
    background-color: #333;
    color: #fff;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #333;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: #0056b3;
}

.register-link {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

.register-link a {
    color: #007bff;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

/* 内容区域切换 */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* 翻译结果区域 */
.translation-result {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.translated-text {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.vocabulary-list {
    margin-top: 15px;
}

.vocabulary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 6px;
    background-color: #fff;
}

.vocabulary-item .word-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.vocabulary-item .word {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    min-width: 100px;
}

.vocabulary-item .meaning {
    color: #666;
    font-size: 14px;
}

.vocabulary-item .context {
    color: #888;
    font-size: 14px;
    margin-bottom: 10px;
    font-style: italic;
}

.vocabulary-item .meta {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 10px;
}

.btn-add {
    padding: 5px 15px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-add:hover {
    background-color: #218838;
}

.btn-delete {
    padding: 5px 15px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-delete:hover {
    background-color: #c82333;
}

/* 生词本区域 */
.vocabulary-container {
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 30px;
    max-width: 800px;
}

.my-vocabulary-list {
    min-height: 300px;
}

.my-vocabulary-list .loading,
.my-vocabulary-list .empty,
.my-vocabulary-list .error {
    text-align: center;
    padding: 50px;
    color: #666;
    font-size: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.btn-refresh {
    padding: 8px 16px;
    background-color: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background-color: #138496;
}

/* 带下划线的单词样式 */
.marked-source-text {
    padding: 15px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 16px;
    line-height: 3.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: visible;
}

.word-with-translation {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0 5px;
    vertical-align: top;
}

.word-with-translation .word-text {
    display: block;
    text-decoration: underline;
    text-decoration-color: #4a90e2;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    white-space: nowrap;
    color: #333;
    font-size: 16px;
    text-align: center;
    line-height: 1.2;
}

.word-with-translation .word-translation-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 5px;
    min-height: 20px;
}

.word-with-translation .word-translation {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    line-height: 1;
    text-align: center;
}

.add-word-btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-word-btn-small:hover {
    background-color: #218838;
    transform: scale(1.2);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
    border: 1px solid #ddd;
    line-height: 1.2;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.underlined-word .add-word-btn {
    display: block;
    font-size: 9px;
    color: #28a745;
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 1px;
    padding: 0 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.underlined-word .add-word-btn:hover {
    opacity: 1;
    text-decoration: underline;
}
