* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.upload-section {
    text-align: center;
    margin-bottom: 20px;
    padding: 30px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.upload-btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #4CAF50;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.upload-btn:hover {
    background-color: #45a049;
}

.hint {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 8px;
}

.threshold-control {
    display: flex;
    flex-direction: column;
    width: 50%;
}

.threshold-control label {
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#processBtn {
    background-color: #2196F3;
    color: white;
}

#processBtn:hover:not(:disabled) {
    background-color: #0b7dda;
}

#downloadBtn {
    background-color: #ff9800;
    color: white;
}

#downloadBtn:hover:not(:disabled) {
    background-color: #e68a00;
}

.preview-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.preview-header h2 {
    font-size: 18px;
    color: #333;
}

#imageCount {
    color: #666;
    font-size: 14px;
}

.preview-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.image-card {
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.image-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.image-card .card-header .filename {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.image-card .remove-btn {
    background: none;
    border: none;
    color: #ff5252;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
}

.image-card .image-preview {
    width: 100%;
    height: 150px;
    object-fit: contain;
    display: block;
    background-color: #fafafa;
}

.image-card .processed {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(76, 175, 80, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    display: none;
}

.image-card.is-processed .processed {
    display: block;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.loading-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}