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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden; /* 防止水平滚动 */
    width: 100%;
    max-width: 100vw;
}

#app {
    min-height: 100vh;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
}

/* 防止移动端输入框自动放大 - 确保字体大小至少16px */
input, textarea, select, button {
    font-size: 16px !important;
}

.el-input__inner,
.el-textarea__inner,
.el-select__input,
.el-input input,
.el-textarea textarea {
    font-size: 16px !important;
}

/* 防止内容溢出的通用规则 */
.container, .main-content, .search-panel, .el-row, .el-col {
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
}

/* 主容器 */
.main-container {
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #e4e7ed;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.footer{
text-align: center;
font-size: 13px;
}
.footer a{
text-decoration: none;
color: #606266;
padding-block-start: 7px;
    display: inline-block;
}
.title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #303133;
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-actions .el-button {
    white-space: nowrap;
    flex-shrink: 0;
}

.badge {
    flex-shrink: 0;
}

.admin-entry {
    flex-shrink: 0;
}

.badge {
    margin-left: 10px;
}

/* 管理员入口 */
.admin-entry {
    position: relative;
}

.admin-login-dialog .el-dialog__body {
    padding: 30px;
}

.admin-login-form {
    max-width: 400px;
    margin: 0 auto;
}

.admin-login-form .el-form-item {
    margin-bottom: 20px;
}

.admin-login-form .el-button {
    width: 100%;
}

/* 主内容区域 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 搜索标签页 */
.search-tabs {
    margin-bottom: 0;
}

.search-tabs .el-tabs__header {
    margin-bottom: 0;
    background: #f5f7fa;
    padding: 10px 20px 0;
    border-radius: 12px 12px 0 0;
}

.search-tabs .el-tabs__nav-wrap::after {
    display: none;
}

.search-tabs .el-tabs__item {
    font-size: 16px;
    font-weight: 500;
    padding: 0 30px;
    height: 50px;
    line-height: 50px;
    color: #606266;
}

.search-tabs .el-tabs__item.is-active {
    color: #409eff;
    font-weight: 600;
}

.search-tabs .el-tabs__item:hover {
    color: #409eff;
}

.search-tabs .el-tabs__active-bar {
    height: 3px;
    background: #409eff;
}

.tab-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-label .el-icon {
    font-size: 18px;
}

.tab-content {
    padding: 30px 20px 20px;
}

/* 搜索面板 */
.search-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    position: relative;
    overflow: visible;
}

/* 搜索输入框 */
.search-input {
    margin-bottom: 20px;
}

.search-input .el-input__inner {
    border-radius: 25px;
    padding-left: 20px;
}

.search-input .el-input-group__append {
    border-radius: 0 25px 25px 0;
}

/* 文件名搜索输入框 */
.filename-search-input {
    margin-bottom: 20px;
}

.filename-search-input .el-input__wrapper {
    border-radius: 25px 0 0 25px;
}

.filename-search-input .el-input__inner {
    font-size: 16px;
}

.filename-search-input .el-input-group__append {
    border-radius: 0 25px 25px 0;
    background: #409eff;
    border-color: #409eff;
}

.filename-search-input .el-input-group__append .el-button {
    color: white;
    border: none;
    background: transparent;
}

.filename-search-input .el-input-group__append .el-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 搜索选项 */
.search-options {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
    clear: both;
}

.search-options .el-form-item {
    margin-bottom: 0;
}

.search-options .el-form-item__label {
    font-size: 14px;
    color: #606266;
    font-weight: 500;
}

.search-options .el-row {
    align-items: center;
}

.search-options-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.search-options-form .el-form-item {
    margin-bottom: 0;
    margin-right: 0;
}

/* 搜索选项组件样式 */
.search-limit-select {
    width: 100px;
}

.threshold-form-item {
    margin-left: 20px;
}

.threshold-slider {
    width: 150px;
}

/* 管理员登录对话框 */
.admin-login-dialog {
    width: 400px;
    max-width: 90vw;
}

