/* ============================================================
   AI 去水印工具 - 样式表
   ============================================================ */

/* CSS Reset & Variables */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #4F46E5;
    --color-primary-light: #818CF8;
    --color-primary-dark: #3730A3;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-bg: #F9FAFB;
    --color-surface: #FFFFFF;
    --color-border: #E5E7EB;
    --color-text: #1F2937;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Header
   ============================================================ */

.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.75rem;
}

.header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-free { background: #ECFDF5; color: var(--color-success); }
.badge-private { background: #EFF6FF; color: #3B82F6; }
.badge-no-server { background: #FDF4FF; color: #A855F7; }

/* ============================================================
   Main Container
   ============================================================ */

.main-container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ============================================================
   Upload Area
   ============================================================ */

.upload-area {
    width: 100%;
    max-width: 600px;
    min-height: 300px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--color-surface);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--color-primary);
    background: #EEF2FF;
}

.upload-content {
    text-align: center;
    padding: 40px;
}

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

.upload-text {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.upload-text .link {
    color: var(--color-primary);
    text-decoration: underline;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
}

/* ============================================================
   Image Container & Canvas
   ============================================================ */

.image-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.canvas-stack {
    position: relative;
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #000;
}

.canvas-stack canvas {
    display: block;
    max-width: 100%;
}

#mainCanvas {
    position: relative;
    z-index: 1;
}

#maskCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    opacity: 0.5;
    pointer-events: none;
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    cursor: crosshair;
}

.image-info-bar {
    display: flex;
    gap: 24px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* ============================================================
   Toolbar
   ============================================================ */

.toolbar {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-buttons {
    display: flex;
    gap: 6px;
}

.tool-btn {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.tool-btn:hover {
    border-color: var(--color-primary-light);
    background: #F5F5FF;
}

.tool-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Slider */

.slider {
    width: 140px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    color: var(--color-primary);
    font-weight: 600;
}

/* Method Select */

.method-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.method-select:focus {
    border-color: var(--color-primary);
}

/* Action Buttons */

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-primary {
    background: var(--color-primary);
    color: white;
}

.action-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.action-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.action-secondary:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-text-tertiary);
}

/* ============================================================
   Result Section
   ============================================================ */

.result-section {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

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

.result-header h2 {
    font-size: 1.25rem;
}

.result-canvas-wrapper {
    max-width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

#resultCanvas {
    display: block;
    max-width: 100%;
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   Status Bar
   ============================================================ */

.status-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-border);
    color: var(--color-text-secondary);
}

.status-badge.status-ready {
    background: #ECFDF5;
    color: var(--color-success);
}

.status-badge.status-warning {
    background: #FEF3C7;
    color: var(--color-warning);
}

/* ============================================================
   Progress Overlay
   ============================================================ */

.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.progress-content {
    background: var(--color-surface);
    padding: 32px 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

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

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ============================================================
   Loading Overlay
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.loading-content {
    text-align: center;
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-info { background: #EFF6FF; color: #1E40AF; }
.toast-success { background: #ECFDF5; color: #065F46; }
.toast-error { background: #FEF2F2; color: #991B1B; }
.toast-warning { background: #FEF3C7; color: #92400E; }

/* ============================================================
   Footer
   ============================================================ */

.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.footer-tech {
    margin-top: 4px;
    font-size: 0.8rem;
}

.footer-tech a {
    color: var(--color-primary);
    text-decoration: none;
}

.footer-tech a:hover {
    text-decoration: underline;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-buttons {
        justify-content: center;
    }

    .result-actions {
        justify-content: center;
    }
}
