/* Gacha Treasure Suite - Popup Manager */

.gts-popup-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    display: flex;
    width: min(380px, calc(100vw - 40px));
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.gts-popup-container--bottom-left,
.gts-popup-container--top-left {
    right: auto;
    left: 20px;
}

.gts-popup-container--top-right,
.gts-popup-container--top-left {
    top: 20px;
    bottom: auto;
}

.gts-popup {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid #dbe4ec;
    border-left: 5px solid #0f8d96;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 16px 38px rgba(17, 24, 39, 0.2);
    color: #18212f;
    opacity: 0;
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(calc(100% + 24px));
    transition: opacity 200ms ease, transform 200ms ease;
}

.gts-popup.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.gts-popup.is-leaving {
    opacity: 0;
    transform: translateX(calc(100% + 24px));
}

.gts-popup--success {
    border-left-color: #16a34a;
}

.gts-popup--error {
    border-left-color: #dc2626;
}

.gts-popup--warning {
    border-left-color: #d97706;
}

.gts-popup--info,
.gts-popup--loading {
    border-left-color: #0f8d96;
}

.gts-popup__content {
    min-width: 0;
    flex: 1;
}

.gts-popup__title,
.gts-popup__message {
    margin: 0;
}

.gts-popup__title {
    color: #18212f;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.35;
}

.gts-popup__message {
    margin-top: 4px;
    color: #52606d;
    font-size: 0.875rem;
    line-height: 1.45;
}

.gts-popup__action {
    display: inline-flex;
    margin-top: 10px;
    color: #0f8d96;
    font-size: 0.875rem;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gts-popup__close {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #52606d;
    cursor: pointer;
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
}

.gts-popup__close:hover {
    background: #f1f5f9;
    color: #18212f;
}

.gts-popup__close:focus-visible,
.gts-popup__action:focus-visible {
    outline: 3px solid #0f8d96;
    outline-offset: 3px;
}

.gts-popup__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #0f8d96;
    transform: scaleX(1);
    transform-origin: left center;
    animation: gts-popup-progress var(--gts-popup-duration) linear forwards;
}

.gts-popup--success .gts-popup__progress {
    background: #16a34a;
}

.gts-popup--error .gts-popup__progress {
    background: #dc2626;
}

.gts-popup--warning .gts-popup__progress {
    background: #d97706;
}

@keyframes gts-popup-progress {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 640px) {
    .gts-popup-container {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .gts-popup-container--bottom-left,
    .gts-popup-container--top-left {
        right: auto;
        left: 12px;
    }

    .gts-popup-container--top-right,
    .gts-popup-container--top-left {
        top: 12px;
        bottom: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gts-popup {
        transition-duration: 1ms;
    }

    .gts-popup__progress {
        animation: none;
    }
}
