h1 {
    text-align: center;
    color: #333;
    margin: 20px 0;
    font-size: 2.5em;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f8f8f8;
    min-height: 100vh;
    position: relative;
}

.container {
    position: relative;
    z-index: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.container > .color-selector,
.container > .layers-manager,
.container > .general-settings,
.container > .image-controls,
.container > .canvas-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.color-selector {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

#color-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.color-item:hover {
    background-color: #f5f5f5;
}

.color-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.color-preview {
    width: 25px;
    height: 25px;
    border: 2px solid #ccc;
    border-radius: 4px;
}

.image-controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.slider-container:last-child {
    margin-bottom: 0;
}

.slider-container label {
    min-width: 180px;
}

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

.slider-wrapper input[type="range"] {
    flex: 1;
}

.slider-wrapper .value {
    min-width: 70px;
    color: #4CAF50;
    font-weight: bold;
    text-align: right;
}

.double-slider {
    flex: 1;
    position: relative;
    height: 20px;
}

.double-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    transform: translateY(-50%);
}

.double-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: var(--left, 100%);
    right: var(--right, 100%);
    height: 8px;
    background: #4CAF50;
    border-radius: 4px;
    transform: translateY(-50%);
    z-index: 1;
}

.double-slider input[type="range"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    margin: 0;
    pointer-events: none;
    -webkit-appearance: none;
    background: none;
}

.double-slider input[type="range"]:nth-child(1) {
    z-index: 3;
}

.double-slider input[type="range"]:nth-child(2) {
    z-index: 2;
}

.double-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    z-index: 4;
}

.double-slider input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    z-index: 4;
}

.double-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
}

.double-slider input[type="range"]::-moz-range-thumb:hover {
    background: #45a049;
}

.general-settings .slider-container {
    margin-bottom: 15px;
}

.general-settings .slider-container:last-child {
    margin-bottom: 0;
}

.canvas-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.canvas-wrapper {
    flex: 1;
    max-width: 50%;
    text-align: center;
}

.canvas-wrapper h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

#originalCanvas, #previewCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #45a049;
}

.select-buttons {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

.select-buttons button {
    padding: 8px 15px;
    font-size: 14px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.select-buttons button:hover {
    background-color: #45a049;
}

.pattern-selector {
    display: none;
}

.file-upload-container {
    width: 100%;
    margin-bottom: 15px;
}

.file-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #fafafa;
    cursor: pointer;
}

.file-upload-area.drag-over {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #666;
}

.file-upload-content svg {
    color: #4CAF50;
}

.file-upload-content p {
    margin: 0;
    font-size: 16px;
}

.file-upload-content label {
    color: #4CAF50;
    cursor: pointer;
    text-decoration: underline;
}

.file-upload-content label:hover {
    color: #45a049;
}

.layers-manager {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.layer-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: white;
    border-radius: 4px;
    margin-bottom: 8px;
    gap: 15px;
}

.layer-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.layer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layer-controls .slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.layer-controls .slider-wrapper input[type="range"] {
    flex: 1;
}

.layer-controls .slider-wrapper .value {
    min-width: 40px;
    text-align: right;
    color: #4CAF50;
    font-weight: bold;
}

.layer-color-preview {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-right: 10px;
}

.layer-name {
    flex: 1;
}

.layer-controls button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-controls button:hover {
    background: #45a049;
}

.layer-controls .delete-btn {
    background: #f44336;
}

.layer-controls .delete-btn:hover {
    background: #d32f2f;
}

.layer-controls .move-up-btn,
.layer-controls .move-down-btn {
    font-size: 20px;
    font-weight: bold;
}

.layer-item.dragging {
    opacity: 0.5;
    background: #e0e0e0;
}

.threshold-hint {
    display: none;
}

input[type="range"]#colorThreshold {
    background: linear-gradient(to right, 
        #4CAF50 0%, 
        #4CAF50 30%, 
        #ff9800 30%, 
        #ff9800 60%,
        #f44336 60%, 
        #f44336 100%
    );
}

.general-settings {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.general-settings h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.slider-container:last-child {
    margin-bottom: 0;
}

.slider-container label {
    min-width: 180px;
}

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

.slider-wrapper input[type="range"] {
    flex: 1;
}

.slider-wrapper .value {
    min-width: 70px; 
    color: #4CAF50;
    font-weight: bold;
    text-align: right;
}

.double-slider {
    flex: 1;
    position: relative;
    height: 20px;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #45a049;
}

.no-layers {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

.custom-settings-btn {
    padding: 4px 8px;
    font-size: 16px;
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
}

.custom-settings-btn.active {
    background: #2196F3;
}

.custom-settings {
    flex-basis: 100%;
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.custom-settings .slider-container {
    margin-bottom: 10px;
}

.custom-settings .slider-container:last-child {
    margin-bottom: 0;
}

footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9em;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: #f0f0f0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

#topbar {
    position: relative;
}

#topbar h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 20px 0;
}

.lang-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.lang-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.lang-btn.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15);
}

.flag-img {
    width: 26px;
    height: 26px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.custom-settings .double-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    transform: translateY(-50%);
}

.custom-settings .double-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: var(--left, 100%);
    right: var(--right, 100%);
    height: 8px;
    background: #4CAF50;
    border-radius: 4px;
    transform: translateY(-50%);
    z-index: 1;
} 