/* Design System Variables */
:root {
    /* Typography */
    --font-display: 'Outfit', system-ui, sans-serif;
    --font-ui: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;

    /* Backgrounds - deeper for more contrast */
    --bg-base: #0d0d1a;
    --bg-elevated: #141428;
    --bg-surface: #1a1a35;
    --bg-overlay: #22224a;

    /* Primary accent - electric cyan */
    --accent-primary: #00e5ff;
    --accent-primary-dim: rgba(0, 229, 255, 0.15);
    --accent-primary-glow: rgba(0, 229, 255, 0.4);

    /* Secondary accent - vibrant emerald */
    --accent-secondary: #00ff9d;
    --accent-secondary-dim: rgba(0, 255, 157, 0.15);

    /* Danger - warm coral */
    --danger: #ff5277;
    --danger-dim: rgba(255, 82, 119, 0.15);
    --danger-glow: rgba(255, 82, 119, 0.3);

    /* Warning */
    --warning: #ffb347;

    /* Text hierarchy */
    --text-primary: #f0f0ff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;
    --text-disabled: #404060;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 229, 255, 0.3);

    /* Gradients */
    --gradient-brand: linear-gradient(135deg, #00e5ff 0%, #00ff9d 100%);
    --gradient-danger: linear-gradient(135deg, #ff5277 0%, #ff8c47 100%);
    --gradient-surface: linear-gradient(135deg, #1a1a35 0%, #141428 100%);

    /* Animation timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-ui);
    background: linear-gradient(135deg, var(--bg-base) 0%, var(--bg-elevated) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

/* Full-viewport app container */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Subtle noise texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Animations */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(0, 217, 255, 0.4);
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.1);
    }
    50% {
        border-color: rgba(0, 255, 136, 0.4);
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.15);
    }
}

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

/* Compact App Header (visible after scan) */
.app-header {
    flex-shrink: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 0 12px var(--accent-primary-glow));
}

.reset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(0, 217, 255, 0.4);
    color: #00d9ff;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: #00d9ff;
}

.reset-btn svg {
    opacity: 0.8;
}

/* Drop Zone Section (initial state) */
.drop-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.intro-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeSlideUp 0.6s ease-out;
}

.intro-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    filter: drop-shadow(0 0 20px var(--accent-primary-glow));
}

.intro-title::after {
    content: '';
    display: block;
    height: 3px;
    width: 60px;
    margin: 0.75rem auto 0;
    background: var(--gradient-brand);
    border-radius: 2px;
    animation: underlineGrow 0.8s var(--ease-out-expo) 0.3s backwards;
}

@keyframes underlineGrow {
    from { width: 0; opacity: 0; }
    to { width: 60px; opacity: 1; }
}

.intro-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    animation: fadeSlideUp 0.6s ease-out 0.15s backwards;
}

.mode-option {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.mode-option:hover {
    background: rgba(0, 217, 255, 0.05);
    border-color: rgba(0, 217, 255, 0.3);
}

.mode-option:has(input:checked) {
    background: rgba(0, 217, 255, 0.1);
    border-color: #00d9ff;
}

.mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #eee;
    margin-bottom: 0.15rem;
}

.mode-desc {
    font-size: 0.75rem;
    color: #666;
}

.mode-option:has(input:checked) .mode-title {
    color: #00d9ff;
}

/* Threshold Control */
.threshold-control {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: fadeSlideUp 0.6s ease-out 0.2s backwards;
}

.threshold-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #888;
    font-size: 0.85rem;
}

.threshold-control input[type="range"] {
    width: 150px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #00d9ff, #00ff88);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.4);
    transition: transform 0.2s;
}

.threshold-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.threshold-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #00d9ff, #00ff88);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.4);
}

#threshold-value {
    min-width: 100px;
    text-align: right;
    color: #00d9ff;
    font-weight: 500;
}

/* Controls */
.controls {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeSlideUp 0.6s ease-out 0.1s backwards;
}

