/* =====================================================
   图片水印平铺工具 - image_watermark_tile.css
   ===================================================== */

.iwt-container {
    padding: 0 !important;
}

/* ===== Tab 导航 ===== */
.iwt-tab-nav {
    display: flex;
    border-bottom: 2px solid #e8eaf6;
    background: #f8f9ff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.iwt-tab-btn {
    padding: 13px 26px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}

.iwt-tab-btn:hover {
    color: #1976D2;
    background: rgba(25, 118, 210, 0.06);
}

.iwt-tab-btn.active {
    color: #1976D2;
    border-bottom-color: #1976D2;
    font-weight: 600;
}

/* ===== Tab 内容 ===== */
.iwt-tab-content {
    padding: 20px;
}

.iwt-hidden {
    display: none !important;
}

/* ===== 上传区域 ===== */
.iwt-upload-area {
    border: 2px dashed #90CAF9;
    border-radius: 14px;
    padding: 64px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fbff;
    user-select: none;
}

.iwt-upload-area:hover,
.iwt-upload-area.drag-over {
    border-color: #1976D2;
    background: #e3f2fd;
    transform: scale(1.005);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.12);
}

.iwt-upload-icon {
    font-size: 60px;
    margin-bottom: 14px;
    line-height: 1;
}

.iwt-upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.iwt-upload-hint {
    font-size: 13px;
    color: #8a9bb0;
    margin-bottom: 22px;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== 工作区 ===== */
.iwt-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== 图片信息栏 ===== */
.iwt-image-info {
    font-size: 12px;
    color: #5c7080;
    background: linear-gradient(135deg, #f0f4f8 0%, #eaf0f6 100%);
    border: 1px solid #d0dce8;
    border-radius: 8px;
    padding: 7px 16px;
    text-align: center;
    letter-spacing: 0.4px;
    transition: opacity 0.3s;
}

.iwt-image-info span {
    margin: 0 8px;
    display: inline-block;
}

/* ===== 控制面板 ===== */
.iwt-control-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: #f5f7fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

/* 水印类型切换行 */
.iwt-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.iwt-type-btn {
    padding: 6px 16px;
    border: 1px solid #90CAF9;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s;
    font-weight: 500;
}

.iwt-type-btn.active {
    background: #1976D2;
    color: #fff;
    border-color: #1976D2;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
}

.iwt-type-btn:not(.active):hover {
    background: #e3f2fd;
    color: #1976D2;
    border-color: #1976D2;
}

/* 参数区域 */
.iwt-params-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e8eaf0;
}

.iwt-params-shared {
    border-color: #c5cae9;
    background: #f8f9ff;
}

.iwt-param-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.iwt-param-inline {
    flex-direction: row;
}

.iwt-label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    font-weight: 500;
    line-height: 1.8;
}

.iwt-label-gap {
    margin-left: 12px;
}

.iwt-check-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.iwt-slider {
    width: 120px;
    height: 4px;
    cursor: pointer;
    accent-color: #1976D2;
    vertical-align: middle;
}

.iwt-val {
    font-size: 13px;
    font-weight: 700;
    color: #1976D2;
    min-width: 42px;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 12px;
    text-align: center;
}

.iwt-select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.iwt-select:focus {
    border-color: #1976D2;
}

.iwt-color-input {
    width: 32px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: #fff;
    vertical-align: middle;
}

.iwt-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    color: #333;
    line-height: 1.6;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 60px;
}

.iwt-textarea:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.iwt-filename {
    font-size: 13px;
    color: #666;
    font-style: italic;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 操作按钮行 */
.iwt-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
}

/* 快捷预设 */
.iwt-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.iwt-preset-label {
    font-size: 13px;
    color: #777;
    font-weight: 500;
}

.iwt-preset-btn {
    padding: 4px 12px;
    border: 1px solid #90CAF9;
    background: #e3f2fd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    color: #1565C0;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    font-weight: 500;
}

.iwt-preset-btn:hover {
    background: #1976D2;
    color: #fff;
    border-color: #1976D2;
    transform: translateY(-1px);
}

/* 状态栏 */
.iwt-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

.iwt-status-bar.status-success #watermarkStatus {
    color: #388e3c;
    font-weight: 600;
}

.iwt-status-bar.status-error #watermarkStatus {
    color: #c62828;
    font-weight: 600;
}

.iwt-status-bar.status-loading #watermarkStatus {
    color: #1976D2;
}

