/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

/* 基础响应式设置 */
html {
    font-size: 16px;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 1rem 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.container,
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px; /* 为控制区域留出空间 */
}

.admin-container {
    max-width: 1400px;
    padding: 20px;
}

/* 单词卡片样式 - 完全响应式 */
.word-card {
    position: relative;
    background-color: white;
    border-radius: 10px;
    padding: 5vw;
    margin: 2rem auto;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    width: 100%;
    max-width: 500px;
    min-width: 300px;
    overflow: hidden;
    will-change: transform;
}

/* 滑动动画样式 */
.word-card.swiping-left {
    transform: translateX(-120%);
    opacity: 0;
}

.word-card.swiping-right {
    transform: translateX(120%);
    opacity: 0;
}

/* 图片容器 - 响应式调整 */
.pic-container {
    width: 100%;
    height: 35vh;
    max-height: 280px;
    min-height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    overflow: hidden;
}

.pic-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.word {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.phonetic {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 20px;
    font-style: italic;
}

.definition {
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.8;
    max-width: 600px;
}

.pic-container img {
    /* max-width: 300px; */
    /* max-height: 200px; */
    /* margin-bottom: 20px; */
    /* border-radius: 5px; */
}

.tenses {
    font-size: 1rem;
    color: #34495e;
    background-color: #f8f9fa;
    padding: 10px 20px;
    border-radius: 20px;
}

/* 导航按钮 */
.navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #3498db;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.keyboard-hint {
    text-align: center;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 40px;
}

