/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 导航栏样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo a {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.nav-menu ul {
    display: flex;
    list-style: none;
}

.nav-menu li a {
    padding: 0 15px;
    color: #333;
    text-decoration: none;
}

.nav-menu li a:hover {
    color: #007bff;
}

.nav-right a {
    margin-left: 15px;
    text-decoration: none;
}

.login-btn {
    color: #333;
}

.register-btn {
    color: #fff;
    background-color: #007bff;
    padding: 8px 16px;
    border-radius: 4px;
}

/* 主要内容区样式 */
main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.usage-count {
    text-align: center;
    margin-bottom: 40px;
}

.usage-number {
    color: #007bff;
    font-size: 24px;
    font-weight: bold;
    margin: 0 8px;
}

.tool-container {
    background-color: transparent;
    box-shadow: none;
    padding: 0;
}

.editor-wrapper {
    display: flex;
    gap: 20px;
}

/* 上传预览区域样式 */
.upload-preview {
    flex: 1;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.drop-zone {
    flex: 1;
    width: 100%;
    min-height: 400px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.3s;
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

.drop-zone:hover {
    border-color: #007bff;
}

.upload-hint {
    text-align: center;
    color: #666;
    padding: 20px;
}

.upload-hint svg {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    color: #999;
}

.upload-hint p {
    font-size: 16px;
    margin-top: 10px;
}

/* 控制面板样式 */
.control-panel {
    width: 300px;
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-self: flex-start;
}

.control-section {
    margin-bottom: 24px;
}

.control-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
    color: #333;
}

.watermark-type {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.watermark-type button {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.watermark-type button.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.control-item {
    margin-bottom: 16px;
}

.control-item label {
    display: block;
    margin-bottom: 8px;
    color: #666;
}

.control-item input[type="text"],
.control-item input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.control-item input[type="range"] {
    width: calc(100% - 50px);
    vertical-align: middle;
}

.control-item .value {
    display: inline-block;
    width: 45px;
    text-align: right;
    color: #666;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.position-grid button {
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
}

.position-grid button:hover {
    background: #f0f0f0;
}

.position-grid button.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.primary-btn,
.secondary-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.primary-btn {
    background: #007bff;
    color: #fff;
}

.secondary-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
}

.primary-btn:hover {
    background: #0056b3;
}

.secondary-btn:hover {
    background: #e9ecef;
}

/* 底部版权样式 */
.footer {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    margin-top: 40px;
}

.footer-content p {
    color: #666;
    margin: 5px 0;
}

.footer-content a {
    color: #666;
    text-decoration: none;
}

.footer-content a:hover {
    color: #007bff;
}

/* 添加画布样式 */
#previewCanvas {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 添加平铺选项样式 */
.tile-options {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
}

.tile-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tile-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.tile-settings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.tile-settings .control-item {
    margin-bottom: 12px;
}

.tile-settings .control-item:last-child {
    margin-bottom: 0;
}

/* 添加按钮容器样式 */
.preview-actions {
    display: flex;
    gap: 10px;
    padding: 0 10px;
}

.preview-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

.preview-actions .primary-btn {
    background: #007bff;
    color: #fff;
}

.preview-actions .secondary-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
}

.preview-actions .primary-btn:hover {
    background: #0056b3;
}

.preview-actions .secondary-btn:hover {
    background: #e9ecef;
}

/* 添加批量上传相关样式 */
.upload-sub-hint {
    font-size: 14px;
    color: #999;
    margin-top: 5px;
}

.batch-progress {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-top: -10px;
}

.progress-text {
    text-align: center;
    margin-bottom: 10px;
    color: #666;
}

.progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007bff;
    width: 0;
    transition: width 0.3s ease;
}

/* 修改下载按钮在批量处理时的样式 */
.preview-actions .primary-btn.processing {
    background: #6c757d;
    cursor: not-allowed;
}

/* 添加缩略图相关样式 */
.thumbnails-container {
    margin-top: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.thumbnails-header h3 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.image-count {
    color: #666;
    font-size: 14px;
}

.thumbnails-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 160px;
    overflow-y: auto;
    padding: 5px;
}

.thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail-item.active {
    border-color: #007bff;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-item:hover .remove-btn {
    opacity: 1;
}

/* 修改滚动条样式 */
.thumbnails-list::-webkit-scrollbar {
    width: 6px;
}

.thumbnails-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.thumbnails-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.thumbnails-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 添加移动端响应式样式 */
@media screen and (max-width: 768px) {
    /* 导航栏适配 */
    .nav-menu {
        display: none; /* 在移动端隐藏菜单 */
    }

    .nav-content {
        padding: 0 10px;
    }

    /* 主要内容区适配 */
    main {
        padding: 0 10px;
        margin: 20px auto;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .usage-count {
        margin-bottom: 20px;
    }

    /* 编辑器布局调整 */
    .editor-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    /* 预览区域适配 */
    .upload-preview {
        padding: 10px;
        min-height: auto;
    }

    .drop-zone {
        min-height: 300px;
    }

    .upload-hint svg {
        width: 48px;
        height: 48px;
    }

    .upload-hint p {
        font-size: 14px;
    }

    /* 缩略图列表适配 */
    .thumbnails-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        max-height: 120px;
    }

    /* 控制面板适配 */
    .control-panel {
        width: 100%;
        padding: 15px;
    }

    .control-section {
        margin-bottom: 15px;
    }

    .control-section h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }

    /* 水印类型按钮适配 */
    .watermark-type button {
        padding: 6px;
        font-size: 14px;
    }

    /* 控制项适配 */
    .control-item {
        margin-bottom: 12px;
    }

    .control-item label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .control-item input[type="text"],
    .control-item input[type="file"] {
        padding: 6px;
        font-size: 14px;
    }

    /* 位置网格适配 */
    .position-grid button {
        padding: 6px;
        font-size: 12px;
    }

    /* 平铺选项适配 */
    .tile-options {
        padding: 8px;
    }

    .tile-options label {
        font-size: 14px;
    }

    /* 按钮适配 */
    .preview-actions {
        padding: 0;
    }

    .preview-actions button {
        padding: 10px;
        font-size: 14px;
    }

    /* 进度条适配 */
    .batch-progress {
        padding: 10px;
        margin-top: -5px;
    }

    .progress-text {
        font-size: 14px;
    }

    /* 底部版权适配 */
    .footer {
        padding: 15px;
        margin-top: 20px;
    }

    .footer-content p {
        font-size: 12px;
    }
}

