/*
The stylesheet that will style the UI components of the demo page & contacts page
*/

:root {
    --range-primary-color: #00048C;
    --range-secondary-color: #006AFF;
    --range-height: 6px;
    --range-thumb-size: 20px;
}

/* Loader styles */
body.not-loaded > * {
    display: none;
}

.loader {
    display: none;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    padding-bottom: 5rem;
}

@keyframes loaderPulse {
    0%, 100% {
        opacity: 0.7;
        transform: translateY(-10px);
    }
    50% {
        opacity: 1;
        transform: translateY(0px);
    }
}

.loader .loader-image {
    width: 40%;
    max-width: 160px;
    aspect-ratio: 1;
    background-image: url('/assets/tp_logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: loaderPulse 1.5s infinite ease-in-out;
}

body.not-loaded .loader {
    display: flex;
}


/* Label Styles */
label {
    display: block;
    margin-block: 1rem !important;
}

label.columned {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label.columned .dropdown-toggle {
    max-width: 150px;
}

/* Inputs Styling */
input, textarea, select {
    background: transparent;
    width: 100%;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid white;
    accent-color: var(--accentblue);
}

input:focus, textarea:focus, select:focus {
    outline: none;
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

label.columned input, label.columned select {
    width: 120px;
}

label:not(.columned) input {
    margin-top: 5px;
}

input[type=range] {
    padding: 0;
    width: 100%;
}

label.color-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

label.columned input[type=number] {
    width: 70px;
}

/* Toast Styles */
@keyframes slideOut {
    30% {
        opacity: 0;
    }

    100% {
        bottom: -20px;
        opacity: 0;
    }
}

.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(10vh + 40px);
    background: rgba(0,0,0,0.7);
    color: white;
    display: block;
    width: calc(100% - 40px);
    max-width: 400px;
    padding: 0.625rem 1rem;
    border-radius: 0.9rem;
}

.toast.hiding {
    animation: 1s slideOut forwards;

}

.toast.error {
    background: rgba(0,0,0,0.7);
    color: #FF0037;
    border: 1px solid #FF0037;
}

/* Image Section Styling */
.image-section {
    border: 1px solid white;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.preview-wrapper, #processed-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(255, 255, 255, 0.05);
    /* glassy overlay */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-top: 1em;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    /* glassmorphic touch */
    -webkit-backdrop-filter: blur(6px);
}

.preview-image, #processed-image {
    position: relative;
    object-fit: contain;
    height: 100%;
    width: 100%;
}

.response-bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.response-bottom-bar a {
    display: block;
    padding: 6px 15px;
    color: white;
    margin-block: 10px;
    font-size: 12px;
    border: 1px solid white;
    border-radius: 9999px;
    text-decoration: none;
}

/* Dropzone Styles */
.dropzone-wrapper {
    margin-top: 1rem;
}

.dropzone-wrapper * {
    -webkit-tap-highlight-color: transparent;
}

.dropzone-wrapper .dropzone.dropzone-section {
    background: var(--glass-color);
    border: none;
    border-radius: 0.8rem;
    height: 100%;
}

.dropzone-wrapper .dropzone.dropzone-section:hover {
    box-shadow: 0 0 10px #007FFF;
    transition: 1s all;
}

.dropzone-wrapper .dropzone {
    display: flex;
    justify-content: center;
    align-items: center;
}

.dropzone-wrapper .dropzone .dz-selected-file-info {
    padding: 0.5em 1em;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    gap: 0.3rem;
    align-items: center;
    flex-direction: column;
    color: white;
    font-size: 0.9rem;
}

.dropzone-wrapper .dropzone .dz-selected-file-info .dz-filename {
    display: bold;
}

.dropzone-wrapper .dropzone .dz-selected-file-info .dz-remove-btn {
    color: white;
    background: #f44336;
    font-size: 1.2em;
    padding: 3px 10px;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
}

.dropzone-wrapper .dropzone .dz-selected-file-info .dz-remove-btn:hover {
    background: white;
    color: #f44336;
    transition: 0.5s all ease-out;
}

/* Hide ugly preview and thumbs */
.dropzone-wrapper .dropzone .dz-no-preview .dz-image,
.dropzone-wrapper .dropzone .dz-no-preview .dz-success-mark,
.dropzone-wrapper .dropzone .dz-no-preview .dz-error-mark {
    display: none !important;
}

#data-container h3 {
    font-size: 20px;
    margin-block: 20px 5px;
}

@keyframes pulseSize {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.02);
    }
    50% {
        transform: scale(1);
    }
    70% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes redHighlight {
    from {
        border-color: red;
    }

    to {
        border-color: white;
    }
}

.highlight-animation {
    animation: 0.2s pulseSize 1.5s ease-out;
}

input[name=watermark_text].highlight-animation {
    animation: redHighlight 3s ease-in;
}

.lets-go-section.section {
    margin-top: 3rem;
    padding-top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lets-go-section p {
    text-align: center;
    line-height: 2rem;
}

#settings-form {
    margin-bottom: 3rem;
}

.page-heading {
    text-align: center;
}

.group-section:not(#group-general) {
    background: rgba(256,256,256,0.2);
    padding: 15px;
    margin-block: 1.5rem;
    border-radius: 15px;
}