/* Drop Zone */
.drop-zone {
    position: relative;
    border: none;
    border-radius: 24px;
    padding: 4rem 3rem;
    margin: 0 auto 1rem;
    max-width: 600px;
    min-width: 400px;
    transition: all 0.3s var(--ease-out-expo);
    background: var(--bg-surface);
    overflow: hidden;
}

/* Animated gradient border */
.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(
        135deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-primary) 100%
    );
    background-size: 200% 200%;
    animation: gradientRotate 4s linear infinite;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.drop-zone:hover {
    background: rgba(0, 229, 255, 0.05);
    box-shadow: 0 0 40px var(--accent-primary-glow);
    transform: translateY(-2px);
}

.drop-zone.drag-over {
    background: var(--accent-secondary-dim);
    transform: scale(1.02);
    box-shadow: 0 0 50px rgba(0, 255, 157, 0.25);
    animation: none;
}

.drop-zone.disabled {
    opacity: 0.5;
    pointer-events: none;
    animation: none;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.drop-icon {
    opacity: 0.9;
    transition: transform 0.3s ease;
}

.drop-zone:hover .drop-icon {
    transform: scale(1.1);
}

.drop-text {
    font-size: 1.3rem;
    color: #ccc;
    font-weight: 600;
    margin-top: 0.5rem;
}

.drop-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #666;
    font-size: 0.8rem;
}

.drop-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drop-features li::before {
    content: '•';
    color: #00d9ff;
    font-size: 0.9rem;
}

/* Build Info */
.build-info {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeSlideUp 0.6s ease-out 0.4s forwards;
}

/* Error */
.error {
    background: rgba(255, 99, 132, 0.15);
    border: 1px solid rgba(255, 99, 132, 0.5);
    color: #ff6384;
    padding: 1rem 1.5rem;
    margin: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    animation: fadeSlideUp 0.3s ease-out;
}

/* Loading (inline within drop-section) */
.loading-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem;
    animation: fadeSlideUp 0.4s ease-out;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.spinner::before {
    border-top-color: #00d9ff;
    border-right-color: #00d9ff;
    animation: spin 1s linear infinite;
}

.spinner::after {
    border-bottom-color: #00ff88;
    border-left-color: #00ff88;
    animation: spin 1s linear infinite reverse;
    inset: 6px;
}

#progress-text {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-primary) 100%
    );
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-detail {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.cancel-btn {
    margin-top: 1.5rem;
    background: transparent;
    border: 1px solid rgba(255, 99, 132, 0.5);
    color: #ff6384;
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(255, 99, 132, 0.15);
    border-color: #ff6384;
}

.hidden {
    display: none !important;
}

/* Main Content (Results view) */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem 1.5rem 1rem;
    animation: fadeSlideUp 0.5s ease-out;
}

/* Summary - Compact horizontal layout */
.summary {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-item .label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.summary-item .value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-item .value.highlight {
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ff6384, #ff9f40);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Action Bar - Compact */
.action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    color: #888;
    font-size: 0.85rem;
}

.selection-info .separator {
    color: #444;
}

.primary-btn {
    background: var(--gradient-brand);
    color: var(--bg-base);
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-ui);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-expo), box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 20px var(--accent-primary-glow);
}

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

.primary-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.primary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-accent);
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-family: var(--font-ui);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out-expo);
}

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

.secondary-btn:active {
    transform: scale(0.97);
}

/* Two-Panel Layout - Fills remaining space */
.duplicate-panels {
    flex: 1;
    display: grid;
    grid-template-columns: var(--left-panel-width, 320px) auto 1fr;
    min-height: 0; /* Critical for flex overflow */
}

/* Panel Resize Handle */
.panel-resize-handle {
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    position: relative;
    z-index: 10;
    background: transparent;
    transition: background 0.15s ease;
}

.panel-resize-handle:hover,
.panel-resize-handle.dragging {
    background: rgba(0, 217, 255, 0.05);
}

.resize-handle-line {
    width: 3px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    transition: all 0.15s ease;
}

