/* Windows 11 inspired theme variables */
:root {
    --bg: #f6f7fb;
    --text: #0b1220;
    --muted: #6b7280;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --card-hover: #0b1220;
    --accent: #0ea5e9;
    --glass-bg: rgba(255, 255, 255, .2);
    --glass-border: rgba(255, 255, 255, .35);
    --glass-shadow: 0 18px 60px rgba(0, 0, 0, .18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    overflow: hidden;
}

/* Desktop background */
.desktop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url("https://t.alcy.cc/moe");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: saturate(1.05);
}

/* Back-to-home button */
.top-links {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 1000;
}

.top-link {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    transition: border-color .15s ease, transform .15s ease;
}

.top-link:hover {
    border-color: var(--card-hover);
    transform: translateY(-1px);
}

/* Language toggle styling */
.top-link#langToggle {
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    padding: 0;
    min-width: 28px;
    width: auto;
    padding: 0 6px;
}

.top-link#langToggle:active {
    transform: translateY(0) scale(.95);
}

#langIcon {
    display: block;
    white-space: nowrap;
}

/* Tool window */
.tool-window {
    position: fixed;
    z-index: 500;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass-bg);
    box-shadow: var(--glass-shadow), inset 0 0 0 1px rgba(255, 255, 255, .25);
    overflow: hidden;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

/* Window title bar */
.window-titlebar {
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    user-select: none;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.window-title {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

/* Window content */
.window-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: transparent;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.subtitle {
    color: var(--muted);
    text-align: center;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Loading animation */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: var(--muted);
    font-size: 14px;
}

/* Options panel */
.options-panel {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

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

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--card-border);
    border-radius: 12px;
    transition: background .3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform .3s ease;
}

.toggle-option input[type="checkbox"]:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-option input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    color: var(--text);
    font-size: 14px;
}

/* Upload area */
.upload-area {
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.upload-area:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    border-color: var(--accent);
}

.upload-area.dragover {
    background: rgba(14, 165, 233, .1);
    border-color: var(--accent);
}

.upload-area input[type="file"] {
    display: none;
}

.upload-area label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-area svg {
    color: var(--accent);
}

.upload-area span {
    color: var(--muted);
    font-size: 14px;
}

/* Progress bar */
.progress-container {
    margin: 20px 0;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text);
}

.progress-bar {
    height: 8px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #06b6d4 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Bulk action buttons */
.batch-actions {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.download-all-btn,
.clear-all-btn {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .15s ease;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.download-all-btn:hover,
.clear-all-btn:hover {
    border-color: var(--card-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.download-all-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
    border: none;
    color: white;
}

.clear-all-btn {
    background: rgba(239, 68, 68, .1);
    border-color: rgba(239, 68, 68, .3);
    color: #dc2626;
}

/* Preview grid */
.preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.preview-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    transition: all .15s ease;
}

.preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    border-color: var(--card-hover);
}

.preview-images {
    display: flex;
    justify-content: space-around;
    margin-bottom: 12px;
    gap: 8px;
}

.preview-images > div {
    text-align: center;
    flex: 1;
}

.preview-images img {
    width: 100%;
    max-width: 128px;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

.preview-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

.file-info {
    margin-bottom: 10px;
}

.file-name {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-all;
}

.file-size {
    font-size: 12px;
    color: var(--muted);
}

.size-reduction {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.download-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s ease;
}

.download-btn:hover {
    background: #0284c7;
    transform: translateY(-1px);
}

/* Scrollbar styling */
.window-content::-webkit-scrollbar {
    width: 8px;
}

.window-content::-webkit-scrollbar-track {
    background: transparent;
}

.window-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .2);
    border-radius: 4px;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, .3);
}

/* Duplicate detection styles */
.section-header {
    grid-column: 1 / -1;
    margin: 20px 0 10px 0;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.section-header h2 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: var(--text);
}

.section-header p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.duplicate-section {
    border-color: rgba(239, 68, 68, .3);
    background: rgba(239, 68, 68, .05);
}

.unique-section {
    border-color: rgba(16, 185, 129, .3);
    background: rgba(16, 185, 129, .05);
}

.duplicate-warning {
    padding: 6px 10px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .3);
    border-radius: 6px;
    color: #dc2626;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

.duplicate-alert {
    margin: 16px 0;
    padding: 12px 16px;
    background: rgba(251, 146, 60, .1);
    border: 1px solid rgba(251, 146, 60, .3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
}

.duplicate-alert span {
    color: #ea580c;
    font-size: 14px;
}

.auto-remove-btn {
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    background: var(--glass-bg);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s ease;
    backdrop-filter: saturate(1.8) blur(22px);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    white-space: nowrap;
}

.auto-remove-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.delete-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(239, 68, 68, .3);
    border-radius: 6px;
    background: rgba(239, 68, 68, .1);
    color: #dc2626;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s ease;
}

.delete-btn:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* Responsive design */
@media (max-width: 768px) {
    .tool-window {
        width: 95vw;
        max-height: 95vh;
    }
    
    .preview {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .duplicate-alert {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auto-remove-btn {
        width: 100%;
    }
}
