body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 30px;
    width: 100%;
    max-width: 800px;
}

h1 {
    text-align: center;
    color: #333;
}

.description {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1em;
    line-height: 1.5;
}

.resize-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resize-inputs input[type="number"] {
    width: 100px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.resize-inputs input[type="checkbox"] {
    margin-left: 10px;
}

.image-upload {
    text-align: center;
    margin-bottom: 20px;
}

.upload-btn {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

#imageInput {
    display: none;
}

.image-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.preview-section, .settings-section {
    flex: 1;
    min-width: 250px;
}

#previewCanvas {
    max-width: 100%;
    border: 1px solid #ddd;
}

.settings-section > div {
    margin-bottom: 15px;
}

select, input[type="range"] {
    width: 100%;
    margin-top: 10px;
}

.slider-group {
    margin-bottom: 15px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.adjust-control {
    margin-bottom: 20px;
}

.adjust-control input[type="range"] {
    width: 100%;
}

.action-buttons {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

button {
    width: auto;
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button.disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#processBtn:disabled, #downloadBtn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.resolution-control {
    display: none;
}

.resolution-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resolution-inputs input[type="number"] {
    width: 100px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.resolution-info {
    margin-top: 10px;
    color: #666;
    font-size: 0.9em;
}

.file-size-info {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.9em;
}

.file-size-info p {
    margin: 5px 0;
}

.empty-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 300px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    color: #888;
    text-align: center;
}

.empty-preview svg {
    width: 100px;
    height: 100px;
    stroke: #ddd;
    margin-bottom: 20px;
}

.empty-preview p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.canvas-container {
    position: relative;
    display: inline-block;
}

.crop-frame {
    position: absolute;
    border: 2px solid rgba(33, 150, 243, 0.7);
    background-color: rgba(33, 150, 243, 0.2);
    cursor: move;
    display: none;
}

.crop-frame .resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: white;
    border: 1px solid #2196F3;
}

.crop-frame .resize-handle-nw { 
    top: -5px; 
    left: -5px; 
    cursor: nw-resize; 
}

.crop-frame .resize-handle-ne { 
    top: -5px; 
    right: -5px; 
    cursor: ne-resize; 
}

.crop-frame .resize-handle-sw { 
    bottom: -5px; 
    left: -5px; 
    cursor: sw-resize; 
}

.crop-frame .resize-handle-se { 
    bottom: -5px; 
    right: -5px; 
    cursor: se-resize; 
}

.crop-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.crop-toggles button {
    padding: 8px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.crop-size-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.crop-size-inputs input {
    width: 100px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.crop-size-inputs button {
    padding: 8px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.undo-crop-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.undo-crop-btn {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.undo-crop-btn:hover {
    background-color: #d32f2f;
}

.crop-control-under-preview {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}

.crop-control-under-preview .crop-toggles {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.crop-control-under-preview .crop-size-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.crop-control-under-preview .crop-size-inputs input {
    width: 100px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.crop-control-under-preview .crop-size-inputs button {
    padding: 8px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .image-controls {
        flex-direction: column;
    }

    .preview-section, .settings-section {
        width: 100%;
        min-width: 100%;
    }

    .resize-inputs {
        flex-wrap: wrap;
    }

    .resize-inputs input[type="number"] {
        width: calc(50% - 20px);
        margin-bottom: 10px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .action-buttons button {
        width: 100%;
        margin-bottom: 10px;
    }

    .slider-group label {
        flex-direction: column;
        align-items: flex-start;
    }

    .crop-control-under-preview .crop-size-inputs {
        flex-direction: column;
        width: 100%;
    }

    .crop-control-under-preview .crop-size-inputs input,
    .crop-control-under-preview .crop-size-inputs button {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
    }

    .description {
        font-size: 0.9em;
    }

    .upload-btn {
        width: 100%;
        text-align: center;
    }

    .resize-inputs input[type="number"] {
        width: 100%;
    }
}