.panel-resize-handle:hover .resize-handle-line,
.panel-resize-handle.dragging .resize-handle-line {
    background: linear-gradient(180deg, #00d9ff, #00ff88);
    height: 72px;
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
}

/* Prevent text selection during resize drag */
.duplicate-panels.resizing {
    user-select: none;
    cursor: col-resize;
}

.duplicate-panels.resizing * {
    cursor: col-resize !important;
}

.panel-left,
.panel-right {
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow shrinking */
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 10px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.panel-left h3,
.panel-right h3 {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

.detail-filename {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

/* Group List (Left Panel) */
.group-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.group-item {
    display: flex;
    flex-direction: column;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-expo),
                box-shadow 0.2s var(--ease-out-expo),
                background 0.2s ease,
                border-color 0.2s ease;
}

.group-item:hover {
    background: var(--accent-primary-dim);
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.group-item.selected {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary),
                0 4px 16px rgba(0, 229, 255, 0.2);
}

.group-item-name {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.35rem;
}

.group-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
}

.group-item-size {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.group-item-count {
    color: var(--accent-primary);
}

.group-item-wasted {
    color: var(--danger);
    margin-left: auto;
}

/* Detail Panel (Right Panel) */
.detail-panel {
    flex: 2;
    overflow-y: auto;
    min-height: 0;
}

.detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #555;
    font-size: 0.95rem;
}

/* Duplicate File Row */
.duplicate-file {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.25rem;
    transition: background 0.2s;
    gap: 0.75rem;
}

.duplicate-file:hover {
    background: rgba(255, 255, 255, 0.03);
}

.duplicate-file.marked {
    background: rgba(255, 99, 132, 0.08);
}

.duplicate-file.marked .file-name {
    text-decoration: line-through;
    opacity: 0.6;
}

.duplicate-file.original {
    background: rgba(0, 255, 136, 0.05);
}

/* Checkbox */
.file-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.file-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.file-checkbox .checkmark {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.file-checkbox input:checked ~ .checkmark {
    background: linear-gradient(135deg, #ff6384, #ff9f40);
    border-color: transparent;
}

.file-checkbox input:checked ~ .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.file-checkbox input:disabled ~ .checkmark {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Thumbnail */
.file-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* File Info */
.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.file-name {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-path {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.original-badge {
    background: linear-gradient(135deg, #00ff88, #00d9ff);
    color: #1a1a2e;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.similarity-badge {
    background: linear-gradient(135deg, #00d9ff, #00aaff);
    color: #1a1a2e;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.file-size {
    color: #888;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

/* No Duplicates */
.no-duplicates {
    text-align: center;
    padding: 3rem 2rem;
    color: #888;
}

.no-duplicates-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #00ff88, #00d9ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.no-duplicates p {
    font-size: 1.1rem;
}

/* Scrollbar */
.group-list::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar {
    width: 8px;
}

.group-list::-webkit-scrollbar-track,
.detail-panel::-webkit-scrollbar-track {
    background: var(--bg-base);
    border-radius: 4px;
}

.group-list::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb {
    background: var(--gradient-brand);
    border-radius: 4px;
    border: 2px solid var(--bg-base);
}

.group-list::-webkit-scrollbar-thumb:hover,
.detail-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Focus states */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: rgba(0, 217, 255, 0.3);
    color: #fff;
}

/* Responsive */
@media (max-width: 900px) {
    .duplicate-panels {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    /* Hide resize handle on mobile (stacked layout) */
    .panel-resize-handle {
        display: none;
    }

    .panel-left,
    .panel-right {
        min-height: 200px;
    }

    .summary {
        gap: 1rem;
    }
}

@media (max-width: 700px) {
    .main-content {
        padding: 0.75rem 1rem;
    }

    .app-header {
        padding: 0 1rem;
    }

    .intro-title {
        font-size: 2rem;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .selection-info {
        margin-left: 0;
        justify-content: center;
    }

    .summary {
        gap: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .summary-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .summary-item .label {
        font-size: 0.6rem;
    }

    .summary-item .value {
        font-size: 0.9rem;
    }
}

/* ========================================
   Image Preview Panel
   ======================================== */

.image-preview-panel {
    flex: 1;
    min-height: 120px;
    margin-top: 0.75rem;
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.008) 2px,
            rgba(255, 255, 255, 0.008) 4px
        );
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Subtle corner accents */
.image-preview-panel::before,
.image-preview-panel::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(0, 217, 255, 0.2);
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.image-preview-panel::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
    border-radius: 4px 0 0 0;
}

.image-preview-panel::after {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 4px 0;
}

.image-preview-panel.has-image::before,
.image-preview-panel.has-image::after {
    border-color: rgba(0, 255, 136, 0.3);
}

/* Placeholder state */
.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: #444;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    transition: opacity 0.25s ease;
}

.image-preview-panel.has-image .preview-placeholder {
    opacity: 0;
    pointer-events: none;
}

.preview-icon {
    width: 40px;
    height: 40px;
    opacity: 0.4;
    stroke: #555;
}

/* Image container */
.preview-image-container {
    position: absolute;
    inset: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.95);
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-preview-panel.has-image .preview-image-container {
    opacity: 1;
    transform: scale(1);
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Subtle glow when image is shown */
.image-preview-panel.has-image .preview-image {
    animation: imageReveal 0.4s ease-out;
}

@keyframes imageReveal {
    0% {
        opacity: 0;
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
    }
}

/* Loading state */
.image-preview-panel.loading .preview-placeholder {
    opacity: 0;
}

.image-preview-panel.loading::before {
    animation: cornerPulse 1s ease-in-out infinite;
}

@keyframes cornerPulse {
    0%, 100% { border-color: rgba(0, 217, 255, 0.2); }
    50% { border-color: rgba(0, 217, 255, 0.5); }
}

/* Preview panel scrollbar styling to match */
.image-preview-panel::-webkit-scrollbar {
    width: 6px;
}

.image-preview-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.image-preview-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d9ff, #00ff88);
    border-radius: 3px;
}

/* Responsive adjustments */
@media (max-width: 700px) {
    .image-preview-panel {
        min-height: 100px;
        margin-top: 0.5rem;
    }

    .preview-icon {
        width: 32px;
        height: 32px;
    }

    .preview-placeholder {
        font-size: 0.75rem;
    }
}

/* ========================================
   Keeper Selection & Deletion Features
   ======================================== */

/* Keeper file styling (replaces .original) */
.duplicate-file.keeper {
    background: rgba(0, 255, 136, 0.08);
    border-left: 3px solid #00ff88;
    padding-left: calc(1.25rem - 3px); /* Adjust for border */
}

.keeper-badge {
    position: relative;
    background: var(--gradient-brand);
    color: var(--bg-base);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
    overflow: hidden;
}

.keeper-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.keeper-badge:hover {
    opacity: 0.85;
}

/* Set as keeper button - shown on hover */
.set-keeper-btn {
    background: transparent;
    border: 1px solid rgba(0, 255, 157, 0.4);
    color: var(--accent-secondary);
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-family: var(--font-ui);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out-expo);
    opacity: 0;
    flex-shrink: 0;
}

.duplicate-file:hover .set-keeper-btn {
    opacity: 1;
}

.set-keeper-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
}

/* File modification time */
.file-mtime {
    font-size: 0.7rem;
    color: #555;
    margin-top: 0.1rem;
}

/* Danger button for deletion */
.danger-btn {
    background: var(--gradient-danger);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-ui);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-expo), box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 20px var(--danger-glow);
}

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

.danger-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.danger-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary button disabled state */
.secondary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================
   Deletion Modal
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    min-width: 400px;
    text-align: center;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: #eee;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-content .progress-bar {
    width: 100%;
    margin-bottom: 1rem;
}

.modal-content p {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.modal-content .secondary-btn {
    min-width: 120px;
}
