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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 30px;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.back-button:hover {
    background-color: #f0f2f5;
}

.header-content {
    flex: 1;
    text-align: center;
}

.header-content h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
}

section {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.setting-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#edgeDetectionSettings {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

label {
    font-weight: 600;
    min-width: 120px;
}

input[type="file"] {
    padding: 8px;
    border: 2px dashed #bdc3c7;
    border-radius: 4px;
    background: #ecf0f1;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #3498db;
    background: #e8f4fd;
}

select, input[type="text"], input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

input[type="range"] {
    flex: 1;
    min-width: 250px;
    width: 250px;
}

#edgeSensitivity {
    flex: 1 !important;
    min-width: 250px !important;
    width: 250px !important;
    max-width: none !important;
}

input[type="checkbox"] {
    margin-right: 8px;
}

button {
    background: #52E679;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

button:hover {
    background: #3d9c4a;
}

button:active {
    transform: translateY(1px);
}

#convertBtn {
    background: #27ae60;
    font-size: 14px;
    padding: 10px 20px;
}

#convertBtn:hover {
    background: #229954;
}

.output-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.live-preview-info {
    background: #e8f6f3;
    border: 1px solid #1abc9c;
    border-radius: 4px;
    padding: 12px;
    margin-top: 20px;
}

.live-preview-info p {
    margin: 0;
    color: #16a085;
    font-size: 14px;
}

.live-preview-info strong {
    color: #117a65;
}

.processing-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3498db;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

#processedImage {
    position: relative;
}

.settings-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #495057;
}

.settings-summary strong {
    color: #2c3e50;
}

.auto-btn {
    background: #17a2b8;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    margin-left: 10px;
    min-width: 50px;
}

.auto-btn:hover {
    background: #138496;
}

.auto-levels-btn {
    background: #6f42c1;
    color: white;
    font-size: 14px;
    padding: 8px 16px;
    width: 100%;
    margin: 5px 0;
}

.auto-levels-btn:hover {
    background: #5a2d91;
}

.auto-all-btn {
    background: #28a745;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    width: 100%;
}

.auto-all-btn:hover {
    background: #218838;
}

.auto-all-container {
    margin-top: 15px;
}

.usage-example {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

.usage-example p {
    margin-bottom: 10px;
    color: #495057;
}

.usage-example code {
    display: block;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
}

#copyBtn {
    background: #e67e22;
    margin-right: 10px;
}

#copyBtn:hover {
    background: #d35400;
}

#downloadBtn {
    background: #8e44ad;
}

#downloadBtn:hover {
    background: #7d3c98;
}

#originalImage, #processedImage {
    text-align: center;
    padding: 20px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    min-height: 100px;
    background: #fafafa;
}

#originalImage canvas, #processedImage canvas {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    margin-bottom: 10px;
}

textarea {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    padding: 12px;
    resize: vertical;
    background: #f8f9fa;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

#customSize {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

#customSize input {
    width: 80px;
}

.setting-group span {
    font-weight: 600;
    color: #3498db;
    min-width: 40px;
    text-align: center;
}

/* Specific styling for value spans to prevent layout shifts */
#edgeSensitivityValue, #contrastValue, #brightnessValue, #thresholdValue, #previewScaleValue {
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

@media (max-width: 768px) {
    .setting-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    label {
        min-width: auto;
    }
    
    input[type="range"] {
        width: 100%;
        max-width: none;
    }
}

/* Size Warning Styling */
.size-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}
