/***** MODAL DIALOG ****/
#modal {
    /* Underlay covers entire screen. */
    position: fixed;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;

    /* Flexbox centers the .modal-content vertically and horizontally */
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Animate when opening */
    animation-name: fadeIn;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

#modal > .modal-underlay {
    /* underlay takes up the entire viewport. This is only
      required if you want to click to dismiss the popup */
    position: absolute;
    z-index: -1;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
}

#modal > .modal-content {
    /* Position visible dialog on the center of the screen */
    position: relative;
    margin: auto;

    /* Sizing for visible dialog */

    /* Display properties for visible dialog*/
    border: solid 1px #999;
    border-radius: 8px;
    box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
    background-color: white;

    /* Animate when opening */
    animation-name: zoomIn;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

#modal.closing {
    /* Animate when closing */
    animation-name: fadeOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

#modal.closing > .modal-content {
    /* Animate when closing */
    animation-name: zoomOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.closing {
    /* Animate when closing */
    animation-name: fadeOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.closing > .modal-content {
    /* Animate when closing */
    animation-name: zoomOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes zoomIn {
    0% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes zoomOut {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0.9);
    }
}

/* Smooth animations for dynamic note fields */
@keyframes slideDown {
    0% {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    0% {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
}

/* Note field container animations */
.note-field-container {
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.note-field-container.hidden {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.note-field-container.visible {
    opacity: 1;
    max-height: 200px;
    margin-top: 1rem;
    margin-bottom: 0;
}

.note-field-container.slide-down {
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.note-field-container.slide-up {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ensure smooth transitions for Shoelace components */
.note-field-container sl-textarea {
    transition: opacity 0.2s ease-in-out;
}

.note-field-container.hidden sl-textarea {
    opacity: 0;
}

.note-field-container.visible sl-textarea {
    opacity: 1;
}

/* HTMX-specific animations for smoother swapping */
.note-field-container.htmx-swapping {
    opacity: 0.7;
    transform: scale(0.98);
    transition: all 0.2s ease-in-out;
}

.note-field-container.htmx-settling {
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease-in-out;
}

/* Prevent layout shift during HTMX operations */
.note-field-container:empty {
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Smooth height transitions for better UX */
.note-field-container {
    transition: min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#employeeSelection {
    width: 880px !important;
    min-height: 97px !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
    padding-bottom: 8px !important;
    scrollbar-width: thin;
    padding-left: 3px;
}

#employeeSelection > div {
    flex-shrink: 0 !important;
    width: 60px !important;
}

#employeeSelection > button {
    flex-shrink: 0 !important;
}

#myForm > .relative:first-child {
    width: 220px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}
