/* ============================================
   元宝水印去除工具 - 样式表
   ============================================ */

:root {
    /* Color Palette - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161e;
    --bg-hover: #1e1e28;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.3);

    /* Status Colors */
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.3);
    --warning: #f59e0b;
    --error: #ef4444;

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Border Colors */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.header-badge {
    display: flex;
    gap: var(--spacing-sm);
}

.badge {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* ============================================
   Upload Section
   ============================================ */
.upload-section {
    margin-bottom: var(--spacing-xl);
}

.drop-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    background: var(--bg-card);
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 0.05;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-primary);
    margin-bottom: var(--spacing-md);
    opacity: 0.8;
}

.drop-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.browse-link {
    color: var(--accent-primary);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.drop-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   Options Section
   ============================================ */
.options-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeIn var(--transition-slow) ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal);
}

.option-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.option-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-md);
}

.option-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.radio-option:hover {
    background: var(--bg-hover);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all var(--transition-fast);
}

.radio-option input:checked+.radio-custom {
    border-color: var(--accent-primary);
}

.radio-option input:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-label strong {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.radio-label small {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Position Grid */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
    max-width: 150px;
}

.pos-btn {
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pos-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.pos-btn.active {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Slider */
.slider-container {
    padding: var(--spacing-sm) 0;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--accent-glow);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.slider-labels span:nth-child(2) {
    color: var(--accent-primary);
    font-weight: 600;
}

/* ============================================
   Preview Section
   ============================================ */
.preview-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeIn var(--transition-slow) ease;
}

.preview-container {
    display: flex;
    gap: var(--spacing-lg);
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.preview-header {
    margin-bottom: var(--spacing-md);
}

.preview-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.preview-image {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
}

.preview-image canvas {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.preview-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 var(--spacing-sm);
}

.divider-line {
    width: 1px;
    flex: 1;
    background: var(--border-color);
}

.divider-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
    margin: var(--spacing-md) 0;
}

/* ============================================
   Buttons
   ============================================ */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 0 20px var(--success-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--success-glow);
}

/* ============================================
   Batch Section
   ============================================ */
.batch-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeIn var(--transition-slow) ease;
}

.batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.batch-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.batch-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.batch-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.batch-item-info {
    padding: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.batch-actions {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-lg);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    margin-top: auto;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
}

.footer-links a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-secondary);
}

.footer-links .divider {
    color: var(--border-color);
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn var(--transition-normal) ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-body h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.modal-body pre {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

.modal-body code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.875rem;
    color: var(--accent-primary);
}

.modal-body ul {
    list-style: none;
    margin: var(--spacing-md) 0;
}

.modal-body li {
    padding: var(--spacing-xs) 0;
    color: var(--text-secondary);
}

.algorithm-cards {
    display: grid;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.algo-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
}

.algo-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.algo-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    .preview-container {
        flex-direction: column;
    }

    .preview-divider {
        flex-direction: row;
        padding: var(--spacing-sm) 0;
    }

    .divider-line {
        width: auto;
        height: 1px;
        flex: 1;
    }

    .divider-icon {
        transform: rotate(90deg);
        margin: 0 var(--spacing-md);
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   拖拽提示和水印覆盖层
   ============================================ */
.drag-hint {
    text-align: center;
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 可拖拽的水印覆盖层 */
.watermark-overlay {
    position: absolute;
    border: 2px dashed #ff5050;
    background: rgba(255, 80, 80, 0.25);
    cursor: move;
    display: none;
    z-index: 10;
    box-sizing: border-box;
    pointer-events: auto;
}

.watermark-overlay::before {
    content: '水印区域';
    position: absolute;
    left: 0;
    top: -20px;
    font-size: 11px;
    color: #ff5050;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 调整大小的手柄 */
.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ff5050;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 11;
    transition: transform 0.15s ease;
}

.resize-handle:hover {
    transform: scale(1.3);
    background: #ff3030;
}

.resize-nw {
    left: -7px;
    top: -7px;
    cursor: nw-resize;
}

.resize-ne {
    right: -7px;
    top: -7px;
    cursor: ne-resize;
}

.resize-sw {
    left: -7px;
    bottom: -7px;
    cursor: sw-resize;
}

.resize-se {
    right: -7px;
    bottom: -7px;
    cursor: se-resize;
}
