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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    background: white;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.header-section {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 8px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
    padding: 20px;

}

.scrollable-controls {
    flex: 1;
    overflow-y: auto;
    padding-top: 8px;
    padding: 20px;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.back-button:hover {
    background: #f8f9fa;
    color: #495057;
    transform: translateX(-2px);
}

.back-button svg {
    transition: transform 0.2s ease;
}

.back-button:hover svg {
    transform: translateX(-2px);
}

.sidebar h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #3498db;
}

.preview-area {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f8f9fa;
    position: relative;
}

.svg-stack {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

.control-group {
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.control-group h3 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

label {
    min-width: 100px;
    font-weight: 500;
    flex-shrink: 0;
    font-size: 13px;
}

input[type="range"] {
    flex: 1;
    min-width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
}

input[type="number"] {
    width: 90px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    flex-shrink: 0;
}

.unit-label {
    font-size: 14px;
    color: #666;
    min-width: 25px;
    flex-shrink: 0;
}

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

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.stat-item label {
    font-weight: 500;
    color: #495057;
    min-width: auto;
}

.stat-item span {
    font-weight: 600;
    color: #2c3e50;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.progress-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    font-size: 14px;
    color: #333;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e3e3e3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.progress-text {
    font-weight: 500;
    min-width: 80px;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tool-title {
    font-size: 1.2em;
    margin: 0;
    color: #333;
    font-weight: 600;
}

.image-drop-zone {
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-drop-zone:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

.image-drop-zone.dragover {
    border-color: #3498db;
    background-color: #e3f2fd;
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #666;
}

.drop-zone-content svg {
    opacity: 0.5;
    width: 32px;
    height: 32px;
}

.drop-zone-content p {
    margin: 0;
    font-size: 0.8em;
}

.image-preview {
    max-width: calc(100% - 6px);
    max-height: calc(60px - 6px);
    border-radius: 3px;
    object-fit: contain;
    margin: 3px;
}

.button-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.action-btn {
    flex: 1;
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.8em;
}

.action-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

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

.action-btn.full-width {
    width: 100%;
    margin-bottom: 6px;
    background: #27ae60;
}

.action-btn.full-width:hover {
    background: #219a52;
}

.download-section {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 8px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.75em;
}

.download-btn.compact {
    padding: 4px 6px;
    font-size: 0.7em;
    gap: 3px;
}

.download-btn.primary {
    background: #e67e22;
    color: white;
}

.download-btn.primary:hover {
    background: #d35400;
    transform: translateY(-1px);
}

.download-btn.secondary {
    background: #9b59b6;
    color: white;
}

.download-btn.secondary:hover {
    background: #8e44ad;
    transform: translateY(-1px);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 100%;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    border-radius: 6px;
    z-index: 1;
    border: 1px solid #ddd;
    top: 100%;
    left: 0;
    margin-top: -1px;
}

.dropdown-content a {
    color: #333;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s ease;
    font-size: 0.8em;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown-content a:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-content a:last-child {
    border-radius: 0 0 6px 6px;
}

.download-dropdown {
    position: relative;
    display: inline-block;
    flex: 1;
}

.download-dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.1s ease-in;
}

.download-dropdown .dropdown-content {
    transition: opacity 0.2s ease;
}

.download-dropdown:hover .dropdown-content,
.dropdown-content:hover {
    display: block;
}

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

.canvas-control-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.canvas-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #3498db;
    color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.canvas-control-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.canvas-controls {
    pointer-events: auto;
}

.status-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.status-notification.show {
    transform: translateX(0);
}

.status-notification.error {
    background: #e74c3c;
}

.status-notification.complete {
    background: #27ae60;
}

.status-notification.processing {
    background: #f39c12;
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .preview-area {
        flex: 1;
        min-height: 400px;
    }
}
