/*! Image Uploader - v1.2.3 - 26/11/2019
 * Copyright (c) 2019 Christian Bayer; Licensed MIT */

/* Icons Font Face*/
@font-face {
    font-family: 'Image Uploader Icons';
    src: url('https://cdn.jsdelivr.net/gh/christianbayer/image-uploader@master/fonts/iu.eot');
    src: url('https://cdn.jsdelivr.net/gh/christianbayer/image-uploader@master/fonts/iu.eot') format('embedded-opentype'),
    url('https://cdn.jsdelivr.net/gh/christianbayer/image-uploader@master/fonts/iu.ttf') format('truetype'),
    url('https://cdn.jsdelivr.net/gh/christianbayer/image-uploader@master/fonts/iu.woff') format('woff'),
    url('https://cdn.jsdelivr.net/gh/christianbayer/image-uploader@master/fonts/iu.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

/* Icons class */
[class^="iui-"], [class*="iui-"] {
    font-family: 'Image Uploader Icons' !important;
    speak: none;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Icon Close */
.iui-close:before {
    content: "\e900";
}

/* Icon Cloud Upload */
.iui-cloud-upload:before {
    content: "\e901";
}

/* Base style */
.uvf-image-uploader {
    min-height: 10rem;
    border: 1px solid #d9d9d9;
    position: relative;
}

/* Style on hover */
.uvf-image-uploader.uvf-drag-over {
    background-color: #f3f3f3;
}

/* Hide the file input */
.uvf-image-uploader input[type="file"] {
    width: 0;
    height: 0;
    position: absolute;
    z-index: -1;
    opacity: 0;
}

/* Text container */
.uvf-image-uploader .uvf-upload-text {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

.uvf-image-uploader .uvf-upload-text i {
    display: block;
    font-size: 3rem;
    margin-bottom: .5rem;
}

.uvf-image-uploader .uvf-upload-text span {
    display: block;
}

/* Hide the text if there is at least one uploaded image */
.uvf-image-uploader.uvf-has-files .uvf-upload-text {
    display: none;
}

/* Uploaded images container */
.uvf-image-uploader .uvf-uploaded {
    padding: .5rem;
    line-height: 0;
}

.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
    display: inline-block;
    width: calc(16.6666667% - 1rem);
    padding-bottom: calc(16.6666667% - 1rem);
    height: 0;
    position: relative;
    margin: .5rem;
    background: #f3f3f3;
    cursor: move;
}

.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
}

/* Delete image button */
.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image .uvf-delete-image {
    display: none;
    cursor: pointer;
    position: absolute;
    top: .2rem;
    right: .2rem;
    border-radius: 50%;
    padding: .3rem;
    line-height: 1;
    background-color: rgba(0, 0, 0, .5);
    -webkit-appearance: none;
    border: none;
}

.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image:hover .uvf-delete-image {
    display: block;
}

.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image .uvf-delete-image i {
    display: block;
    color: #fff;
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.4rem;
    line-height: 1.4rem;
}

@media screen and (max-width: 1366px) {
    .uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
        width: calc(20% - 1rem);
        padding-bottom: calc(20% - 1rem);
    }
}

@media screen and (max-width: 992px) {
    .uvf-image-uploader .uvf-uploaded {
        padding: .4rem;
    }

    .uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
        width: calc(25% - .8rem);
        padding-bottom: calc(25% - .4rem);
        margin: .4rem;
    }
}

@media screen and (max-width: 786px) {
    .uvf-image-uploader .uvf-uploaded {
        padding: .3rem;
    }

    .uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
        width: calc(33.3333333333% - .6rem);
        padding-bottom: calc(33.3333333333% - .3rem);
        margin: .3rem;
    }
}

@media screen and (max-width: 450px) {
    .uvf-image-uploader .uvf-uploaded {
        padding: .2rem;
    }

    .uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
        width: calc(33.3333333333% - .4rem);
        padding-bottom: calc(33.3333333333% - .4rem);
        margin: .2rem;
    }
}

/* --- Custom Styles from index.html --- */
/* Custom Image Uploader Styles to match Tailwind */
.uvf-image-uploader {
    min-height: 200px !important;
    border: 2px dashed #e2e8f0 !important; /* border-slate-200 */
    border-radius: 0.5rem !important; /* rounded-lg */
    background-color: #f8fafc !important; /* bg-slate-50 */
    transition: all 0.2s ease-in-out;
}
.uvf-image-uploader:hover, .uvf-image-uploader.uvf-drag-over {
    border-color: #94a3b8 !important; /* border-slate-400 */
    background-color: #f1f5f9 !important; /* bg-slate-100 */
}
.uvf-image-uploader .uvf-upload-text i {
    color: #94a3b8 !important; /* text-slate-400 */
    font-size: 3rem !important;
}
.uvf-image-uploader .uvf-upload-text span {
    color: #0f172a !important; /* text-slate-900 */
    font-weight: 500 !important;
    font-size: 0.875rem !important; /* text-sm */
}

/* Uploaded Images Grid */
.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
    background: #fff !important;
    border-radius: 0.5rem !important; /* rounded-lg */
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;
    overflow: hidden;
    /* Make images bigger: 3 per row on desktop */
    width: calc(33.333% - 1rem) !important;
    padding-bottom: calc(33.333% - 1rem) !important;
}

@media screen and (max-width: 640px) {
    .uvf-image-uploader .uvf-uploaded .uvf-uploaded-image {
        /* 3 per row on mobile */
        width: calc(33.333% - 1rem) !important;
        padding-bottom: calc(33.333% - 1rem) !important;
    }
}

/* Delete Button */
.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image .uvf-delete-image {
    background-color: #fff !important;
    color: #000 !important; /* text-black */
    top: 6px !important;
    right: 6px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.1) !important;
    text-decoration: none !important;
}

.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image .uvf-delete-image i {
    display: flex !important;
    align-items: center !important;
    line-height: inherit !important;
    font-size: 1.2rem !important;
    color: inherit !important;
}
.uvf-image-uploader .uvf-uploaded .uvf-uploaded-image .uvf-delete-image:hover {
    background-color: #f1f5f9 !important; /* bg-slate-100 */
    transform: scale(1.05);
}

/* Required upload – red outline when validation fails */
#uvf-profile-photo-uploader.uvf-error-outline .uvf-image-uploader,
#uvf-broker-id-uploader.uvf-error-outline .uvf-image-uploader {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4) !important;
    background-color: #fef2f2 !important;
}

/* Helper classes for jQuery logic */
.hidden-force { display: none !important; }

/* Mobile spacing for fixed back button */
@media screen and (max-width: 768px) {
    .uvf-wrapper .uvf-step-content {
        padding-bottom: 40px !important;
    }

    .uvf-step-content {
        position: relative !important;
        overflow: visible !important;
        padding-left: 0px !important;
        padding-right: 0px !important;
        padding-bottom: 40px !important;
        inset: auto !important;
        height: auto !important;
    }
}
