/* Cyberpunk Popup System */
#popup-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    /* Max width constraint to avoid overflow */
    max-width: calc(100vw - 40px);
    width: 360px;
}

.cyber-popup {
    width: 100%;
    background: rgba(10, 10, 15, 0.95);
    border-left: 4px solid var(--popup-color);
    box-shadow: 0 0 15px var(--popup-color-glow);
    padding: 15px 20px 20px;
    position: relative;
    pointer-events: auto;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    overflow: hidden;
    animation: slideInRight 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.cyber-popup.hiding {
    animation: fadeOut 0.4s ease forwards;
}

.cyber-popup .popup-icon {
    font-size: 20px;
    text-shadow: 0 0 8px var(--popup-color);
    flex-shrink: 0;
}

.cyber-popup .popup-content {
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
    min-width: 0;
}

.cyber-popup .popup-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
    min-height: unset;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    clip-path: none !important;
}

.cyber-popup .popup-close:hover {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

.cyber-popup .popup-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--popup-color);
    width: 100%;
    animation: progressShrink linear forwards;
}

/* Colors by type */
.cyber-popup.popup-success {
    --popup-color: #00ff88;
    --popup-color-glow: rgba(0, 255, 136, 0.3);
}

.cyber-popup.popup-error {
    --popup-color: #ff003c;
    --popup-color-glow: rgba(255, 0, 60, 0.3);
}

.cyber-popup.popup-warning {
    --popup-color: #ff8800;
    --popup-color-glow: rgba(255, 136, 0, 0.3);
}

.cyber-popup.popup-info {
    --popup-color: #00f0ff;
    --popup-color-glow: rgba(0, 240, 255, 0.3);
}

/* Animations */
@keyframes slideInRight {
    0% { transform: translateX(110%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; transform: translateX(50px); }
}

@keyframes progressShrink {
    0% { width: 100%; }
    100% { width: 0%; }
}

/* ========================================================================= */
/* MOBILE: Stack popups at top, full-width */
/* ========================================================================= */
@media (max-width: 500px) {
    #popup-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        gap: 10px;
    }

    .cyber-popup {
        font-size: 12px;
        padding: 12px 14px 16px;
        gap: 10px;
    }

    .cyber-popup .popup-icon {
        font-size: 16px;
    }
}
