/*!
 * Cropper.js styles with customizations
 */

/* Base styles for cropper */
.cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    touch-action: none;
    user-select: none;
    max-width: 100%;
    background-color: #f3f4f6;
}

.cropper-container img {
    display: block;
    height: 100%;
    image-orientation: 0deg;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100%;
}

.cropper-wrap-box,
.cropper-canvas,
.cropper-drag-box,
.cropper-crop-box,
.cropper-modal {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.cropper-wrap-box {
    overflow: hidden;
}

.cropper-drag-box {
    background-color: #fff;
    opacity: 0;
}

.cropper-modal {
    background-color: #000;
    opacity: 0.5;
}

.cropper-view-box {
    display: block;
    height: 100%;
    outline: 0;
    box-shadow: 0 0 0 1px #39f;
    border-radius: 50%;
    overflow: hidden;
    width: 100%;
}

.cropper-dashed {
    border: 0 dashed #eee;
    display: block;
    opacity: 0.5;
    position: absolute;
}

.cropper-dashed.dashed-h {
    border-bottom-width: 1px;
    border-top-width: 1px;
    height: calc(100% / 3);
    left: 0;
    top: calc(100% / 3);
    width: 100%;
}

.cropper-dashed.dashed-v {
    border-left-width: 1px;
    border-right-width: 1px;
    height: 100%;
    left: calc(100% / 3);
    top: 0;
    width: calc(100% / 3);
}

.cropper-center {
    display: block;
    height: 0;
    left: 50%;
    opacity: 0.75;
    position: absolute;
    top: 50%;
    width: 0;
}

.cropper-center::before,
.cropper-center::after {
    background-color: #eee;
    content: " ";
    display: block;
    position: absolute;
}

.cropper-center::before {
    height: 1px;
    left: -3px;
    top: 0;
    width: 7px;
}

.cropper-center::after {
    height: 7px;
    left: 0;
    top: -3px;
    width: 1px;
}

.cropper-face,
.cropper-line,
.cropper-point {
    display: block;
    height: 100%;
    opacity: 0.1;
    position: absolute;
    width: 100%;
}

.cropper-face {
    background-color: #fff;
    left: 0;
    top: 0;
    border-radius: 50%;
}

.cropper-line {
    background-color: #39f;
}

.cropper-line.line-e {
    cursor: ew-resize;
    right: -3px;
    top: 0;
    width: 5px;
}

.cropper-line.line-n {
    cursor: ns-resize;
    height: 5px;
    left: 0;
    top: -3px;
}

.cropper-line.line-w {
    cursor: ew-resize;
    left: -3px;
    top: 0;
    width: 5px;
}

.cropper-line.line-s {
    bottom: -3px;
    cursor: ns-resize;
    height: 5px;
    left: 0;
}

.cropper-point {
    background-color: #39f;
    height: 5px;
    opacity: 0.75;
    width: 5px;
}

.cropper-point.point-e {
    cursor: ew-resize;
    margin-top: -3px;
    right: -3px;
    top: 50%;
}

.cropper-point.point-n {
    cursor: ns-resize;
    left: 50%;
    margin-left: -3px;
    top: -3px;
}

.cropper-point.point-w {
    cursor: ew-resize;
    left: -3px;
    margin-top: -3px;
    top: 50%;
}

.cropper-point.point-s {
    bottom: -3px;
    cursor: s-resize;
    left: 50%;
    margin-left: -3px;
}

.cropper-point.point-ne {
    cursor: nesw-resize;
    right: -3px;
    top: -3px;
}

.cropper-point.point-nw {
    cursor: nwse-resize;
    left: -3px;
    top: -3px;
}

.cropper-point.point-sw {
    bottom: -3px;
    cursor: nesw-resize;
    left: -3px;
}

.cropper-point.point-se {
    bottom: -3px;
    cursor: nwse-resize;
    height: 20px;
    opacity: 1;
    right: -3px;
    width: 20px;
}

@media (min-width: 768px) {
    .cropper-point.point-se {
        height: 15px;
        width: 15px;
    }
}

@media (min-width: 992px) {
    .cropper-point.point-se {
        height: 10px;
        width: 10px;
    }
}

@media (min-width: 1200px) {
    .cropper-point.point-se {
        height: 5px;
        opacity: 0.75;
        width: 5px;
    }
}

.cropper-point.point-se::before {
    background-color: #39f;
    bottom: -50%;
    content: " ";
    display: block;
    height: 200%;
    opacity: 0;
    position: absolute;
    right: -50%;
    width: 200%;
}

.cropper-invisible {
    opacity: 0;
}

.cropper-bg {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC");
}

.cropper-hide {
    display: block;
    height: 0;
    position: absolute;
    width: 0;
}

.cropper-hidden {
    display: none !important;
}

.cropper-move {
    cursor: move;
}

.cropper-crop {
    cursor: crosshair;
}

.cropper-disabled .cropper-drag-box,
.cropper-disabled .cropper-face,
.cropper-disabled .cropper-line,
.cropper-disabled .cropper-point {
    cursor: not-allowed;
}

/* Structure de base */
.max-w-xl {
    position: relative;
}

/* Preview styles */
#preview-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9fafb;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

#preview-container:hover {
    transform: scale(1.05);
}

#preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#default-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
}

/* Zone de recadrage */
#cropper-container {
    position: relative;
}

#cropper-container > div {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

#cropper-container .bg-white {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    position: relative;
    z-index: 51;
}

#cropper-container .fixed {
    backdrop-filter: blur(8px);
}

/* Masquer le contenu pendant le recadrage */
body.cropping > *:not(#app):not(form):not(#cropper-container) {
    filter: blur(4px);
    pointer-events: none;
}

body.cropping {
    overflow: hidden;
}

/* Améliorer l'apparence des boutons */
#rotate-left,
#rotate-right,
#crop-button,
#crop-cancel {
    transition: all 0.2s ease-in-out;
}

#rotate-left:hover,
#rotate-right:hover,
#crop-cancel:hover {
    background-color: #f3f4f6;
}

#crop-button:hover {
    background-color: #e11d48;
}

/* Upload button container */
.upload-container {
    text-align: center;
    margin-top: 20px;
}

/* Ensure preview is centered in parent container */
.w-full.max-w-lg.mb-4 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Cropper container styles */
#cropper-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background-color: #f3f4f6;
    height: 400px;
    display: none; /* Hidden by default */
}

#cropper-container.show {
    display: block;
}

#cropper-container img {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

/* Animation pour l'apparition/disparition du cropper */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

#cropper-container > div {
    animation: fadeIn 0.3s ease-out;
}

#cropper-container.hidden > div {
    animation: fadeOut 0.3s ease-out;
}

/* Ensure circular crop area */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

/* Styles pour les boutons */
#rotate-left,
#rotate-right,
#crop-button,
#crop-cancel {
    position: relative;
    z-index: 10000;
}

/* Modal d'aperçu */
#preview-modal .fixed {
    backdrop-filter: blur(8px);
}

#preview-modal .bg-white {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

#preview-modal img {
    border-radius: 9999px;
}

/* Styles pour les boutons */
#preview-close {
    transition: all 0.2s ease-in-out;
}

#preview-close:hover {
    transform: scale(1.1);
}

/* État du body avec modal */
body.modal-open {
    overflow: hidden;
}

/* Animation des modals */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#preview-modal:not(.hidden) .bg-white,
#cropper-container:not(.hidden) .bg-white {
    animation: modalFadeIn 0.3s ease-out;
}

/* Cropper styles */
#cropper-container .bg-white {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

/* Boutons */
#rotate-left,
#rotate-right,
#crop-button,
#crop-cancel,
#preview-edit {
    transition: all 0.2s ease-in-out;
}

#preview-edit:hover,
#crop-button:hover {
    background-color: #e11d48;
}

#rotate-left:hover,
#rotate-right:hover,
#crop-cancel:hover {
    background-color: #f3f4f6;
}
