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

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

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

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-card h2 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.5rem;
}

.upload-section {
    margin-bottom: 20px;
}

.upload-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
}

.upload-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: border-color 0.3s;
}

.upload-section input[type="file"]:hover {
    border-color: #667eea;
}

.image-preview {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #ddd;
    object-fit: contain;
}

.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.2s;
}

.image-item img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #ddd;
    object-fit: contain;
    display: block;
}

.swap-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
    align-items: center;
}

.swap-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.swap-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.swap-btn:active {
    transform: scale(0.95);
}

.image-name {
    margin-top: 5px;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.image-name:hover {
    color: #667eea;
}

.hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}


.config-section {
    margin-bottom: 30px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: #555;
}

.config-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.output-badge {
    background: #28a745;
    color: white;
}

.processing-badge {
    background: #667eea;
    color: white;
}

.config-section-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.config-item input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.config-item input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.config-item select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.help-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
    cursor: help;
    vertical-align: middle;
    position: relative;
}

.help-icon:hover {
    background: #764ba2;
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
    line-height: 1.4;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #28a745;
    color: white;
    margin-top: 15px;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

.btn-reset {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.btn-reset:active {
    transform: translateY(0);
}

.loading {
    margin-top: 20px;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-container {
    margin-top: 15px;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border-left: 4px solid #667eea;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: #555;
    transition: background 0.2s;
}

.status-header:hover {
    background: #e9ecef;
}

.status-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #667eea;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.status-toggle:hover {
    color: #764ba2;
}

.toggle-icon {
    transition: transform 0.2s;
    display: inline-block;
}

.status-container.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.status {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    border-left: 4px solid #667eea;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.status.collapsed {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
    opacity: 0;
}

.status.expanded {
    max-height: 400px;
    padding: 15px;
    opacity: 1;
}

/* Status message formatting */
.status .status-line {
    margin: 4px 0;
    padding: 2px 0;
}

.status .status-info {
    color: #0066cc;
}

.status .status-success {
    color: #28a745;
    font-weight: 600;
}

.status .status-error {
    color: #dc3545;
    font-weight: 600;
}

.status .status-warning {
    color: #ffc107;
}

.status .status-progress {
    color: #667eea;
}

.status .status-separator {
    border-top: 1px solid #ddd;
    margin: 8px 0;
    padding-top: 8px;
}

.result-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.result-preview {
    text-align: center;
    margin: 20px 0;
}

.result-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.info {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #666;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
}