/* 添加更小屏幕的适配 */
@media screen and (max-width: 480px) {
    .nav-right {
        display: flex;
        gap: 8px;
    }

    .nav-right a {
        padding: 6px 12px;
        font-size: 14px;
    }

    .drop-zone {
        min-height: 250px;
    }

    .thumbnails-list {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        max-height: 100px;
    }

    .control-item input[type="range"] {
        width: calc(100% - 40px);
    }

    .control-item .value {
        width: 35px;
        font-size: 12px;
    }

    .position-grid {
        gap: 3px;
    }

    .position-grid button {
        padding: 5px;
        font-size: 11px;
    }
}

/* 添加横屏模式适配 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .editor-wrapper {
        flex-direction: row;
    }

    .upload-preview {
        flex: 2;
    }

    .control-panel {
        flex: 1;
        min-width: 250px;
    }

    .drop-zone {
        min-height: 200px;
    }
}

/* 优化触摸交互 */
@media (hover: none) and (pointer: coarse) {
    /* 增大可点击区域 */
    .control-item input[type="range"],
    .control-item input[type="checkbox"],
    .position-grid button,
    .watermark-type button {
        min-height: 44px;
    }

    /* 显示删除按钮 */
    .thumbnail-item .remove-btn {
        opacity: 1;
        width: 24px;
        height: 24px;
    }

    /* 调整滑块样式 */
    input[type="range"] {
        -webkit-appearance: none;
        height: 24px;
        background: transparent;
    }

    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 24px;
        height: 24px;
        background: #007bff;
        border-radius: 50%;
        border: none;
    }

    /* 调整颜色选择器 */
    input[type="color"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* 添加汉堡菜单按钮样式 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #333;
}

@media screen and (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-menu.active {
        display: block;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #fff;
        padding: 10px 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .nav-menu.active ul {
        flex-direction: column;
    }

    .nav-menu.active li {
        padding: 10px 20px;
    }

    .nav-menu.active li a {
        display: block;
        padding: 5px 0;
    }
}

.ad-section {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.ad-wrapper {
    width: 100%;
}

.ad-placeholder {
    border: 1px dashed #ccc;
    padding: 40px;
    border-radius: 4px;
    text-align: center;
    color: #666;
    font-size: 14px;
    background-color: #fff;
}