.alert-container {
    position: relative;
    margin-top: 10px;
    padding: 0 1rem;
}

.alert {
    position: relative;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.alert .close-btn {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    font-size: 1rem;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.message_div {
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    margin-right: 10px;
    margin-bottom: 5px;
}

.clear-all-link {
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.messages-scroll-area {
    overflow-y: auto;                /* Enable vertical scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    scrollbar-gutter: stable; /* Prevent layout shift when scrollbar appears */ 
    margin-left: 10px; /* Reserve space on the left */
}

/* Optional: Bootstrap-style smooth scrollbars for WebKit browsers */
.messages-scroll-area::-webkit-scrollbar {
    width: 8px;
}

.messages-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-scroll-area::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15); /* Light gray scrollbar */
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.messages-scroll-area::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

.alert {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.alert.show {
  opacity: 1;
  transform: translateY(0);
}

div.alert-container > .alert {
    opacity: 1;
}