/* 图片略缩图样式 */
.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin: 5px;
    cursor: pointer;
    border-radius: var(--radius-base);
}

/* 图片容器样式 */
.img-wrapper {
    position: relative;
    display: inline-block;
}

/* 删除按钮样式 */
.delete-btn {
    width: 24px;
    height: 24px;
    position: absolute;
    top: 0;
    right: 0;
    background-color: red;
    color: white;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* 裁剪区域 */
.list-content {
    margin-top: 24px;
    display: flex;
    flex-direction: row;
    padding: 16px;
    gap: 24px;
    background-color: var(--color-inner);
    border-radius: var(--radius-base);
    align-items: flex-start;
    overflow: hidden;
}

.resizer-content {
    margin-top: 24px;
    display: flex;
    flex-direction: row;
    padding: 16px;
    gap: 24px;
    /* background-color: var(--color-inner); */
    border-radius: var(--radius-base);
}

.copper-left {
    flex: 0 0 300px;
    min-width: 300px;
    gap: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.copper-right {
    flex: 1 1 auto;
    min-width: 0;
    /* 防止内部内容把右侧撑爆 */
    gap: 16px;
    position: relative;
}

.copper-action {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.copper-action .action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 130px;
    height: 90px;
    padding: 20px;
    cursor: pointer;
    color: var(--color-text);
    transition: all 0.3s ease;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-base);
    /* allow children to shrink correctly inside flex containers */
    min-width: 0;
}

.copper-action .action-item:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: rgba(86, 103, 242, 0.1);
}
/* 保证 icon 与文字布局合理，图标与文本分别处理，文本单行且超出省略 */
.copper-action .action-item .icon {
    display: block;
    flex: none;
}

.copper-action .action-item .icon i {
    display: inline-block;
}

.copper-action .action-item .text {
    display: block;
    width: 100%;
    box-sizing: border-box;
    /* 单行且超出省略 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.copper-btn-group{
    gap: 16px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.copper-content img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* 当 cropperjs 注入 .cropper-container 时，限制其不超出我们容器 */
.copper-content .cropper-container {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* 质量滑杆的表现稍微美化一下（保持简洁） */
#download-quality {
    width: 160px;
    background-color: var(--color-primary);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

#cropper-buttons {
    display: none;
    /* 初始时不显示按钮 */
}

#btn-save-crop,
#btn-cancel-crop {
    margin-left: 10px;
    padding: 8px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    transition: background-color 0.3s;
}

#btn-save-crop:hover {
    background-color: #4CAF50;
}

#btn-cancel-crop:hover {
    background-color: #f44336;
}

/* 图片列表样式 */
.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
}

.image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: var(--color-border-light);
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-item.active {
    border-color:var(--color-primary);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.image-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 25px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .image-overlay {
    opacity: 1;
}

.btn-delete {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.image-name {
    padding: 6px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: white;
}

/* 预览区域样式 */
#resizer-content {
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-inner);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 裁剪按钮样式 */
#cropper-buttons {
    z-index: 1000;
    display: flex;
    gap: 8px;
}

#btn-save-crop,
#btn-cancel-crop {
    width: 40px;
    height: 40px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#btn-save-crop:hover {
    background-color: #45a049 !important;
    transform: scale(1.1);
}

#btn-cancel-crop:hover {
    background-color: #da190b !important;
    transform: scale(1.1);
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 9999;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .resizer-content{
        flex-direction: column;
    }
    .copper-left{
        flex: 0;
    }
    .image-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .image-item img {
        height: 80px;
    }

    #resizer-content {
        height: 300px;
    }
}

/* 折叠菜单样式 */
.actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.actions-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 8px;
}

.actions.collapsed .actions-group {
    /* 当 collapsed 时隐藏原始 groups，以便使用下拉菜单替代 */
    display: none;
}

.actions-dropdown {
    position: absolute;
    right: 8px;
    top: 100%;
    background: var(--color-inner);
    border: 1px solid var(--color-border-light);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-radius: 6px;
    padding: 8px;
    z-index: 1200;
    min-width: 200px;
}

.actions-dropdown .actions-group-dropdown {
    padding: 6px 8px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.actions-dropdown a {
    display: inline-block;
}

/* 更小屏时让下拉变为全宽 */
@media (max-width: 420px) {
    .actions-dropdown {
        right: 0;
        left: 0;
        min-width: auto;
        border-radius: 0;
    }
}