/* 上传区域 */
.upload-area {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.upload-preview {
    height: 300px;
    border: 2px dashed #dcdfe6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

.preview-image {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.preview-placeholder {
    text-align: center;
    color: #909399;
}

.preview-placeholder .el-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.search-actions {
    margin-top: 20px;
    text-align: center;
}

/* 结果区域 */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e4e7ed;
}

.results-header h3 {
    color: #303133;
    font-size: 18px;
    font-weight: 600;
}

/* 结果网格 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* PC端一行3列 */
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.result-item {
    transition: transform 0.3s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* 允许flex项目收缩 */
    overflow: hidden;
}

.result-item:hover {
    transform: translateY(-5px);
}

.result-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    width: 100%;
    max-width: 100%;
}

.result-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.result-image-wrapper {
    width: 100%;
    max-width: 100%;
    height: 200px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    position: relative;
}

.result-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.result-image-wrapper:hover .result-image {
    transform: scale(1.05);
}

.result-info {
    padding: 15px;
}

.result-score {
    font-size: 14px;
    color: #409eff;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-filename {
    font-size: 12px;
    color: #909399;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 底部 */
.footer {
    text-align: center;
    color: #909399;
    /*background: rgba(255, 255, 255, 0.8);*/
    /*border-top: 1px solid #e4e7ed;*/
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 强制防止水平滚动 */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    #app, .main-container, .main-content, .search-panel, .results-section {
        overflow-x: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        gap: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .title {
        font-size: 16px;
        text-align: left;
        margin-bottom: 0;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        justify-content: flex-end;
        flex: 1;
        min-width: 0;
    }

    .header-actions .el-button {
        font-size: 10px;
        padding: 3px 6px;
        white-space: nowrap;
        min-width: auto;
    }

    .badge {
        flex-shrink: 0;
    }

    .badge .el-button {
        font-size: 10px;
        padding: 3px 5px;
        min-width: auto;
    }

    .admin-entry {
        flex-shrink: 0;
    }

    .admin-entry .el-button {
        font-size: 10px;
        padding: 3px 6px;
        min-width: auto;
    }

    .main-content {
        padding: 15px;
        overflow-x: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .search-panel {
        padding: 15px;
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .results-section {
        padding: 15px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr); /* 手机端一行2列 */
        gap: 10px;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }

    .result-item {
        max-width: 100%;
        width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .result-card {
        max-width: 100%;
        width: 100%;
    }

    .result-image-wrapper {
        max-width: 100%;
        width: 100%;
    }

    .result-image {
        max-width: 100%;
        width: 100%;
    }

    .upload-preview {
        height: 200px;
        margin-bottom: 20px;
        max-width: 100%;
        width: 100%;
    }

    /* 修复搜索选项布局 */
    .search-options {
        padding: 15px;
        margin-top: 15px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* 确保 Element UI 组件不溢出 */
    .el-row {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .el-col {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .el-card {
        max-width: 100% !important;
        width: 100% !important;
    }

    .el-image {
        max-width: 100% !important;
        width: 100% !important;
    }

    .search-options-form {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        width: 100%;
    }

    .search-options-form .el-form-item {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 0;
    }

    .search-options-form .el-form-item__label {
        width: auto !important;
        margin-bottom: 5px;
        display: block;
    }

    .search-options-form .el-form-item__content {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .search-options-form .el-select,
    .search-options-form .el-slider {
        width: 100% !important;
    }

    /* 移动端搜索选项样式覆盖 */
    .search-limit-select {
        width: 100% !important;
    }

    .threshold-form-item {
        margin-left: 0 !important;
    }

    .threshold-slider {
        width: 100% !important;
    }

    /* 移动端对话框 */
    .admin-login-dialog {
        width: 95vw !important;
        max-width: 95vw !important;
    }

    /* 修复上传区域布局 */
    .upload-area {
        margin-top: 15px;
    }

    .upload-area .el-upload {
        width: 100%;
    }

    .upload-area .el-upload-dragger {
        width: 100%;
        height: auto;
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }

    .search-panel {
        padding: 10px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr); /* 小屏幕手机端保持2列 */
        gap: 8px;
    }

    .header-content {
        padding: 10px 12px;
        gap: 10px;
    }

    .title {
        font-size: 16px;
    }

    .header-actions {
        justify-content: center;
        gap: 5px;
        width: 100%;
    }

    .header-actions .el-button {
        font-size: 10px;
        padding: 4px 6px;
        min-width: auto;
    }

    .badge .el-button {
        font-size: 10px;
        padding: 3px 5px;
    }

    .admin-entry .el-button {
        font-size: 10px;
        padding: 4px 6px;
    }

    /* 进一步优化小屏幕布局 */
    .search-options {
        padding: 10px;
    }

    .search-options-form {
        gap: 12px;
    }

    .upload-preview {
        height: 150px;
        margin-bottom: 15px;
    }

    .upload-area .el-upload-dragger {
        min-height: 100px;
        padding: 20px 10px;
    }

    /* 修复按钮重叠问题 */
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .results-header h3 {
        margin-bottom: 0;
        text-align: center;
    }

    .results-header .el-button {
        width: 100%;
    }

    /* 修复Element UI组件在移动端的显示问题 */
    .el-tabs__nav-wrap {
        overflow-x: auto;
    }

    .el-tabs__item {
        padding: 0 10px !important;
        font-size: 14px;
        height: 45px !important;
        line-height: 45px !important;
    }

    .search-tabs .el-tabs__header {
        padding: 5px 10px 0;
    }

    .search-tabs .el-tabs__item {
        padding: 0 15px !important;
        font-size: 14px;
    }

    .tab-label {
        gap: 5px;
    }

    .tab-label .el-icon {
        font-size: 16px;
    }

    .tab-content {
        padding: 20px 10px 10px;
    }

    .el-input {
        width: 100% !important;
    }

    .el-input__inner {
        font-size: 14px;
    }

    .el-button {
        font-size: 14px;
        padding: 8px 15px;
    }

    .el-upload-dragger {
        width: 100% !important;
    }
}

/* 超小屏幕优化 (320px - 375px) */
@media (max-width: 375px) {
    .main-content {
        padding: 8px;
    }

    .search-panel {
        padding: 8px;
        margin-bottom: 15px;
    }

    .search-options {
        padding: 8px;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr; /* 确保两列布局 */
        gap: 6px;
    }

    .result-item {
        min-width: 0; /* 允许flex项目收缩 */
    }

    .result-item img {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    .title {
        font-size: 15px;
        text-align: center;
    }

    .header-content {
        padding: 8px;
        gap: 8px;
    }

    .header-actions {
        gap: 4px;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .header-actions .el-button {
        font-size: 10px;
        padding: 3px 6px;
        min-width: auto;
        white-space: nowrap;
    }

    .badge .el-button {
        font-size: 10px;
        padding: 3px 5px;
    }

    .admin-entry .el-button {
        font-size: 10px;
        padding: 3px 6px;
    }

    .el-tabs__item {
        padding: 0 8px !important;
        font-size: 13px;
    }

    .el-button {
        font-size: 13px;
        padding: 6px 12px;
    }

    .upload-preview {
        height: 120px;
    }

    /* 防止头部按钮溢出和重叠 */
    .header {
        min-height: auto;
        height: auto;
        padding: 5px 0;
    }

    .header-content {
        min-height: auto;
        height: auto;
    }

    /* 确保徽章数字不会太大 */
    .el-badge__content {
        font-size: 10px !important;
        min-width: 16px !important;
        height: 16px !important;
        line-height: 16px !important;
        padding: 0 4px !important;
    }

    /* 确保所有内容都不会溢出 */
    .search-limit-select,
    .threshold-slider {
        width: 100% !important;
        max-width: 100% !important;
    }

    .threshold-form-item {
        margin-left: 0 !important;
    }

    /* 修复可能的文本溢出 */
    .el-form-item__label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }

    /* 确保图片结果不会溢出 */
    .result-item {
        overflow: hidden;
    }

    .result-item .el-image {
        width: 100% !important;
        height: auto !important;
    }

    /* 修复标签页在小屏幕上的显示 */
    .el-tabs__header {
        margin: 0 0 15px 0;
    }

    .el-tabs__nav {
        width: 100%;
    }
}

/* 针对非常小的屏幕 (iPhone SE等) */
@media (max-width: 320px) {
    .header-content {
        padding: 8px;
        gap: 8px;
    }

    .title {
        font-size: 14px;
    }

    .header-actions {
        gap: 4px;
        justify-content: space-between;
    }

    .header-actions .el-button {
        font-size: 10px;
        padding: 3px 6px;
        min-width: 50px;
    }

    .badge .el-button {
        font-size: 10px;
        padding: 3px 4px;
    }

    .el-badge__content {
        font-size: 9px !important;
        min-width: 14px !important;
        height: 14px !important;
        line-height: 14px !important;
        padding: 0 3px !important;
    }

    /* 确保按钮文字不换行 */
    .header-actions .el-button span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40px;
    }

    /* 确保管理员按钮在小屏幕上的显示 */
    .admin-entry .el-button {
        min-width: 45px !important;
    }

    /* 防止徽章内容溢出 */
    .badge .el-button {
        max-width: 60px;
        overflow: hidden;
    }

    .badge .el-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* 图片查看器 */
.image-viewer-dialog {
    background: rgba(0, 0, 0, 0.95);
}

.image-viewer-dialog .el-dialog__body {
    padding: 0;
    height: 100vh;
}

.image-viewer-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-viewer-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 关闭按钮 */
.viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    color: white;
}

.viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 图片信息 */
.viewer-info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    z-index: 10;
}

.viewer-filename {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-score {
    color: #67c23a;
    font-weight: bold;
}

/* 主图片 */
.viewer-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 80px;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
}

/* 导航按钮 */
.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    color: white;
}

.viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.viewer-nav-prev {
    left: 20px;
}

.viewer-nav-next {
    right: 20px;
}

/* 缩略图列表 */
.viewer-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    max-width: 90%;
    overflow-x: auto;
    z-index: 10;
}

.viewer-thumbnail {
    width: 80px;
    height: 80px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.viewer-thumbnail:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.viewer-thumbnail.active {
    border-color: #409eff;
    box-shadow: 0 0 10px rgba(64, 158, 255, 0.5);
}

.viewer-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 图片查看器移动端适配 */
@media (max-width: 768px) {
    .viewer-info {
        flex-direction: column;
        gap: 5px;
        padding: 8px 15px;
        font-size: 12px;
        max-width: 90%;
    }

    .viewer-filename {
        max-width: 200px;
    }

    .viewer-image-wrapper {
        padding: 80px 20px 120px;
    }

    .viewer-nav {
        width: 50px;
        height: 50px;
    }

    .viewer-nav-prev {
        left: 10px;
    }

    .viewer-nav-next {
        right: 10px;
    }

    .viewer-close {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }

    .viewer-thumbnails {
        bottom: 10px;
        padding: 8px;
        gap: 8px;
    }

    .viewer-thumbnail {
        width: 60px;
        height: 60px;
    }
}
