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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
}

header p {
    color: #888;
    font-size: 14px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: scale(1.02);
}

.upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-content p {
    color: #666;
    margin: 5px 0;
}

.upload-btn {
    color: #667eea;
    font-weight: 600;
    text-decoration: underline;
}

.upload-hint {
    font-size: 14px;
}

.controls {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #555;
}

.preset-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.preset-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s;
}

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

.slider-row input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.quality-value {
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
    min-width: 45px;
    text-align: right;
}

.format-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.format-row label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.format-row select {
    flex: 1;
}

.size-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.size-row label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.size-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-input {
    width: 80px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
}

.size-input:focus {
    border-color: #667eea;
}

.size-inputs span {
    color: #888;
    font-size: 14px;
}

select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

select:hover,
select:focus {
    border-color: #667eea;
}

.apply-all-btn {
    width: 100%;
    margin-top: 15px;
}

.rename-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.rename-row:last-child {
    margin-bottom: 0;
}

.rename-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    outline: none;
    transition: border-color 0.3s;
}

.rename-input:focus {
    border-color: #667eea;
}

.rename-input::placeholder {
    color: #aaa;
}

.list-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.selected-count {
    flex: 1;
    font-size: 13px;
    color: #666;
}

.image-item {
    position: relative;
}

.image-item.selected {
    background: #f0f2ff;
    border: 2px solid #667eea;
}

.image-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
    z-index: 1;
}

.image-list {
    margin: 20px 0;
}

.image-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

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

.image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-header {
    display: flex;
    align-items: center;
}

.image-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #eee;
}

.image-info {
    flex: 1;
    margin-left: 15px;
    min-width: 0;
}

.filename {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filename-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.filename-input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

.filename-input:focus {
    border-color: #667eea;
}

.filename-ext {
    font-size: 12px;
    color: #888;
}

.comparison {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.comparison span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.compressed-size {
    color: #28a745;
    font-weight: 600;
}

.compressed-size.negative {
    color: #dc3545;
}

.reduction {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.reduction.negative {
    background: #ffebee;
    color: #c62828;
}

.image-settings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #ddd;
}

.image-slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.image-slider-group label {
    font-size: 12px;
    color: #666;
    min-width: 25px;
}

.image-slider-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.image-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.image-slider-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

.image-slider-group .value {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    min-width: 35px;
    text-align: right;
}

.image-format-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-format-group label {
    font-size: 12px;
    color: #666;
    min-width: 25px;
}

.image-format-group select {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    border-width: 1px;
}

.image-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-use-global {
    font-size: 11px;
    padding: 5px 10px;
    background: #e9ecef;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.btn-use-global:hover {
    background: #dee2e6;
}

.btn-use-global.is-global {
    background: #d4edda;
    color: #155724;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn.small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn.primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.secondary {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.btn.secondary:hover {
    background: #f5f5f5;
}

.btn.danger {
    background: #fff5f5;
    color: #dc3545;
    border: 1px solid #ffcdd2;
}

.btn.danger:hover {
    background: #ffebee;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.stat-value.highlight {
    color: #28a745;
}

.stat-value.negative {
    color: #dc3545;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 22px;
    }

    .upload-area {
        padding: 30px 20px;
    }

    .upload-icon {
        font-size: 36px;
    }

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

    .image-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-item img {
        width: 100%;
        height: 150px;
        margin-bottom: 12px;
    }

    .image-info {
        margin-left: 0;
        width: 100%;
    }

    .image-actions {
        width: 100%;
    }

    .image-actions .btn {
        flex: 1;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
    }
}

.quick-nav {
    position: fixed;
    right: 20px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.quick-nav-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.quick-nav-btn:active {
    transform: translateY(-1px);
}