.iwt-shortcut-hint {
    font-size: 11px;
    color: #aab5c4;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* ===== Canvas 画布区域 ===== */
.iwt-canvas-wrap {
    overflow: auto;
    max-width: 100%;
    border: 2px solid #cdd5e0;
    border-radius: 10px;
    background-color: #f0f0f0;
    background-image:
            linear-gradient(45deg, #c8c8c8 25%, transparent 25%),
            linear-gradient(-45deg, #c8c8c8 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, #c8c8c8 75%),
            linear-gradient(-45deg, transparent 75%, #c8c8c8 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    line-height: 0;
    align-self: center;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    transition: box-shadow 0.2s;
}

.iwt-canvas-wrap:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

#mainCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== AI 区域 ===== */
.iwt-ai-intro {
    padding: 14px 18px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-radius: 10px;
    border-left: 4px solid #43A047;
    margin-bottom: 18px;
    font-size: 14px;
    color: #2e4a2e;
    line-height: 1.6;
}

.iwt-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 4px;
}

.iwt-form-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
}

.iwt-form-row label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.iwt-required {
    color: #e53935;
}

.iwt-char-count {
    font-size: 12px;
    color: #aaa;
    align-self: flex-end;
}

.iwt-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 快捷场景按钮容器 */
.iwt-quick-tips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid #eee;
    margin-bottom: 16px;
}

.iwt-quick-label {
    font-size: 13px;
    color: #777;
    font-weight: 500;
}

.iwt-quick-btn {
    padding: 5px 14px;
    border: 1px solid #90CAF9;
    background: #e3f2fd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    color: #1565C0;
    transition: background 0.25s, color 0.25s, transform 0.25s;
    font-weight: 500;
}

.iwt-quick-btn:hover {
    background: #1976D2;
    color: #fff;
    border-color: #1976D2;
    transform: translateY(-2px);
}

/* 加载动画 */
.iwt-ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: #f5f5f5;
    border-radius: 10px;
    color: #555;
    font-size: 14px;
    margin-top: 10px;
}

.iwt-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #e0e0e0;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: iwtSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes iwtSpin {
    to { transform: rotate(360deg); }
}

/* ===== AI 结果卡片 ===== */
.iwt-ai-result {
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-top: 10px;
}

.iwt-ai-result-title {
    padding: 13px 18px;
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
}

.iwt-ai-result-content {
    padding: 16px;
}

.iwt-ai-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.iwt-ai-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s;
}

.iwt-ai-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.iwt-ai-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.iwt-ai-info {
    flex: 1;
    min-width: 0;
}

.iwt-ai-key {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iwt-ai-val {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* 内联色块 */
.iwt-color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    vertical-align: middle;
}

/* AI配置应用按钮行 */
.iwt-ai-actions {
    padding: 12px 16px;
    border-top: 1px solid #e8e8e8;
    background: #f0f4ff;
    display: flex;
    gap: 10px;
}

/* AI原始回复折叠 */
.iwt-ai-raw-wrap {
    padding: 10px 16px;
    border-top: 1px solid #e0e0e0;
}

.iwt-raw-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 12px;
    padding: 4px 0;
    transition: color 0.2s;
}

.iwt-raw-toggle-btn:hover {
    color: #1976D2;
}

.iwt-ai-raw {
    margin-top: 10px;
    padding: 12px;
    background: #2d2d2d;
    color: #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

/* ===== Toast 通知 ===== */
.iwt-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 11px 28px;
    border-radius: 24px;
    font-size: 14px;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    white-space: nowrap;
    max-width: 88vw;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.iwt-toast.iwt-toast-animate {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.iwt-toast-success  { background: #43A047; }
.iwt-toast-error    { background: #E53935; }
.iwt-toast-warning  { background: #FB8C00; }
.iwt-toast-info     { background: #1976D2; }

/* ===== 响应式适配 ===== */
@media (max-width: 1024px) {
    .iwt-slider { width: 100px; }
}

@media (max-width: 768px) {
    .iwt-ai-grid { grid-template-columns: 1fr; }

    .iwt-tab-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .iwt-upload-area {
        padding: 44px 16px;
    }

    .iwt-upload-icon { font-size: 48px; }
    .iwt-upload-text { font-size: 16px; }
    .iwt-shortcut-hint { display: none; }
    .iwt-label-gap { margin-left: 6px; }
}

@media (max-width: 640px) {
    .iwt-tab-content { padding: 12px 10px; }

    .iwt-control-panel { padding: 10px 12px; gap: 8px; }

    .iwt-action-row .button,
    .iwt-action-row .secondary {
        flex: 1;
        text-align: center;
        min-width: 0;
        font-size: 12px;
        padding: 7px 8px;
    }

    .iwt-upload-area { padding: 36px 14px; }
    .iwt-upload-icon { font-size: 40px; }
    .iwt-upload-text { font-size: 15px; }
    .iwt-upload-hint { font-size: 12px; }
    .iwt-slider { width: 90px; }

    .iwt-toast {
        padding: 10px 16px;
        font-size: 13px;
        bottom: 20px;
    }

    .iwt-quick-tips { gap: 6px; }
    .iwt-quick-btn  { font-size: 11px; padding: 4px 10px; }
}

@media (max-width: 480px) {
    .iwt-tab-btn { padding: 9px 12px; font-size: 12px; }
}