/* 管理员样式 */
.admin-container {
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* 删除或注释以下冲突样式 */
/* .content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
} */

/* 添加响应式调整 */
@media (max-width: 768px) {

    .word-form,
    .word-list {
        margin-bottom: 20px;
    }
}

.word-form {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.word-list {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

textarea {
    min-height: 100px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.action-btn {
    margin-right: 5px;
    padding: 5px 10px;
    font-size: 0.9rem;
}

.edit-btn {
    background-color: #2ecc71;
}

.edit-btn:hover {
    background-color: #27ae60;
}

.delete-btn {
    background-color: #e74c3c;
}

.delete-btn:hover {
    background-color: #c0392b;
}

.login-box {
    max-width: 400px;
    margin: 100px auto;
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.error-message {
    color: #e74c3c;
    margin-top: 15px;
    text-align: center;
}

.paste-hint {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 5px;
}

#picPreview {
    margin-top: 10px;
    max-width: 200px;
}

#picPreview img {
    max-width: 100%;
    border-radius: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
    }

    .word {
        font-size: 2rem;
    }

    .word-card {
        padding: 20px;
        min-height: 300px;
    }
}

/* 删除原有滑动相关样式，保留基础样式 */
body {
    background-color: #f5f5f5;
    padding: 1rem 0;
}

/* 单词卡片样式 */
.word-card {
    background-color: white;
    border-radius: 10px;
    padding: 2rem;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 80vh;
    /* 使用视口高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* 图片容器 */
.pic-container {
    width: 100%;
    height: 40vh;
    /* 响应式高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    overflow: hidden;
}

/* Swiper导航按钮样式 */
.swiper-button-next,
.swiper-button-prev {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: white;
    opacity: 0.5;
    transition: opacity 0.18s ease, transform 0.18s ease;
    /* 固定定位到视口，垂直居中，不随页面内容滚动 */
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100; /* 确保高于 .control-panel (1000) */
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    opacity: 0.5;
    transform: translateY(-50%) scale(1.03);
}

/* 左右偏移，避免被屏幕边缘阻挡或与控制栏冲突 */
.swiper-button-prev {
    left: 8px; /* 靠左边缘 */
}

.swiper-button-next {
    right: 8px; /* 靠右边缘 */
}

/* 多断点响应式调整 */
/* 大屏设备 */
@media (min-width: 1024px) {
    .word-card {
        padding: 2rem;
        min-height: 600px;
    }

    .word {
        font-size: 3rem;
    }

    .phonetic {
        font-size: 1.5rem;
    }

    .definition {
        font-size: 1.2rem;
    }
}

/* 平板设备 */
@media (max-width: 768px) {
    .word-card {
        min-height: 500px;
        padding: 1.5rem;
    }

    .word {
        font-size: 2.5rem;
    }

    .pic-container {
        height: 30vh;
    }
}

/* 大屏手机 */
@media (max-width: 480px) {
    .word-card {
        min-height: 450px;
        padding: 1rem;
        margin: 1rem auto;
    }

    .word {
        font-size: 2rem;
    }

    .tenses {
        font-size: 0.9rem;
    }
}

/* 小屏手机 */
@media (max-width: 360px) {
    .word-card {
        min-height: 400px;
    }

    .pic-container {
        height: 25vh;
    }

    .btn-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-container button {
        width: 100%;
    }
}

/* 发音按钮新样式 - 放在音标旁边 */
.pronunciation-btn {
    background-color: transparent;
    color: #007bff;
    border: none;
    cursor: pointer;
    padding: 0 5px;
    margin-left: 8px;
    vertical-align: middle;
    transition: color 0.2s ease;
}

.pronunciation-btn:hover {
    color: #0056b3;
    background-color: transparent;
    transform: none;
}

.pronunciation-btn i {
    font-size: 28px;
}

/* 调整音标文本样式，确保按钮对齐 */
.phonetic {
    display: flex;
    align-items: center;
}

/* 单词卡片内容样式调整 */
.word-card {
    position: relative;
}

/* 时态样式 - 过去式和过去分词不同颜色 */
.tenses {
    color: #6c757d;
    /* 保持标签文本默认灰色 */
    font-size: 0.9rem;
}

.past-tense {
    color: #3c5f2f;
    /* 过去式颜色 */
    font-weight: 600;
}

.past-participle {
    color: #5066a1;
    /* 过去分词颜色 */
    font-weight: 600;
}

.pastTenseSentenceText {
    color: #3c5f2f;
}

.pastParticipleSentenceText {
    color: #5066a1;
}

/* 无数据时保持灰色 */
.past-tense:empty::before,
.past-participle:empty::before {
    content: '—';
    color: #6c757d;
    font-weight: normal;
}

/* 控制区域样式 */
.control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    /* 确保在最上层 */
    transition: transform 0.3s ease;
    /* 添加过渡效果 */
}

/* 隐藏控制区域的类 */
.control-panel.hidden {
    transform: translateY(100%);
    /* 完全移出屏幕 */
}

/* 控制区域切换按钮 - 优化移动端体验 */
.control-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    /* 增大可点击区域 */
    padding: 0;
    /* 确保在触摸设备上有良好体验 */
    outline: none;
    touch-action: manipulation;
}

.control-toggle-btn:hover {
    background-color: #0056b3;
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.control-toggle-btn:active {
    transform: scale(0.95);
}

/* 图标旋转过渡效果 */
.control-toggle-btn i {
    transition: transform 0.3s ease;
    font-size: 1.5rem;
}

/* 使用数据属性控制旋转状态 */
.control-toggle-btn[data-state="hidden"] i {
    transform: rotate(180deg);
}

/* 为触摸设备提供更好的反馈 */
@media (hover: none) and (pointer: coarse) {
    .control-toggle-btn {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
}

/* 在移动设备上优化按钮尺寸和位置 */
@media (max-width: 768px) {
    .control-toggle-btn {
        /* bottom: 15px; */
        bottom: 68px;
        right: 15px;
        width: 55px;
        height: 55px;
        opacity: 0.5;
        background-color: #ddd;
    }

    .control-toggle-btn i {
        font-size: 1.8rem;
    }
}

/* 调整主内容区域，避免被控制区域遮挡 */
.container {
    padding-bottom: 80px;
    /* 为控制区域留出空间 */
}

.control-group {
    display: flex;
    align-items: center;
}

#sortSelect {
    width: auto;
    margin-left: 5px;
}

#favoriteBtn {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 提示消息样式 */
.custom-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    z-index: 1010;
    display: none;
}

/* 单词列表样式 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.page-btn,
.page-number {
    padding: 0.3rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

.page-number.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.page-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 复选框样式 */
.word-checkbox,
#selectAll {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 批量删除按钮 */
.batch-delete-btn {
    padding: 0.3rem 0.8rem;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.batch-delete-btn:hover {
    background-color: #c82333;
}

/* 分页和复选框样式优化 */

/* 管理员页面样式 */
.admin-container {
    max-width: 1400px;
}

/* 图片预览样式 */
#picPreview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 5px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .content {
        flex-direction: column;
    }

    .word-form,
    .word-list {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }
}

/* 表格行悬停效果优化 */
table tbody tr:hover {
    background-color: #f8f9fa;
}

/* 分页控件样式优化 */
#pageNumbers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.page-item {
    margin: 0 2px;
}

/* 优化表单布局和对齐 */
.word-form .card {
    padding: 1.5rem 1.5rem 1.5rem 0.5rem !important;
    /* 左侧内边距减小 */
}

.word-form .card-body {
    padding-left: 0 !important;
}

.word-form .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.word-form label.col-form-label {
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
    text-align: left !important;
    white-space: nowrap;
}

.word-form .col-sm-10,
.word-form .col-sm-9 {
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}

/* 助记图上传区域样式 */
.pic-upload-container {
    width: 200px;
    /* 固定宽度 */
    height: 200px;
    /* 固定高度 */
    border: 2px dashed #ccc;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.pic-upload-container:hover {
    border-color: #3498db;
    background-color: #f0f7ff;
}

.pic-upload-container.active {
    border-color: #3498db;
    background-color: #e6f0ff;
}

#picPreviewImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 懒加载图片容器样式 */
.pic-container {
    min-height: 150px;
    /* 设置固定高度防止布局抖动 */
}

/* 多断点响应式调整 */

