
/* Set up the upload page */
html,
body {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
}

/* Style the upload heading */
h1 {
    color: var(--color-text);
    font-size: 24px;
    text-align: center;
    margin: 0 0 8px;
}

/* Style the upload instructions and messages */
p {
    color: var(--color-text-muted);
    font-size: 14px;
    text-align: center;
    margin: 0 0 10px;
}

/* Center the upload controls inside the main section */
main {
    box-sizing: border-box;
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: none;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 80vh;
    margin: 0;
    padding: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

/* Hide the file input because clicking the upload box opens the file picker */
#sketchUpload {
    display: none;
}

/* Set up the area where the selected image appears */
#previewContainer {
    width: 100%;
    min-height: 0;
    text-align: center;
    margin-top: 8px;
}

/* Keep the uploaded image inside the preview area without cropping */
#imagePreview {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

/* Style the buttons in the upload section */
button {
    background-color: #242b45;
    color: #ffffff;
    border: 1px solid #626b85;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

button:hover {
    background-color: #354163;
}

/* Move the controls toward the top when an image is uploaded */
main.has-image {
    padding: 10px;
    justify-content: flex-start;
}

/* Give the uploaded image more room inside the upload section */
main.has-image #previewContainer {
    flex: 1;
    width: 100%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

/* Fit the uploaded image inside the available space */
main.has-image #imagePreview {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Keep the file input and Remove Image button centered */
main.has-image #sketchUpload,
main.has-image #removeImage {
    flex-shrink: 0;
    margin: 8px auto;
}

/* Keep the status message from taking up extra space */
main.has-image #uploadMessage {
    flex-shrink: 0;
    margin: 4px 0;
}

/* Hide the empty preview area before an image is selected */
main:not(.has-image) #previewContainer {
    display: none;
}

/* Make sure hidden elements stay hidden */
[hidden] {
    display: none !important;
}

/* Show a loading spinner while the image is being processed */
#uploadMessage.loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: middle;
    animation: uploadSpin 0.8s linear infinite;
}

/* Rotate the loading spinner */
@keyframes uploadSpin {
    to {
        transform: rotate(360deg);
    }
}

main {
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

    /* Highlight the upload are when the mouse hovers over it */
main:hover {
    background-color: rgba(96, 165, 250, 0.08);
    box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.35);
}

/* Highlight the upload area when a file is dragged over it */
main.drag-over {
    outline: 3px dashed #60a5fa;
    outline-offset: -8px;
    box-shadow: inset 0 0 20px rgba(96, 165, 250, 0.15);
    cursor: copy;
}

/* Style the image confirmation window */
#uploadConfirmDialog {
    background-color: #252525;
    color: white;
    border: 1px solid #555;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
    text-align: center;
    margin: auto;
    font-family: inherit;
}

/* Darken the background when the confirmation window opens */
#uploadConfirmDialog::backdrop {
    background-color: rgba(0, 0, 0, 0.65);
}

/* Style the confirmation window heading */
#uploadConfirmDialog h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 22px;
}

/* Style the confirmation message */
#uploadConfirmDialog p {
    margin-bottom: 24px;
    color: #dddddd;
}

/* Style the Upload and Cancel buttons */
#uploadConfirmDialog button {
    padding: 10px 22px;
    margin: 5px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

/* Make the Upload button blue */
#confirmUpload {
    background-color: #2563eb;
    color: white;
}

/* Make the Cancel button gray */
#cancelUpload {
    background-color: #555555;
    color: white;
}

/* Change the button colors when the user hovers over them */
#confirmUpload:hover {
    background-color: #1d4ed8;
}

#cancelUpload:hover {
    background-color: #707070;
}

/* CURSORS (same as the main page) */
html {
    cursor: url("../assets/cursors/arrow-light.png") 10 7, auto;
}

main,
button:not(:disabled),
label,
input[type="file"] {
    cursor: url("../assets/cursors/arrow-click-light.png") 16 3, pointer;
}

button:disabled {
    cursor: url("../assets/cursors/arrow-light.png") 10 7, not-allowed;
}

@media (prefers-color-scheme: dark) {
    html {
        cursor: url("../assets/cursors/arrow-dark.png") 10 7, auto;
    }

    main,
    button:not(:disabled),
    label,
    input[type="file"] {
        cursor: url("../assets/cursors/arrow-click-dark.png") 16 3, pointer;
    }

    button:disabled {
        cursor: url("../assets/cursors/arrow-dark.png") 10 7, not-allowed;
    }
}