@media (min-width: 768px) {
    label {
        width: calc(50% - 15px);
        display: inline-block;
        margin-block: 0.5rem !important;
    }
    label.columned {
        display: inline-flex;
    }
    .image-block-wrapper {
        display: flex;
        justify-content: space-between;
        align-items: stretch;
        gap: 20px;
    }
    .image-block-wrapper > * {
        width: 50%;
        aspect-ratio: 16/9;
    }
    .group-section {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        column-gap: 20px;
        align-items: end;
    }
    .group-section h3 {
        width: 100%;
        margin-top: 0;
    }
    .image-section {
        width: 100%;
    }
    .image-section .image-section-header {
        display: flex;
        align-items: center;
    }
    .image-section .image-section-header * {
        margin: 0 !important;
        width: 50%;
    }
}

/* === Checkbox Field Layout === */
.checkbox-layout {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
}

.checkbox-layout input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* === Slider === */
.checkbox-layout .slider {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--dark-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

/* Knob */
.checkbox-layout .slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.6);
    transition: transform 0.3s cubic-bezier(.2,.8,.2,1), background 0.3s ease;
}

/* Checked state */
.checkbox-layout input[type="checkbox"]:checked + .slider {
    background: linear-gradient(90deg, var(--range-primary-color), var(--range-secondary-color));
    box-shadow: 0 0 8px rgba(0,128,255,0.4);
}

.checkbox-layout input[type="checkbox"]:checked + .slider::after {
    transform: translateX(20px);
    background: #e0e8ff;
    box-shadow: 0 0 10px rgba(0,128,255,0.5);
}

/* Focus-visible */
.checkbox-layout input[type="checkbox"]:focus-visible + .slider {
    outline: 3px solid rgba(0,128,255,0.5);
    outline-offset: 3px;
}

/* Disabled state */
.checkbox-layout input[type="checkbox"]:disabled + .slider {
    opacity: 0.6;
    cursor: not-allowed;
}
.checkbox-layout input[type="checkbox"]:disabled ~ .label-text {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Label text */
.checkbox-layout .label-text {
    display: inline-block;
    color: #e5e7eb;
}


/* Range */
input[type=range] {
    width: 100%;
    /* Reset default styles */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    background: -webkit-linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color)) no-repeat, var(--dark-color);
    background: -moz-linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color)) no-repeat, var(--dark-color);
    background: -o-linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color)) no-repeat, var(--dark-color);
    background: linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color)) no-repeat, var(--dark-color);
    
    height: var(--range-height);
    border-radius: 99px;
    border: none;
    outline: none;
    
    /* Box shadow with prefixes */
    -webkit-box-shadow: 0 0 5px 2px #0056FF80;
    -moz-box-shadow: 0 0 5px 2px #0056FF80;
    box-shadow: 0 0 5px 2px #0056FF80;
}

/* Webkit (Chrome, Safari, newer versions of Edge) */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--range-thumb-size);
    height: var(--range-thumb-size);
    background: var(--dark-color);
    border: 3px solid var(--range-secondary-color);
    border-radius: 50%;
    -webkit-box-shadow: inset 0 0 3px 2px #0056FF80;
    box-shadow: inset 0 0 3px 2px #0056FF80;
    -webkit-transition: .2s;
    transition: .2s;
    cursor: pointer;
}

input[type=range]:focus-visible::-webkit-slider-thumb {
    -webkit-box-shadow: 0 0 0 6px #0ea5e933, 0 0 8px #0003;
    box-shadow: 0 0 0 6px #0ea5e933, 0 0 8px #0003;
}

/* Firefox */
input[type=range]::-moz-range-thumb {
    width: var(--range-thumb-size);
    height: var(--range-thumb-size);
    background: var(--dark-color);
    border: 3px solid var(--range-secondary-color);
    border-radius: 50%;
    -moz-box-shadow: inset 0 0 3px 2px #0056FF80;
    box-shadow: inset 0 0 3px 2px #0056FF80;
    -moz-transition: .2s;
    transition: .2s;
    cursor: pointer;
    border: none;
}

input[type=range]:focus-visible::-moz-range-thumb {
    -moz-box-shadow: 0 0 0 6px #0ea5e933, 0 0 8px #0003;
    box-shadow: 0 0 0 6px #0ea5e933, 0 0 8px #0003;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: var(--range-height);
    background: var(--dark-color);
    border-radius: 99px;
    border: none;
}

input[type=range]::-moz-range-progress {
    background: linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color));
    height: var(--range-height);
    border-radius: 99px;
}

/* IE */
input[type=range]::-ms-thumb {
    width: var(--range-thumb-size);
    height: var(--range-thumb-size);
    background: var(--dark-color);
    border: 3px solid var(--range-secondary-color);
    border-radius: 50%;
    box-shadow: inset 0 0 3px 2px #0056FF80;
    transition: .2s;
    cursor: pointer;
    border: none; /* IE has default border */
}

input[type=range]:focus-visible::-ms-thumb {
    box-shadow: 0 0 0 6px #0ea5e933, 0 0 8px #0003;
}

input[type=range]::-ms-track {
    width: 100%;
    height: var(--range-height);
    background: transparent;
    border-color: transparent;
    color: transparent;
    border-radius: 99px;
}

input[type=range]::-ms-fill-lower {
    background: linear-gradient(45deg, var(--range-primary-color), var(--range-secondary-color));
    border-radius: 99px;
}

input[type=range]::-ms-fill-upper {
    background: var(--dark-color);
    border-radius: 99px;
}

/* Transition with prefixes */
input[type=range]::-webkit-slider-thumb,
input[type=range]::-moz-range-thumb,
input[type=range]::-ms-thumb {
    -webkit-transition: all .2s ease;
    -moz-transition: all .2s ease;
    -ms-transition: all .2s ease;
    transition: all .2s ease;
}