/* /css/toast.css – Improved Apple Glass Style */

.toast-notification {
    position: relative;
    /* Base padding */
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    display: flex; /* Use flexbox for alignment */
    align-items: center; /* Vertically center content */
    gap: 0.75rem;
    font-weight: 500;
    line-height: 1.4;

    /* Transparency & Base Style */
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--apple-card-border-light);
    background-color: var(--apple-card-bg-light);
    color: var(--sidebar-text-color);

    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(15px) scale(0.98);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    overflow: hidden; /* Prevent content overflow */

    /* Sizing - Allow natural width but constrain maximum */
    width: fit-content; /* Size based on content */
    max-width: 90vw; /* Prevent getting too wide on small screens */
    margin-left: auto; /* For top-right */
    margin-right: auto; /* For bottom-center */
}

/* Specific Max Width for top-right */
.toast-container-top-right .toast-notification {
    max-width: 450px;
}

/* Specific Max Width for bottom-center (can be wider) */
.toast-container-bottom-center .toast-notification {
     max-width: 600px;
}


[data-bs-theme="dark"] .toast-notification {
    background-color: var(--apple-card-bg-dark);
    border-color: var(--apple-card-border-dark);
    color: var(--sidebar-text-color);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Content Area */
.toast-text {
    flex-grow: 1; /* Allow text to take available space */
    word-wrap: break-word; /* Allow long words/passwords to wrap */
    /* Ensure text doesn't push the close button too far */
    padding-right: 2.5rem; /* Add padding ONLY if there's a close button sibling */
}
/* Remove right padding if there is NO close button */
.toast-text:only-child {
    padding-right: 0;
}


/* Close button */
.toast-close-btn {
    position: absolute;
    /* Position reliably top-right corner */
    top: 0.5rem;
    right: 0.5rem;

    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: var(--sidebar-text-color);
    opacity: 0.6;
    font-size: 1.25rem;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 2; /* Ensure it's above text */
    padding: 0;
    margin: 0;
    line-height: 2rem; /* Center the '×' */
    text-align: center;
    flex-shrink: 0; /* Prevent button from shrinking */

    /* Disable inherited button effects */
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
}

.toast-close-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
    transform: none !important;
}
[data-bs-theme="dark"] .toast-close-btn:hover {
     background-color: rgba(255, 255, 255, 0.1);
}

.toast-close-btn:active,
.toast-close-btn:focus {
    transform: none !important;
    outline: none;
    box-shadow: none !important;
}


/* Containers */
.toast-container-bottom-center,
.toast-container-top-right {
    position: fixed;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Prevent clicks going through the container */
    pointer-events: none;
}
/* Allow clicks on individual toasts */
.toast-container-bottom-center > *,
.toast-container-top-right > * {
    pointer-events: auto;
}


.toast-container-bottom-center {
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center; /* Center toasts horizontally */
    width: 100%; /* Take full width for centering */
    /* Adjust max-width based on sidebar state - prevents overlap */
    padding-left: var(--sidebar-width-expanded); /* Default padding */
    padding-right: 1rem;
     transition: padding-left 0.3s ease;
}
body.sidebar-collapsed .toast-container-bottom-center {
    padding-left: var(--sidebar-width-collapsed);
}
body.sidebar-hidden .toast-container-bottom-center {
    padding-left: 1rem;
}


.toast-container-top-right {
    top: 25px;
    right: 25px;
    align-items: flex-end; /* Align toasts to the right */
}