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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 2rem 0;
    text-align: left;
    cursor: pointer;
    border: 2px dashed transparent;
    transition: all 0.3s ease;
    position: relative;
}

.header:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.header.drag-over {
    border-color: rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-text {
    flex: 1;
}

.upload-prompt {
    flex: 1;
    text-align: center;
}

.upload-prompt h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-prompt p {
    opacity: 0.9;
}

#fileInput {
    display: none;
}

.upload-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* padding: 12px 24px; */
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    /* margin-top: 1rem; */
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main {
    padding: 2rem 0;
    flex: 1;
}

/* 横向布局容器 */
.upload-section {
    margin-bottom: 2rem;
}

.components-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

/* 上传区域 */
.upload-area {
    flex: 0 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem 1.5rem;
    text-align: center;
    border: 2px dashed #ddd;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    max-width: 500px;
    min-width: 300px;
}

.upload-area:hover {
    border-color: #28a745;
    transform: translateY(-5px);
}

.upload-area.drag-over {
    border-color: #20c997;
    background-color: rgba(40, 167, 69, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-area h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.upload-area p {
    color: #666;
    margin-bottom: 1.5rem;
}

#fileInput {
    display: none;
}

.upload-btn {
    /* background: linear-gradient(135deg, #28a745 0%, #20c997 100%); */
    background-color: #007bff;
    color: white;
    border: none;
    /* padding: 12px 24px; */
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.upload-btn:hover {
    transform: scale(1.05);
}

/* 设置面板 */
.settings-panel {
    flex: 0 0 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.settings-panel h3 {
    margin-bottom: 1rem;
    color: #333;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    cursor: pointer;
}

.setting-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.setting-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.setting-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
}

.compress-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s ease;
}

.compress-btn:hover {
    transform: scale(1.02);
}

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

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.empty-state p {
    color: #666;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.empty-hint {
    color: #28a745 !important;
    font-weight: 500;
    font-size: 1rem !important;
}

/* 已上传文件区域 */
.uploaded-files {
    flex: 1 1 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.uploaded-files h3 {
    margin-bottom: 1rem;
    color: #333;
}

.files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem;
    position: relative;
    transition: transform 0.2s ease;
    margin-bottom: 0.5rem;
    width: 200px;
}

.file-item:hover {
    transform: translateY(-2px);
}

.file-thumbnail-container {
    margin-bottom: 0.5rem;
}

.file-thumbnail {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
}

.file-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: #6c757d;
}

.file-dimensions {
    font-size: 0.8rem;
    color: #6c757d;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.edit-file-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    flex: 1;
}

.edit-file-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-file:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* 预览区域 */
.preview-section {
    margin-bottom: 2rem;
}

.preview-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.image-card:hover {
    transform: translateY(-5px);
}

.image-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 200px;
    /* background-color: #f8f9fa; */
}

.image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-info {
    padding: 1rem;
}

.image-info h4 {
    margin-bottom: 0.5rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.download-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s ease;
}

.download-btn:hover {
    transform: scale(1.02);
}

.download-all {
    text-align: center;
    margin-top: 2rem;
}

.download-all-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.download-all-btn:hover {
    transform: scale(1.02);
}

/* 页脚 */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.footer p {
    margin-bottom: 0.5rem;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 通知提示 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid #28a745;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification.info {
    border-left: 4px solid #17a2b8;
}

/* 图片预览蒙版 */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow: hidden;
}

.modal-content {
    display: flex;
    width: 100%;
    height: 100%;
    background: transparent;
}

.modal-sidebar {
    width: 320px;
    height: 100%;
    background-color: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
}

.sidebar-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background-color: #f0f0f0;
    color: #333;
}

.sidebar-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-content h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.image-info p {
    margin: 0.5rem 0;
    color: #666;
}

.info-section {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.size-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.size-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    min-width: 50px;
    color: #666;
    font-size: 0.9rem;
}

.input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.apply-size-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: none; /* 隐藏应用尺寸按钮，因为现在使用实时应用 */
}

.apply-size-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.save-section {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.save-and-return-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
}

.save-and-return-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
}

.save-and-return-btn:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    cursor: not-allowed;
    opacity: 0.7;
}

.save-and-return-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.zoom-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.zoom-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #333;
}

.crop-controls-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crop-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: fit-content;
}

.crop-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
}

.crop-controls {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.crop-info p {
    margin: 0 0 1rem 0;
    color: #666;
}

.crop-actions {
    display: flex;
    gap: 0.5rem;
}

.confirm-crop-btn, .cancel-crop-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-crop-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.cancel-crop-btn {
    background: #6c757d;
    color: white;
}

.confirm-crop-btn:hover, .cancel-crop-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.modal-body {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

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

#modalImage {
    display: block;
    /* max-width: 100%;
    max-height: 100%; */
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.crop-area {
    position: absolute;
    border: 2px dashed #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #28a745;
    border: 1px solid white;
}

.crop-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

/* 页脚样式 */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left p,
.footer-right p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.footer-right a {
    color: #28a745;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-right a:hover {
    color: #20c997;
    text-decoration: underline;
}

.footer-right p.author:last-child {
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 70%;
    word-wrap: break-word;
}