/* 小屏手机 */
@media (max-width: 360px) {
    .word-card {
        min-height: 400px;
    }

    .pic-container {
        height: 25vh;
    }

    .btn-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-container button {
        width: 100%;
    }
}

/* 特定手机型号优化 */
@media (max-width: 400px) {
    .pic-container {
        width: 90vw;
        height: 26vh;
        overflow: hidden;
    }

    .pic-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* 小屏手机竖屏模式（如小米Note2） */
@media (max-width: 393px) and (max-height: 600px) and (orientation: portrait) {
    body {
        justify-content: flex-start;
        padding-top: 4px;
    }

    .word-card {
        padding-top: 0;
    }

    .pic-container {
        width: 360px;
        height: 200px;
        overflow: hidden;
    }

    .pic-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}
/* 小米12 393x873 */
@media (max-width:400px) and (orientation: portrait){
    body{
        padding-top:0 !important;
    }
    .word-card{
        padding-top:0px !important;
        margin-top:0px !important;
    }
    .pic-container {
        width:500px;
        height:280px;
        overflow: hidden;
        
    }
    .pic-container img{
        width: 100%;
        height:100%;
        object-fit:contain;
    }
}

/* 大屏手机 */
@media (max-width: 480px) {
    .word-card {
        min-height: 450px;
        padding: 1rem;
        margin: 1rem auto;
    }

    .word {
        font-size: 2rem;
    }

    .tenses {
        font-size: 0.9rem;
    }
}

/* 平板设备 */
@media (max-width: 768px) {
    .word-card {
        min-height: 500px;
        padding: 1.5rem;
    }

    .word {
        font-size: 2.5rem;
    }

    .pic-container {
        height: 30vh;
    }

    /* 移动端导航按钮优化 */
    .control-toggle-btn {
        bottom: 68px;
        right: 15px;
        width: 55px;
        height: 55px;
        opacity: 0.5;
        background-color: #ddd;
    }

    .control-toggle-btn i {
        font-size: 1.8rem;
    }

    /* 表单响应式调整 */
    .content {
        flex-direction: column;
    }

    .word-form,
    .word-list {
        width: 100%;
        margin-bottom: 20px;
    }

    .form-actions {
        flex-direction: column;
    }
}

/* 大屏设备 */
@media (min-width: 1024px) {
    .word-card {
        padding: 2rem;
        min-height: 600px;
    }

    .word {
        font-size: 3rem;
    }

    .phonetic {
        font-size: 1.5rem;
    }

    .definition {
        font-size: 1.2rem;
    }
}


/* 优化图片加载过渡效果 */
.swiper-lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.swiper-lazy-loaded {
    opacity: 1;
}

/* 加载指示器样式 */
.loading-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* 自动发音按钮样式 */
.auto-pronounce-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.auto-pronounce-btn:hover {
    transform: scale(1.05);
}

.auto-pronounce-btn:active {
    transform: scale(0.95);
}

/* 收藏按钮样式 - 修复文字颜色 */
#favoriteBtn {
    display: flex;
    align-items: center;
    gap: 5px;
}

#favoriteBtn.btn-danger {
    color: white !important;
    background-color: #dc3545;
}

#favoriteBtn.btn-outline-secondary {
    color: #6c757d;
    background-color: transparent;
}

/* 例句和翻译容器 */
.example-container {
    margin-top: 1rem;
}

/* 翻译结果样式 */
.example-translation {
    display: none;
    color: #6c757d;
    font-style: italic;
    margin-top: 0.5rem;
    padding-left: 1rem;
    /* border-left: 3px solid #dee2e6; */
}

/* 翻译加载状态 */
.translation-loading {
    color: #6c757d;
    font-style: italic;
    margin-top: 0.5rem;
    padding-left: 1rem;
}

/* 翻译错误状态 */
.translation-loading.text-danger {
    color: #dc3545;
}


/* 搜索框清除按钮样式 */
#clearSearchBtn {
    border-left: 0;
    border-radius: 0;
    z-index: 3;
}

#searchInput {
    border-right: 0;
}

#searchBtn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* --- 关键修复：为图片粘贴区域添加激活状态的样式 --- */
.pic-upload-container {
    cursor: pointer;
    /* 提示用户这里可以点击 */
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.pic-upload-container.active-paste {
    border-color: #0d6efd;
    /* Bootstrap 的主色调蓝色 */
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
    /* 模拟 focus 效果 */
}

/* 在小屏设备上进一步调整左右按钮位置和尺寸，避免遮挡内容或和控制面板冲突 */
@media (max-width: 480px) {
    .swiper-button-next,
    .swiper-button-prev {
        width: 44px;
        height: 44px;
        opacity: 0.5;
    }

    /* 给控制面板留出空间：如果控制面板浮在底部，则左右按钮稍微上移 */
    .swiper-button-next,
    .swiper-button-prev {
        top: 46%;
    }

    .swiper-button-prev {
        left: 6px;
    }

    .swiper-button-next {
        right: 6px;
    }
}